From 64e1c066935e75b915c623613858922b559dd250 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 1 Feb 2024 15:21:01 -0800 Subject: [PATCH] Add pyAMReX_CCACHE Option (#247) Cleaner way to disable CCache in package managers. --- CMakeLists.txt | 10 +++++++++- docs/source/install/cmake.rst | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63eba1e3..d7515c59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,15 @@ set_cxx17_superbuild() # this is an optional tool that stores compiled object files; allows fast # re-builds even with "make clean" in between. Mainly used to store AMReX # objects -set_ccache() +if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + set(pyAMReX_CCACHE_DEFAULT ON) +else() + set(pyAMReX_CCACHE_DEFAULT OFF) # we are a subproject in a superbuild +endif() +option(pyAMReX_CCACHE "Enable ccache for faster rebuilds" ${pyAMReX_CCACHE_DEFAULT}) +if(pyAMReX_CCACHE) + set_ccache() +endif() # Output (build) Directories ################################################## diff --git a/docs/source/install/cmake.rst b/docs/source/install/cmake.rst index 8116220b..d70639f7 100644 --- a/docs/source/install/cmake.rst +++ b/docs/source/install/cmake.rst @@ -108,7 +108,7 @@ By default, the most important dependencies of pyAMReX are automatically downloa CMake Option Default & Values Description ============================= ============================================== =========================================================== ``BUILD_SHARED_LIBS`` ON/**OFF** Build shared libraries for dependencies -``CCACHE_PROGRAM`` First found ``ccache`` executable. Set to ``-DCCACHE_PROGRAM=NO`` to disable CCache. +``pyAMReX_CCACHE`` **ON**/OFF Search and use CCache to speed up rebuilds. ``pyAMReX_amrex_src`` *None* Path to AMReX source directory (preferred if set) ``pyAMReX_amrex_repo`` ``https://github.com/AMReX-Codes/amrex.git`` Repository URI to pull and build AMReX from ``pyAMReX_amrex_branch`` *we set and maintain a compatible commit* Repository branch for ``pyAMReX_amrex_repo``