Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INFRA] Use ccache everywhere #412

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions cmake/ccache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ include (FindPackageMessage)
# * https://ccache.dev/
# * https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_LAUNCHER.html
macro (raptor_require_ccache)
set (RAPTOR_USE_CCACHE
ON
CACHE BOOL "Use ccache if available."
)
option (RAPTOR_USE_CCACHE "Use ccache if available." ON)
option (RAPTOR_USE_CCACHE_IN_PARENT_PROJECT "Use ccache in parent project if available." OFF)
set (RAPTOR_FPROFILE_ABS_PATH "-fprofile-abs-path")
if (RAPTOR_USE_CCACHE)
find_program (CCACHE_PROGRAM ccache)
Expand All @@ -42,7 +40,33 @@ macro (raptor_require_ccache)
list (PREPEND CMAKE_C_LINKER_LAUNCHER "${CCACHE_PROGRAM}")
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_CXX_LINKER_LAUNCHER=${CMAKE_CXX_LINKER_LAUNCHER}")
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_LINKER_LAUNCHER=${CMAKE_C_LINKER_LAUNCHER}")
endif ()

if (RAPTOR_USE_CCACHE_IN_PARENT_PROJECT)
set (RAPTOR_FPROFILE_ABS_PATH
${RAPTOR_FPROFILE_ABS_PATH}
PARENT_SCOPE
)
set (SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS
${SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS}
PARENT_SCOPE
)
set (CMAKE_CXX_COMPILER_LAUNCHER
${CMAKE_CXX_COMPILER_LAUNCHER}
PARENT_SCOPE
)
set (CMAKE_C_COMPILER_LAUNCHER
${CMAKE_C_COMPILER_LAUNCHER}
PARENT_SCOPE
)
set (CMAKE_CXX_LINKER_LAUNCHER
${CMAKE_CXX_LINKER_LAUNCHER}
PARENT_SCOPE
)
set (CMAKE_C_LINKER_LAUNCHER
${CMAKE_C_LINKER_LAUNCHER}
PARENT_SCOPE
)
endif ()
unset (CCACHE_PROGRAM)
endif ()
Expand Down
1 change: 1 addition & 0 deletions test/raptor-test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ message (STATUS "${ColourBold}Configuring tests${ColourReset}")
# ----------------------------------------------------------------------------

get_filename_component (RAPTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
option (RAPTOR_USE_CCACHE_IN_PARENT_PROJECT "" ON)
add_subdirectory ("${RAPTOR_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor")
set_property (TARGET raptor PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
target_compile_options (raptor_raptor INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror")
Expand Down
1 change: 1 addition & 0 deletions util/applications/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

get_filename_component (RAPTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
option (RAPTOR_USE_CCACHE_IN_PARENT_PROJECT "" ON)
add_subdirectory ("${RAPTOR_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor")

add_library (utility_common INTERFACE)
Expand Down
2 changes: 1 addition & 1 deletion util/iScience/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

get_filename_component (RAPTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
option (RAPTOR_USE_CCACHE_IN_PARENT_PROJECT "" ON)
add_subdirectory ("${RAPTOR_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor")

# Define cmake configuration flags to configure and build external projects with the same flags as specified for
# this project.
set (SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "")
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "--no-warn-unused-cli")
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -w")
Expand Down
1 change: 1 addition & 0 deletions util/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

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

Expand Down