Quantcast

Up to date iOS instructions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Up to date iOS instructions

Harry Mallon
Hello,

Are there any up to date instructions for doing iOS builds? There are load of tutorials going back many years on Google. I am using something based on this https://github.com/cristeab/ios-cmake as a toolchain file currently but I am seeing the ${EFFECTIVE_PLATFORM_NAME} generator expression problem mentioned here last year (https://cmake.org/pipermail/cmake/2016-March/063113.html). I have heard something about CMAKE_OSX_SYSROOT = iphoneos and maybe CMAKE_IOS_INSTALL_COMBINED?

Yours,
Harry

Harry Mallon

CODEX | Software Engineer

60 Poland Street | London | England | W1F 7NT

E [hidden email] | T <a id="c1-id-17" style="TEXT-DECORATION: none; COLOR: gray" href="callto:&#43;44 203 7000 989"> +44 203 7000 989 

Website | Facebook | Twitter


--

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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [EXTERNAL]: Up to date iOS instructions

Parag Chandra

Hi Harry,

 

I’m not sure about any official instructions, but here’s how I’m doing it:

 

# Adapted from https://code.google.com/p/ios-cmake/

 

# Standard settings

set (CMAKE_SYSTEM_NAME Darwin)

set (CMAKE_SYSTEM_VERSION 1)

set (UNIX True)

set (APPLE True)

set (IOS True)

 

# Required as of cmake 2.8.10

set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE)

 

# Figure out where Xcode is installed

execute_process (COMMAND "xcode-select" "--print-path" OUTPUT_VARIABLE CMAKE_XCODE_ROOT OUTPUT_STRIP_TRAILING_WHITESPACE)

set (CMAKE_XCODE_ROOT ${CMAKE_XCODE_ROOT} CACHE PATH "Location of Xcode. Normally auto-detected via 'xcode-select', but can be overridden")

 

# Skip the platform compiler checks for cross compiling

set (CMAKE_CXX_COMPILER_WORKS TRUE)

set (CMAKE_C_COMPILER_WORKS TRUE)

 

# Setup iOS platform unless specified manually with DEVICE_OR_SIMULATOR

if (NOT DEFINED DEVICE_OR_SIMULATOR)

    set (DEVICE_OR_SIMULATOR "OS")

endif ()

set (DEVICE_OR_SIMULATOR ${DEVICE_OR_SIMULATOR} CACHE STRING "Set to 'Simulator' (for simulators), or 'OS' (for devices)")

 

# Check the platform selection and setup for developer root

if (NOT((${DEVICE_OR_SIMULATOR} STREQUAL "OS") OR (${DEVICE_OR_SIMULATOR} STREQUAL "Simulator")))

    message (FATAL_ERROR "Unsupported DEVICE_OR_SIMULATOR value selected. Please choose 'OS' or 'Simulator'")

endif ()

 

set (CMAKE_IOS_DEVELOPER_ROOT "${CMAKE_XCODE_ROOT}/Platforms/iPhone${DEVICE_OR_SIMULATOR}.platform/Developer")

 

# Find and use the most recent iOS sdk unless specified manually with CMAKE_IOS_SDK_ROOT

if (NOT DEFINED CMAKE_IOS_SDK_ROOT)

    file (GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*")

    if (_CMAKE_IOS_SDKS)

        list (SORT _CMAKE_IOS_SDKS)

        list (REVERSE _CMAKE_IOS_SDKS)

        list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT)

    else ()

        message (FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")

    endif ()

    message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}")

endif ()

set (CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")

 

set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")

 

# Set the sysroot default to the most recent SDK

# If we're generating Xcode projects, the keyword "iphoneos" is all that's needed; otherwise

# we need to specify the complete path

if (${CMAKE_GENERATOR} STREQUAL "Xcode")

    set (CMAKE_OSX_SYSROOT "iphoneos")

else ()

    # set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")

    # Actually, just fail - we haven't yet done the work to support any generator except Xcode for iOS

    message (FATAL_ERROR "Only the Xcode generator is supported at this time. Be sure to specify '-GXcode' on the cmd line.")

endif ()

 

# Set the find root to the iOS developer roots and to user defined paths

set (CMAKE_FIND_ROOT_PATH "${CMAKE_XCODE_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin" ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE string  "iOS find search path root")

 

# default to searching for frameworks first

set (CMAKE_FIND_FRAMEWORK FIRST)

 

# set up the default search directories for frameworks

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

)

 

 

 

 


Parag Chandra
Technical Lead, Mobile Team
Mobile: +1.919.824.1410

Ionic Security Inc.
1170 Peachtree St. NE STE 400, Atlanta, GA 30309

 

 

From: CMake <[hidden email]> on behalf of Harry Mallon <[hidden email]>
Date: Monday, January 9, 2017 at 6:54 AM
To: "[hidden email]" <[hidden email]>
Subject: [EXTERNAL]: [CMake] Up to date iOS instructions

 

Hello,

 

Are there any up to date instructions for doing iOS builds? There are load of tutorials going back many years on Google. I am using something based on this https://github.com/cristeab/ios-cmake as a toolchain file currently but I am seeing the ${EFFECTIVE_PLATFORM_NAME} generator expression problem mentioned here last year (https://cmake.org/pipermail/cmake/2016-March/063113.html). I have heard something about CMAKE_OSX_SYSROOT = iphoneos and maybe CMAKE_IOS_INSTALL_COMBINED?

 

Yours,

Harry

Harry Mallon

CODEX | Software Engineer

60 Poland Street | London | England | W1F 7NT

E [hidden email] | T <a href="callto:&#43;44%20203%207000%20989">+44 203 7000 989 

Website | Facebook | Twitter


--

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