Skip to content

Commit

Permalink
Enhance ICU build configuration to use ccache as a compiler wrapper f…
Browse files Browse the repository at this point in the history
…or improved performance
  • Loading branch information
royshil committed Nov 22, 2024
1 parent b2a540c commit b4b4cb4
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions cmake/BuildICU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ else()
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}")
# Create compiler wrapper commands
set(C_LAUNCHER "${CCACHE_PROGRAM} ${CMAKE_C_COMPILER}")
set(CXX_LAUNCHER "${CCACHE_PROGRAM} ${CMAKE_CXX_COMPILER}")
endif()

set(ICU_URL
Expand All @@ -63,20 +64,11 @@ else()
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}
CC="${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}"
CXX="${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER}")
set(ICU_BUILD_ENV_VARS CFLAGS=${TARGET_ARCH} CXXFLAGS=${TARGET_ARCH} LDFLAGS=${TARGET_ARCH} CC=${C_LAUNCHER}
CXX=${CXX_LAUNCHER})
else()
set(ICU_PLATFORM "Linux")
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}")
set(ICU_BUILD_ENV_VARS CFLAGS=-fPIC CXXFLAGS=-fPIC LDFLAGS=-fPIC CC=${C_LAUNCHER} CXX=${CXX_LAUNCHER})
endif()

ExternalProject_Add(
Expand Down

0 comments on commit b4b4cb4

Please sign in to comment.