Idu*_*ool 5 c++ iphone ios swiften
关于图书馆的简短说明:图书馆的链接
我想为iPhone sdk 编译swift库(即http://swift.im/git/swift/tag/?id=swift-2.0beta1).我检查了它的文档文件夹和编译方式,但他们只提到了Windows和Unix的编译步骤(即此页面包含编译文件的链接http://swift.im/download/#apt).但我没有得到如何为iPhone sdk编译它.他们提到的步骤没有得到.那么,任何人都可以解释一下吗?检查其中一个文件后我才知道应该可以为iPhone编译.
还有一个问题,他们提到它是在GNU通用公共许可证v3下,所以我可以使用它商业应用程序,特别是苹果批准它吗?
任何帮助,将不胜感激.谢谢
FiguresSwiften已经内置了对 iOS 设备或模拟器构建的支持。我能够构建它,但还没有测试它。
我假设您使用 XCode 4.4 (或足够现代的东西)并以在 iPhone > 3GS 上运行的 iOS 5.1为目标。另外,我假设您想要构建 swiften-1.0。(如果为早期 iPhone 构建,请改armv7回armv6以下内容)
构建它涉及几个步骤。
swift-1.0/BuildTools/SCons/SConstruct在文件编辑器中打开,然后:
将第 232 行更改为
env["XCODE_PLATFORM_DEVELOPER_BIN_DIR"] = "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin"
到
env["XCODE_PLATFORM_DEVELOPER_BIN_DIR"] = "/Applications/Xcode.app/Contents" + "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin"
在第 234 行,更改armv6为armv7
将第 240 行更改为
env["XCODE_SDKROOT"] = "/Developer/Platforms/" + sdkPart + ".platform/Developer/SDKs/" + sdkPart + sdkVer + ".sdk"
到
env["XCODE_SDKROOT"] = "/Applications/Xcode.app/Contents" + "/Developer/Platforms/" + sdkPart + ".platform/Developer/SDKs/" + sdkPart + sdkVer + ".sdk"
crt_externs.h到swift-1.0/(摘自 Matt Galloway 的iPhone 编译提升)
复制crt_externs.h到swift的目录;时swift-1.0/,执行:
cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/usr/include/crt_externs.h .
Run Code Online (Sandbox Code Playgroud)
opensslswiften需要openssl,但 iOS 没有内置的,因此您必须手动下载并编译它。在终端中执行以下命令:
cd <swift-directory>/3rdParty/OpenSSL
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
Run Code Online (Sandbox Code Playgroud)
这将下载 openssl 的源代码;为了构建它,我使用了来自 GitHub 的脚本。仍然在<swift-directory>/swift-1.0/3rdParty/OpenSSL,执行,
wget --no-check-certificate https://raw.github.com/st3fan/ios-openssl/master/build.sh
Run Code Online (Sandbox Code Playgroud)
编辑build.sh- 将第 10 行从 更改1.0.1b为1.0.1c。
现在,chmod +x build.sh最后./build.sh。这将需要几分钟的时间来构建openssl。
swiften你就快到了 - 将目录更改为 的根目录swift,然后执行
./scons Swiften allow_warnings=yes target=iphone-device openssl="<swift-directory>/3rdParty/OpenSSL"
Run Code Online (Sandbox Code Playgroud)
这将构建一个库,用于链接为设备构建的应用程序;如果你想在模拟器中运行它,请更改target=iphone-device为target-iphone-simulator上面的行。库文件libSwiften.a可以在 中找到<swift-directory>/Swiften。