Skip to content

Commit 41a23c9

Browse files
authored
Merge pull request #412 from eseiler/infra/ccache
[INFRA] Use ccache everywhere
2 parents 8101941 + 65c7bda commit 41a23c9

File tree

5 files changed

+32
-5
lines changed

5 files changed

+32
-5
lines changed

cmake/ccache.cmake

+28-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ include (FindPackageMessage)
1515
# * https://ccache.dev/
1616
# * https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_LAUNCHER.html
1717
macro (raptor_require_ccache)
18-
set (RAPTOR_USE_CCACHE
19-
ON
20-
CACHE BOOL "Use ccache if available."
21-
)
18+
option (RAPTOR_USE_CCACHE "Use ccache if available." ON)
19+
option (RAPTOR_USE_CCACHE_IN_PARENT_PROJECT "Use ccache in parent project if available." OFF)
2220
set (RAPTOR_FPROFILE_ABS_PATH "-fprofile-abs-path")
2321
if (RAPTOR_USE_CCACHE)
2422
find_program (CCACHE_PROGRAM ccache)
@@ -42,7 +40,33 @@ macro (raptor_require_ccache)
4240
list (PREPEND CMAKE_C_LINKER_LAUNCHER "${CCACHE_PROGRAM}")
4341
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_CXX_LINKER_LAUNCHER=${CMAKE_CXX_LINKER_LAUNCHER}")
4442
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_LINKER_LAUNCHER=${CMAKE_C_LINKER_LAUNCHER}")
43+
endif ()
4544

45+
if (RAPTOR_USE_CCACHE_IN_PARENT_PROJECT)
46+
set (RAPTOR_FPROFILE_ABS_PATH
47+
${RAPTOR_FPROFILE_ABS_PATH}
48+
PARENT_SCOPE
49+
)
50+
set (SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS
51+
${SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS}
52+
PARENT_SCOPE
53+
)
54+
set (CMAKE_CXX_COMPILER_LAUNCHER
55+
${CMAKE_CXX_COMPILER_LAUNCHER}
56+
PARENT_SCOPE
57+
)
58+
set (CMAKE_C_COMPILER_LAUNCHER
59+
${CMAKE_C_COMPILER_LAUNCHER}
60+
PARENT_SCOPE
61+
)
62+
set (CMAKE_CXX_LINKER_LAUNCHER
63+
${CMAKE_CXX_LINKER_LAUNCHER}
64+
PARENT_SCOPE
65+
)
66+
set (CMAKE_C_LINKER_LAUNCHER
67+
${CMAKE_C_LINKER_LAUNCHER}
68+
PARENT_SCOPE
69+
)
4670
endif ()
4771
unset (CCACHE_PROGRAM)
4872
endif ()

test/raptor-test.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ message (STATUS "${ColourBold}Configuring tests${ColourReset}")
2222
# ----------------------------------------------------------------------------
2323

2424
get_filename_component (RAPTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
25+
option (RAPTOR_USE_CCACHE_IN_PARENT_PROJECT "" ON)
2526
add_subdirectory ("${RAPTOR_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor")
2627
set_property (TARGET raptor PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
2728
target_compile_options (raptor_raptor INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror")

util/applications/src/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
1111
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
1212

1313
get_filename_component (RAPTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
14+
option (RAPTOR_USE_CCACHE_IN_PARENT_PROJECT "" ON)
1415
add_subdirectory ("${RAPTOR_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor")
1516

1617
add_library (utility_common INTERFACE)

util/iScience/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
1212
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
1313

1414
get_filename_component (RAPTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
15+
option (RAPTOR_USE_CCACHE_IN_PARENT_PROJECT "" ON)
1516
add_subdirectory ("${RAPTOR_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor")
1617

1718
# Define cmake configuration flags to configure and build external projects with the same flags as specified for
1819
# this project.
19-
set (SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "")
2020
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "--no-warn-unused-cli")
2121
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
2222
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -w")

util/test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
1414
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
1515

1616
get_filename_component (RAPTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
17+
option (RAPTOR_USE_CCACHE_IN_PARENT_PROJECT "" ON)
1718
add_subdirectory ("${RAPTOR_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor")
1819
target_compile_options (raptor_raptor INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror")
1920

0 commit comments

Comments
 (0)