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
。