FigureSwiftenには、iOS デバイスまたはシミュレーター用のビルドのサポートが既に組み込まれています。ビルドできましたが、テストしていません。
XCode 4.4 (または十分に最新のもの) を使用し、iPhone > 3GS で動作する iOS 5.1をターゲットにしていると仮定します。また、swiften-1.0 をビルドしたいと仮定します。(以前の iPhone 用にビルドする場合は、以下armv7に戻してくださいarmv6)
それを構築するには、いくつかの手順が必要です。
修正パスと SDK バージョン
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
- 239行目で「4.0」を「5.1」に変更
行 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 のCompiling Boost for the 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 .
ダウンロードとビルドopenssl
swiftenが必要opensslですが、iOS にはビルトインがないため、手動でダウンロードしてコンパイルする必要があります。ターミナルで次を実行します。
cd <swift-directory>/3rdParty/OpenSSL
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
これにより、openssl のソースがダウンロードされます。それを構築するために、GitHub のスクリプトを使用しました。まだ<swift-directory>/swift-1.0/3rdParty/OpenSSL、実行中、
wget --no-check-certificate https://raw.github.com/st3fan/ios-openssl/master/build.sh
編集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"
これにより、デバイス用に構築されたアプリケーションにリンクするためのライブラリが構築されます。シミュレーターで実行する場合は、上記の行で に変更target=iphone-deviceしtarget-iphone-simulatorます。ライブラリ ファイルlibSwiften.aは にあります<swift-directory>/Swiften。