[cmake-developers] iOS: direction to official support and questions
Raffi Enficiaud
raffi.enficiaud at mines-paris.org
Tue Aug 8 08:08:50 EDT 2017
Hi CMake ML,
I am quite new to the topic of making toolchain files. However I need to
build a not so trivial application for iOS and I want to do it with
CMake, and if possible walk toward an official support of iOS in CMake.
I have looked a bit to the Android toolchains, and I have to say I found
those quite complicated as a first reading :)
The target application I am building uses Qt and Boost.
So far, I have managed to have an IOS toolchain file that is generating
a looking good XCode project, that I can compile properly (up until
signing).
I can share the toolchain file: it is a collection of things I have
found on the internet, but trimmed from what I think was not necessary.
It is still in a not so nice state, but I am currently cleaning it.
There are things that I think are weird though:
* I need to have:
```
set(CMAKE_FIND_ROOT_PATH
${CMAKE_IOS_DEVELOPER_ROOT}
${CMAKE_IOS_SDK_ROOT}
${CMAKE_PREFIX_PATH}
/path/to/boost_1_64_0_build/install
CACHE string "iOS find search path root")
```
where this path is hard coded, and points to the fat static libraries
prefix path of boost. If I remove this path, FindBoost does not find the
boost libraries anymore (of course I am passing BOOST_ROOT). In
addition, I have this:
```
set (CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
```
this looks ok to me, as we are cross compiling.
Is this a problem of FindBoost, or the combinations of the options that
are not ok?
* I need to add:
```
set(CMAKE_MACOSX_BUNDLE YES)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
```
and this comes from https://public.kitware.com/Bug/view.php?id=15329 .
As I understand it, this is a problem of try_compile: as signing of
application is required for generating a binary for iOS, this one fails
very early when CMake discovers the capabilities of the compiler. Some
people made a workaround by short-cutting the compiler checks, which is
to me a wrong direction to take. As mentioned in this ticket, the right
solution would be that the try_compile commands not to require signing
of the binaries (or sthg similar).
This is explained here: http://public.kitware.com/Bug/view.php?id=12288
* is this one https://cmake.org/Bug/view.php?id=12640 addressed?
* I am seeing exchanges concerning the IOS_INSTALL_COMBINED. Does this
has something to do with toolchain? What is meant by "installation" in
this case? Sorry for my naive question, but I do not understand the
workflow very well.
* how can I have unit tests of the toolchain in a CI fashion. Ideally, I
would like to have a target cross-compiled with this toolchain, and then
running the iPhoneSimulator, and check the result (return code, process,
command whatever).
Does anyone have experience with this?
Thanks,
Raffi
More information about the cmake-developers
mailing list