diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d5defe8..5f73d505 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,7 @@ if(AARE_FETCH_MINUIT2) Minuit2 GIT_REPOSITORY https://github.com/GooFit/Minuit2.git GIT_TAG v6-40-02 + GIT_SHALLOW TRUE UPDATE_DISCONNECTED 1) # Disable Minuit2 extras we don't need set(minuit2_mpi @@ -128,6 +129,10 @@ if(AARE_FETCH_MINUIT2) FetchContent_MakeAvailable(Minuit2) set_property(TARGET Minuit2Math PROPERTY POSITION_INDEPENDENT_CODE ON) + # Minuit2 is ~60 small files; compiling them in batches is several times + # faster + set_target_properties(Minuit2 Minuit2Math + PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 16) set_property(TARGET Minuit2 PROPERTY POSITION_INDEPENDENT_CODE ON) add_library(aare::Minuit2 ALIAS Minuit2) @@ -165,6 +170,7 @@ if(AARE_ZMQ) libzmq GIT_REPOSITORY https://github.com/zeromq/libzmq.git GIT_TAG v4.3.5 + GIT_SHALLOW TRUE PATCH_COMMAND ${ZMQ_PATCH_COMMAND} UPDATE_DISCONNECTED 1) # Disable unwanted options from libzmq @@ -198,6 +204,14 @@ if(AARE_ZMQ) FetchContent_Populate(libzmq) add_subdirectory(${libzmq_SOURCE_DIR} ${libzmq_BINARY_DIR} EXCLUDE_FROM_ALL) + # libzmq compiles its sources into the OBJECT library "objects" (on + # Windows directly into libzmq-static); batch them like Minuit2 + foreach(_zmq_target objects libzmq-static) + if(TARGET ${_zmq_target}) + set_target_properties( + ${_zmq_target} PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 16) + endif() + endforeach() endif() else() find_package(ZeroMQ 4 REQUIRED) @@ -218,6 +232,7 @@ if(AARE_FETCH_FMT) fmt GIT_REPOSITORY https://github.com/fmtlib/fmt.git GIT_TAG 12.1.0 + GIT_SHALLOW TRUE GIT_PROGRESS TRUE USES_TERMINAL_DOWNLOAD TRUE) set(FMT_INSTALL diff --git a/RELEASE.md b/RELEASE.md index 71778f51..1a6df702 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -16,6 +16,9 @@ - libzmq is only fetched or searched for with ``-DAARE_ZMQ=ON`` (default OFF) and is then available as ``aare::zmq``. Nothing in aare links it yet, and skipping it removes about 8 s from every CMake configure. +- Minuit2, and libzmq when enabled, are compiled as unity builds (about 5x + less compile time), and the fetched dependencies are shallow clones, which + makes a first configure faster and the build directory smaller. ## 2026.9.30 diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index e874a003..fab3fa19 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -6,7 +6,7 @@ FetchContent_Declare( benchmark GIT_REPOSITORY https://github.com/google/benchmark.git GIT_TAG v1.8.3 # Change to the latest version if needed -) + GIT_SHALLOW TRUE) # Ensure Google Benchmark is built correctly set(BENCHMARK_ENABLE_TESTING diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 7f4db4c0..db7974f3 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -11,7 +11,8 @@ if(AARE_FETCH_PYBIND11) FetchContent_Declare( pybind11 GIT_REPOSITORY https://github.com/pybind/pybind11 - GIT_TAG v3.0.3) + GIT_TAG v3.0.3 + GIT_SHALLOW TRUE) FetchContent_MakeAvailable(pybind11) else() find_package(pybind11 3.0.3 REQUIRED)