Skip to content

Commit

Permalink
Add ccache detection to ICU build configuration for improved compilat…
Browse files Browse the repository at this point in the history
…ion speed
  • Loading branch information
royshil committed Nov 22, 2024
1 parent cedbdc4 commit b2a540c
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions cmake/BuildICU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,35 @@ if(WIN32)
"${ICU_LIB_${lib}}")
endforeach()
else()
# Add ccache detection at the start
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
message(STATUS "Found ccache: ${CCACHE_PROGRAM}")
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
endif()

set(ICU_URL
"https://github.com/unicode-org/icu/releases/download/release-${ICU_VERSION_DASH}/icu4c-${ICU_VERSION_UNDERSCORE}-src.tgz"
)
set(ICU_HASH "SHA256=cb968df3e4d2e87e8b11c49a5d01c787bd13b9545280fc6642f826527618caef")
if(APPLE)
set(ICU_PLATFORM "MacOSX")
set(TARGET_ARCH -arch\ $ENV{MACOS_ARCH})
set(ICU_BUILD_ENV_VARS CFLAGS=${TARGET_ARCH} CXXFLAGS=${TARGET_ARCH} LDFLAGS=${TARGET_ARCH})
set(ICU_BUILD_ENV_VARS
CFLAGS=${TARGET_ARCH}
CXXFLAGS=${TARGET_ARCH}
LDFLAGS=${TARGET_ARCH}
CC="${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}"
CXX="${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER}")
else()
set(ICU_PLATFORM "Linux")
set(ICU_BUILD_ENV_VARS CFLAGS=-fPIC CXXFLAGS=-fPIC LDFLAGS=-fPIC)
set(ICU_BUILD_ENV_VARS
CFLAGS=-fPIC
CXXFLAGS=-fPIC
LDFLAGS=-fPIC
CC="${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}"
CXX="${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER}")
endif()

ExternalProject_Add(
Expand Down

0 comments on commit b2a540c

Please sign in to comment.