有人可以告诉我在哪里找到详细的指南,如何构建Boost库以在iPhone设备上使用。
我已经为Mac构建了这些库,并且可以在我的项目中使用(仅在iPhone模拟器上)。在为iPhone设备构建项目时,XCode会出现警告:“文件不符合所需的架构”和一些其他错误。
请帮忙。
./bootstrap.sh --with-libraries=context
project-config.jam
的工具集中:# IOS ARM64
using clang : iphoneos
: xcrun clang -arch arm64 -stdlib=libc++ -std=c++11 -miphoneos-version-min=12.0 -fvisibility-inlines-hidden -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
;
# IOS x86_64
using clang : iphonesimulator
: xcrun clang -arch x86_64 -stdlib=libc++ -std=c++11 -miphoneos-version-min=12.0 -fvisibility-inlines-hidden -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
;
lib=libboost_context.a
dir='stage/lib'
# Build arm64
./b2 -a -j4 toolset=clang-iphoneos binary-format=mach-o abi=aapcs link=static stage
mv $dir/$lib $dir/arm64_$lib
# Build x86_64
./b2 -a -j4 toolset=clang-iphonesimulator binary-format=mach-o abi=sysv link=static stage
mv $dir/$lib $dir/x86_64_$lib
# Make fat
lipo -create $dir/arm64_$lib $dir/x86_64_$lib -output $dir/$lib
arm64_libboost_context.a
、x86_64_libboost_context.a
和合并后的 libboost_context.a
。使用iPhone静态库项目模板在Xcode中启动一个新项目。 然后导入源代码和头文件,并进行编译。结果应该是一个适用于iPhone的静态库。
嘿,我在我的openFrameworks插件中更新了Pete Goodliffe的脚本:
之前的答案帮助了我想要为arm模拟器构建boost。当你拥有一台配备M1处理器的Mac并想要使用模拟器时,你不能使用iPhone的arm64构建。
我将这个添加到project-config.jam中:
# IOS Arm Simulator
using clang : iphonesimulatorarm64
: xcrun clang -arch arm64 -stdlib=libc++ -std=c++11 -miphoneos-version-min=10.0 -fvisibility-inlines-hidden -target arm64-apple-ios10.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk ;
然后将toolset=clang-iphonesimulatorarm64传递给b2命令。