Skip to content

Commit

Permalink
Make fmt header-only by default (#879)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbeckingsale authored Apr 12, 2024
1 parent 30c6ae9 commit d5b0b5d
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cmake/SetupUmpireOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
6 changes: 3 additions & 3 deletions src/tpl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,16 @@ 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
PATHS
${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.")
Expand Down
2 changes: 1 addition & 1 deletion src/umpire/event/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/umpire/resource/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/umpire/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion umpire-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit d5b0b5d

Please sign in to comment.