summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuha Alanen <juha.alanen@mapbox.com>2020-02-24 17:04:37 +0200
committerJuha Alanen <juha.alanen@mapbox.com>2020-02-25 11:43:52 +0200
commit89f2390bb97629e9fc56009e1f852925151ccc4f (patch)
treed5768baf5151830d713e4e0e2f7b1b6bfa521c8e
parent815a7049d8edf96f4db43233a074127da55d4207 (diff)
downloadqtlocation-mapboxgl-89f2390bb97629e9fc56009e1f852925151ccc4f.tar.gz
[build][ios] Move iOS specific ccache scripts to platform directory
-rw-r--r--CMakeLists.txt20
-rw-r--r--platform/ios/ccache.cmake27
-rw-r--r--platform/ios/ios.cmake1
-rw-r--r--platform/ios/scripts/ccache-c.in (renamed from scripts/ci/ccache-c.in)0
-rw-r--r--platform/ios/scripts/ccache-cxx.in (renamed from scripts/ci/ccache-cxx.in)0
5 files changed, 28 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54214da897..21da9ea54d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,26 +1,6 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project("Mapbox GL Native" LANGUAGES CXX C)
-find_program(CCACHE_PROGRAM ccache)
-if(CCACHE_PROGRAM AND CMAKE_SYSTEM_NAME STREQUAL "iOS")
- # Set up wrapper scripts
- set(C_LAUNCHER "${CCACHE_PROGRAM}")
- set(CXX_LAUNCHER "${CCACHE_PROGRAM}")
- configure_file(${PROJECT_SOURCE_DIR}/scripts/ci/ccache-c.in ccache-c)
- configure_file(${PROJECT_SOURCE_DIR}/scripts/ci/ccache-cxx.in ccache-cxx)
- execute_process(
- COMMAND
- chmod
- a+rx
- "${CMAKE_BINARY_DIR}/ccache-c"
- "${CMAKE_BINARY_DIR}/ccache-cxx"
- )
-
- # 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")
-endif()
-
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER Core)
diff --git a/platform/ios/ccache.cmake b/platform/ios/ccache.cmake
new file mode 100644
index 0000000000..fb5e6670e8
--- /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/scripts/ccache-c.in ccache-c)
+ configure_file(${PROJECT_SOURCE_DIR}/platform/ios/scripts/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 6b6dd4886c..9d1b4d91c9 100644
--- a/platform/ios/ios.cmake
+++ b/platform/ios/ios.cmake
@@ -79,6 +79,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)
diff --git a/scripts/ci/ccache-c.in b/platform/ios/scripts/ccache-c.in
index f75d456e5d..f75d456e5d 100644
--- a/scripts/ci/ccache-c.in
+++ b/platform/ios/scripts/ccache-c.in
diff --git a/scripts/ci/ccache-cxx.in b/platform/ios/scripts/ccache-cxx.in
index 81831ad4dc..81831ad4dc 100644
--- a/scripts/ci/ccache-cxx.in
+++ b/platform/ios/scripts/ccache-cxx.in