xcode - How to set up CMake to build an app for the iPhone -
This is very closely related to me, which was supposed to use the SIMKK to create a stable library on iMax. Found to set CMAKE_OSX_SYSROOT .
However, this does not work in making the app. I find CMakeLists.txt to:
project set (test) (CMAKE_OSX_SYSROOT iphoneos2.2.1) set (CMAKE_OSX_ARCHITECTURES "$ (ARCHS_STANDARD_32_BIT)") set (CMAKE_EXE_LINKER_FLAGS " - framework Foundation -framework OpenGLES -framework AudioToolbox -framework CoreGraphics -framework QuartzCore -framework UIKit -framework OpenAL ") set (SRC --my files--) add_executable (iphone test MACOSX_BUNDLE $ {src}) Some notes:
- I'm explicitly giving
-fromworklinking options becausefind_librarydoes not work for everyone Framework (this is the most of them Or, butOpenGLESnot found) I do not understand, because they are all in the same folder$ {SDK} / System / Library / Framework. This I believe that I was doing something wrong, but I do not know what. - I added
MACOSX_BUNDLEto add_executableso that the order generated product typecom.apple.product-type.applicationInstead ofcom.apple.product-type.tool, which is apparently not present on the iPhone.
In any case, the app correctly compiles and links, but when I run it in the simulator, I get scary
simulated Application: Unknown error. Lots of problems are reported on Google and stackoverflow, but all solutions include cleaning or creating a new project and running files; But I am preparing a new copy after which the work of the seamkey is done, so none of them is applicable.
I was found on the CMAC mailing list, but it only reports success in building the library, and then the patrons.
After all, I thought how to do it, here's what my CMakeLists.txt File appears:
set (test) set (NAME test) file (globe header * .h) file (global source * .cpp) set (CMAKE_OSX_SYSROOT iphoneos2.2.1) set (CMAKE_OSX_ARCHITECTURES set $ (ARCHS_STANDARD_32_BIT)) or (CMAKE_CXX_FLAGS "-x objective-c ++") set (CMAKE_EXE_LINKER_FLAGS "Framework audio Tolboks Framework core graphics framework Kwortjhkor Fremlain UIKit") link_directories (\ $ {c T} / \ $ {SDKROOT} / lib) set (MACOSX_BUNDLE_GUI_IDENTIFIER "com.mycompany \ $ {PRODUCT_NAME: identifier}.") Set (APP_TYPE MACOSX_BUNDLE) add_executable ($ {name} $ {APP_TYPE} $ {header} $ {sources According}) target_link_libraries ($ {name} # to add other libraries) # code signing set_target_properties ($ {name} properties XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone developer: My name") of course Change the change Mycompany to your company name and change my name to your name. I found that this link directory is very useful for adding as \ $ {HOME} / \ $ {SDKROOT} / lib as above, so that if your app is stable (especially a normal library Non-iPhone) library), you can create different iPhoneOS and iPhoneSimulator libraries and easily link to the right, instead of worrying about a universal binary.
In addition, Xcode is not a project that you use to properly build a CMake project, so I added it to the CMakeLists.txt file. This copies the whole folder / data into my resource folder (such as I added the link "blue" to Xcode).
# copy processing stage set APP_NAME \ $ {TARGET_BUILD_DIR} / \ $ {FULL_PRODUCT_NAME}) Set (RES_DIR $ {test_SOURCE_DIR} / data) add_custom_command (TARGET $ {NAME} POST_BUILD COMMAND / Developer / Library / Personal Framework / DevToolscore.Framework / Resources / pbxcp -exclude .DS_Store -Agree CVS -exclude .svn -resolve-src-symlinks $ {RES_DIR} $ {APP_NAME})
Comments
Post a Comment