diff options
author | Juha Alanen <juha.alanen@mapbox.com> | 2020-02-24 17:04:37 +0200 |
---|---|---|
committer | Juha Alanen <juha.alanen@mapbox.com> | 2020-02-27 10:09:35 +0200 |
commit | b756ff8e14037d4f25db1a14c7533ca513a0f2e0 (patch) | |
tree | efa70a292398f2cb0d814d841ae023b78c86f0a5 /platform/ios | |
parent | 18e9ed1c0b7007a0d4e2ce14ed687270900e24ba (diff) | |
download | qtlocation-mapboxgl-b756ff8e14037d4f25db1a14c7533ca513a0f2e0.tar.gz |
[build][ios] Move iOS specific ccache scripts to platform directory
Diffstat (limited to 'platform/ios')
-rw-r--r-- | platform/ios/ccache-c.in | 9 | ||||
-rw-r--r-- | platform/ios/ccache-cxx.in | 9 | ||||
-rw-r--r-- | platform/ios/ccache.cmake | 27 | ||||
-rw-r--r-- | platform/ios/ios.cmake | 1 |
4 files changed, 46 insertions, 0 deletions
diff --git a/platform/ios/ccache-c.in b/platform/ios/ccache-c.in new file mode 100644 index 0000000000..f75d456e5d --- /dev/null +++ b/platform/ios/ccache-c.in @@ -0,0 +1,9 @@ +#!/bin/sh + +# Xcode generator doesn't include the compiler as the +# first argument, Ninja and Makefiles do. Handle both cases. +if [[ "$1" = "${CMAKE_C_COMPILER}" ]] ; then + shift +fi + +exec "${C_LAUNCHER}" "${CMAKE_C_COMPILER}" "$@" diff --git a/platform/ios/ccache-cxx.in b/platform/ios/ccache-cxx.in new file mode 100644 index 0000000000..81831ad4dc --- /dev/null +++ b/platform/ios/ccache-cxx.in @@ -0,0 +1,9 @@ +#!/bin/sh + +# Xcode generator doesn't include the compiler as the +# first argument, Ninja and Makefiles do. Handle both cases. +if [[ "$1" = "${CMAKE_CXX_COMPILER}" ]] ; then + shift +fi + +exec "${CXX_LAUNCHER}" "${CMAKE_CXX_COMPILER}" "$@" diff --git a/platform/ios/ccache.cmake b/platform/ios/ccache.cmake new file mode 100644 index 0000000000..cedf062a16 --- /dev/null +++ b/platform/ios/ccache.cmake @@ -0,0 +1,27 @@ +find_program(CCACHE_PROGRAM ccache) +if(CCACHE_PROGRAM) + # Set up wrapper scripts + set(C_LAUNCHER "${CCACHE_PROGRAM}") + set(CXX_LAUNCHER "${CCACHE_PROGRAM}") + configure_file(${PROJECT_SOURCE_DIR}/platform/ios/ccache-c.in ccache-c) + configure_file(${PROJECT_SOURCE_DIR}/platform/ios/ccache-cxx.in ccache-cxx) + execute_process( + COMMAND + chmod + a+rx + "${CMAKE_BINARY_DIR}/ccache-c" + "${CMAKE_BINARY_DIR}/ccache-cxx" + ) + + if(CMAKE_GENERATOR STREQUAL "Xcode") + # Set Xcode project attributes to route compilation and linking through our scripts + set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/ccache-c") + set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/ccache-cxx") + set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/ccache-c") + set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/ccache-cxx") + else() + # Support Unix Makefiles and Ninja + set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/ccache-c") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/ccache-cxx") + endif() +endif() diff --git a/platform/ios/ios.cmake b/platform/ios/ios.cmake index 3b86353558..7e9db575ab 100644 --- a/platform/ios/ios.cmake +++ b/platform/ios/ios.cmake @@ -76,6 +76,7 @@ target_include_directories( ) include(${PROJECT_SOURCE_DIR}/vendor/icu.cmake) +include(${PROJECT_SOURCE_DIR}/platform/ios/ccache.cmake) initialize_ios_target(mbgl-core) initialize_ios_target(mbgl-vendor-icu) |