Skip to content

Commit

Permalink
Merge pull request #412 from eseiler/infra/ccache
Browse files Browse the repository at this point in the history
[INFRA] Use ccache everywhere
  • Loading branch information
eseiler committed Dec 29, 2023
2 parents 8101941 + 65c7bda commit 41a23c9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
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

1 comment on commit 41a23c9

@vercel
Copy link

@vercel vercel bot commented on 41a23c9 Dec 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

raptor – ./

raptor-seqan.vercel.app
raptor-git-main-seqan.vercel.app
seqan-raptor.vercel.app

Please sign in to comment.