Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I finally figured out how to do this. Here's what my <code>CMakeLists.txt</code> file looks like:</p> <pre><code>project(test) set(NAME test) file(GLOB headers *.h) file(GLOB sources *.cpp) set(CMAKE_OSX_SYSROOT iphoneos2.2.1) set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT)) set(CMAKE_CXX_FLAGS "-x objective-c++") set(CMAKE_EXE_LINKER_FLAGS "-framework AudioToolbox -framework CoreGraphics -framework QuartzCore -framework UIKit" ) link_directories(\${HOME}/\${SDKROOT}/lib) set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.mycompany.\${PRODUCT_NAME:identifier}") set(APP_TYPE MACOSX_BUNDLE) add_executable(${NAME} ${APP_TYPE} ${headers} ${sources} ) target_link_libraries(${NAME} # other libraries to link ) # code signing set_target_properties(${NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer: My Name") </code></pre> <p>Obviously, change <code>mycompany</code> to your company name, and change <code>My Name</code> to your name. I found it's very useful to add the link directory <code>\${HOME}/\${SDKROOT}/lib</code> as above, so that if your app links to a static library (especially a generic (non-iPhone) library), you can build separate iPhoneOS and iPhoneSimulator libraries and easily link to the right one, instead of worrying about a universal binary.</p> <p>Also, Xcode doesn't seem to properly add resources when you build the project using CMake, so I added this piece to the <code>CMakeLists.txt</code> file. It copies the entire folder <code>/data</code> into my resources folder (as if I had added a "blue" folder link in Xcode).</p> <pre><code># copy resource phase 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/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -exclude CVS -exclude .svn -resolve-src-symlinks ${RES_DIR} ${APP_NAME} ) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload