[build][ios] Move iOS specific ccache scripts to platform directory

This commit is contained in:
Juha Alanen
2020-02-24 17:04:37 +02:00
parent 18e9ed1c0b
commit b756ff8e14
5 changed files with 28 additions and 20 deletions

View File

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

27
platform/ios/ccache.cmake Normal file
View File

@@ -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()

View File

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