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
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to