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

Re-enable TILEDB_CCACHE support. #5342

Merged
merged 3 commits into from
Oct 10, 2024
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
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ else()
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if (TILEDB_CCACHE)
include(FindCcache)
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
endif()

# Set -fvisibility=hidden (or equivalent) flags by default.
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
Expand Down
19 changes: 6 additions & 13 deletions cmake/Modules/FindCcache.cmake
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
## cf https://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmake
## leading to https://invent.kde.org/kde/konsole/merge_requests/26/diffs
find_program(CCACHE_FOUND NAMES "sccache" "ccache")
set(CCACHE_SUPPORT ON CACHE BOOL "Enable ccache support")
if (CCACHE_FOUND AND CCACHE_SUPPORT)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC
OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# without this compiler messages in `make` backend would be uncolored
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto")
endif()
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND})
Copy link
Member

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

I don't know anything about Windows and how building works there, but https://cmake.org/cmake/help/latest/prop_gbl/RULE_LAUNCH_COMPILE.html makes it clear that RULE_LAUNCH_COMPILE is internal.

And the commit message of llvm/llvm-project@0fad18c seems to indicate CMake 3.4 should be enough, the commit was reverted in llvm/llvm-project@fff762d because the build bots needed to be updated first.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's likely setting these properties caused compile errors. They used to be applied only on the superbuild so they were not actually being used before.

set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_FOUND})
message(STATUS "Found ccache: ${CCACHE_FOUND}")
else()
message(FATAL_ERROR "Unable to find ccache")
find_program(CCACHE REQUIRED NAMES "sccache" "ccache")

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC
OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# without this compiler messages in `make` backend would be uncolored
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto")
endif()
Loading