From d5b0b5da44d62cd9cb14653801f0a5e7a691bbe7 Mon Sep 17 00:00:00 2001 From: David Beckingsale Date: Fri, 12 Apr 2024 16:57:59 -0700 Subject: [PATCH] Make fmt header-only by default (#879) --- Dockerfile | 10 +++++++--- cmake/SetupUmpireOptions.cmake | 1 + src/tpl/CMakeLists.txt | 6 +++--- src/umpire/event/CMakeLists.txt | 2 +- src/umpire/resource/CMakeLists.txt | 2 +- src/umpire/util/CMakeLists.txt | 2 +- umpire-config.cmake.in | 2 +- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0123eb663..64cdf5c0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,9 +50,13 @@ FROM ghcr.io/rse-ops/clang-ubuntu-22.04:llvm-12.0.0 AS clang12 ENV GTEST_COLOR=1 COPY . /home/umpire/workspace WORKDIR /home/umpire/workspace/build -RUN cmake -DUMPIRE_ENABLE_DEVELOPER_DEFAULTS=On -DCMAKE_CXX_COMPILER=clang++ .. && \ - make -j 16 && \ - ctest -T test --output-on-failure +RUN cmake -DUMPIRE_ENABLE_DEVELOPER_DEFAULTS=On -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_INSTALL_PREFIX=/home/umpire/workspace/install .. && \ + make -j 16 && make install && \ + ctest -T test --output-on-failure && \ + cd /home/umpire/workspace/install/examples/umpire/using-with-cmake && \ + mkdir build && cd build && \ + cmake -C ../host-config.cmake .. && \ + make FROM ghcr.io/rse-ops/clang-ubuntu-22.04:llvm-11.0.0 AS umap_build ENV GTEST_COLOR=1 diff --git a/cmake/SetupUmpireOptions.cmake b/cmake/SetupUmpireOptions.cmake index 769ee49a8..725afbae1 100644 --- a/cmake/SetupUmpireOptions.cmake +++ b/cmake/SetupUmpireOptions.cmake @@ -39,6 +39,7 @@ option(UMPIRE_ENABLE_SANITIZER_TESTS "Enable address sanitizer tests" Off) option(UMPIRE_ENABLE_DEVICE_ALLOCATOR "Enable Device Allocator" Off) option(UMPIRE_ENABLE_SQLITE_EXPERIMENTAL "Build with sqlite event integration (experimental)" Off) option(UMPIRE_DISABLE_ALLOCATIONMAP_DEBUG "Disable verbose output from AllocationMap during debug builds" Off) +set(UMPIRE_FMT_TARGET fmt::fmt-header-only CACHE STRING "Name of fmt target to use") if (UMPIRE_ENABLE_INACCESSIBILITY_TESTS) set(ENABLE_GTEST_DEATH_TESTS On CACHE BOOL "Enable tests asserting failure.") diff --git a/src/tpl/CMakeLists.txt b/src/tpl/CMakeLists.txt index 1baa33fe7..ee9cd751b 100644 --- a/src/tpl/CMakeLists.txt +++ b/src/tpl/CMakeLists.txt @@ -135,7 +135,7 @@ if (NOT TARGET camp) endif() endif () -if (NOT TARGET fmt::fmt) +if (NOT TARGET ${UMPIRE_FMT_TARGET}) if (DEFINED fmt_DIR) find_package(fmt REQUIRED NO_DEFAULT_PATH @@ -143,8 +143,8 @@ if (NOT TARGET fmt::fmt) ${fmt_DIR} ${fmt_DIR}/lib64/cmake/fmt) - set_target_properties(fmt::fmt PROPERTIES IMPORTED_GLOBAL TRUE) - blt_convert_to_system_includes(TARGET fmt::fmt) + set_target_properties(${UMPIRE_FMT_TARGET} PROPERTIES IMPORTED_GLOBAL TRUE) + blt_convert_to_system_includes(TARGET ${UMPIRE_FMT_TARGET}) else () if (NOT EXISTS ${PROJECT_SOURCE_DIR}/src/tpl/umpire/fmt/CMakeLists.txt) message(FATAL_ERROR "fmt submodule not initialized. Run 'git submodule update --init --recursive' in the git repository or set fmt_DIR to use an external build of fmt.") diff --git a/src/umpire/event/CMakeLists.txt b/src/umpire/event/CMakeLists.txt index 1f58cb117..c51c0668b 100644 --- a/src/umpire/event/CMakeLists.txt +++ b/src/umpire/event/CMakeLists.txt @@ -17,7 +17,7 @@ set (umpire_event_sources json_file_store.cpp recorder_factory.cpp) -set (umpire_event_depends fmt::fmt umpire_tpl_json camp) +set (umpire_event_depends ${UMPIRE_FMT_TARGET} umpire_tpl_json camp) if (UMPIRE_ENABLE_CUDA) set(umpire_event_depends diff --git a/src/umpire/resource/CMakeLists.txt b/src/umpire/resource/CMakeLists.txt index 2932366cd..2b68818f5 100644 --- a/src/umpire/resource/CMakeLists.txt +++ b/src/umpire/resource/CMakeLists.txt @@ -5,7 +5,7 @@ # SPDX-License-Identifier: (MIT) ############################################################################## -set(umpire_resource_depends umpire_util camp fmt::fmt) +set(umpire_resource_depends umpire_util camp ${UMPIRE_FMT_TARGET}) set (umpire_resource_headers DefaultMemoryResource.hpp diff --git a/src/umpire/util/CMakeLists.txt b/src/umpire/util/CMakeLists.txt index aa2071720..3ab396ce4 100644 --- a/src/umpire/util/CMakeLists.txt +++ b/src/umpire/util/CMakeLists.txt @@ -52,7 +52,7 @@ if (UMPIRE_ENABLE_NUMA) numa.cpp) endif () -set (umpire_util_depends camp umpire_event umpire_tpl_judy fmt::fmt) +set (umpire_util_depends camp umpire_event umpire_tpl_judy ${UMPIRE_FMT_TARGET}) if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") set (umpire_util_depends diff --git a/umpire-config.cmake.in b/umpire-config.cmake.in index cffc2a661..b0edcbfa0 100644 --- a/umpire-config.cmake.in +++ b/umpire-config.cmake.in @@ -40,7 +40,7 @@ if (@UMPIRE_ENABLE_IPC_SHARED_MEMORY@) find_dependency(Threads) endif () -if (NOT TARGET fmt::fmt) +if (NOT TARGET @UMPIRE_FMT_TARGET@) set(UMPIRE_FMT_DIR "@fmt_DIR@") if(NOT fmt_DIR) set(fmt_DIR ${UMPIRE_FMT_DIR})