Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set up CMake to build an app for the iPhone
    primarykey
    data
    text
    <p>This is closely related to my <a href="https://stackoverflow.com/questions/794137/how-to-set-up-cmake-to-build-a-library-for-the-iphone">previous question</a>, which was about using CMake to build a static library on the iPhone. I got that to work setting the <code>CMAKE_OSX_SYSROOT</code>.</p> <p>However, this doesn't work to build an app. My <code>CMakeLists.txt</code> looks like:</p> <pre><code>project(TEST) set(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}) </code></pre> <p>A few notes:</p> <ul> <li>I'm explicitly giving the <code>-framework</code> linking option because <code>find_library</code> didn't work for all of the frameworks (it found most of them, but not <code>OpenGLES</code>). I don't understand why, since they're all in the same folder <code>${SDK}/System/Library/Frameworks</code>. This leads me to believe that I was doing something wrong, but I don't know what.</li> <li>I added <code>MACOSX_BUNDLE</code> to the <code>add_executable</code> command so that the product type generated would be <code>com.apple.product-type.application</code> instead of <code>com.apple.product-type.tool</code>, which apparently doesn't exist on the iPhone.</li> </ul> <p>In any case, the app compiles and links correctly, but when I run it in the simulator, I get the dreaded</p> <pre><code>Failed to launch simulated application: Unknown error. </code></pre> <p>There are lots of reported instances of this problem on google and stackoverflow, but all of the solutions involve cleaning up or creating a new project and moving files; but I'm compiling a fresh copy after CMake does its work, so none of that applies.</p> <p>I found <a href="http://www.mail-archive.com/cmake@cmake.org/msg20676.html" rel="nofollow noreferrer">this thread</a> on the CMake mailing list, but it only reports a success in building a library, and then peters out.</p>
    singulars
    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.
 

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