[cmake-developers] iOS: direction to official support and questions
Brad King
brad.king at kitware.com
Wed Sep 27 17:40:54 EDT 2017
On 09/27/2017 08:18 AM, Raffi Enficiaud wrote:
> For cross-compiling a project on iOS or iOS simulator, and since those 2
> platforms are still Darwin, I believe that:
>
> * from a user perspective:
> * CMAKE_SYSTEM_NAME should be set to "Darwin"
> * CMAKE_SYSTEM_VERSION should be set to iOS or iOS-simulator,
> possibly with a version (like "Mac OSX 10.2" in Darwin.cmake)
Although macOS is based on Darwin, it has historically been a mistake
to make CMAKE_SYSTEM_NAME "Darwin". macOS and iOS are different
enough that they each should have their own platform names/modules.
Also, CMAKE_SYSTEM_VERSION should always be a number.
> However, I just notice the existence of
> "Modules/Platform/Darwin-Initialize.cmake" that is setting several
> variables. When is this file sourced? should be before
> "Modules/Platform/Darwin.cmake" but I failed to see from where.
See comments here:
https://gitlab.kitware.com/cmake/cmake/blob/v3.9.3/Source/cmGlobalGenerator.cxx#L333-372
for how all those files are loaded. `iOS*.cmake` modules would be
appropriate for first-class iOS support. Ideally it should work
with just `-DCMAKE_SYSTEM_NAME=iOS` without a full toolchain file,
if that is possible.
> I see several problems with this file if I were to make it iOS aware.
> For instance it contains variables that are checking for the version,
> but based only on the macOS scheme.
That's why CMAKE_SYSTEM_NAME should be distinct so we can use a totally
separate set of modules. I think that solves most of the other problems
you raised.
> PS: how should we proceed with the developments? Having a fork on Gitlab
> based on master and start integrating from there would be ok? Do you
> need a build machine first?
Yes, this should be integrated through a fork and merge request.
For tests, take a look at how the `Tests/RunCMake/Android` test works.
We should be able to turn on iOS support tests on macOS builds on
hosts that have iOS development infrastructure installed.
-Brad
More information about the cmake-developers
mailing list