KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to cross-compiling from Mac OS X to iOS. It was easy using clang to cross-compile a source to iOS target. We need only 3 parameters get it to work. clang -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk -miphoneos-version-min=4.3 But the problem is I have to build a library (Bullet Physics) packaged with Cmake. And as far as I know, Cmake has no iOS support yet. So, I made a toolchain file. SET (CMAKE_SYSTEM_NAME "Generic") SET (CMAKE_SYSTEM_VERSION "4.3") SET (CMAKE_SYSTEM_PROCESSOR "arm") SET (CMAKE_CROSSCOMPILING TRUE) SET (SDKVER "4.3") SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer") SET (SDKROOT "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk") SET (CMAKE_OSX_SYSROOT "${SDKROOT}") SET (CMAKE_OSX_ARCHITECTURES "armv6" "armv7") SET (CMAKE_C_COMPILER "${DEVROOT}/usr/bin/clang") SET (CMAKE_CXX_COMPILER "${DEVROOT}/usr/bin/clang++") SET (CMAKE_C_FLAGS "-arch armv6 -arch armv7 -isysroot ${SDKROOT} -std=c99 -x objective-c -DNDEBUG=1") SET (CMAKE_CXX_FLAGS "-arch armv6 -arch armv7 -isysroot ${SDKROOT} -x objective-c++ -DNDEBUG=1") SET (CMAKE_EXE_LINKER_FLAGS "-miphoneos-version-min=${SDKVER}") SET (CMAKE_SHARED_LINKER_FLAGS "-miphoneos-version-min=${SDKVER}") SET (CMAKE_MODULE_LINKER_FLAGS "-miphoneos-version-min=${SDKVER}") SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) And executed. cmake -DCMAKE_TOOLCHAIN_FILE=../CMAKE_IPHONEOS_TOOLCHAIN.cmake ../bullet-2.78 cmake itself done well. make done well. All build complete without any error. However built binary was x64 non-fat binary instead of armv6/armv7 fat binary. Genera
Tags (comma-separated)
Save Edits
Cancel