Adding fmt dependency

This commit is contained in:
Marco De Lucia 2024-12-13 13:13:32 +01:00
parent d121585894
commit a4be284b1d
2 changed files with 18 additions and 3 deletions

View File

@ -28,6 +28,7 @@ target_link_libraries(
) )
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
cli11 cli11
QUIET QUIET
@ -37,6 +38,19 @@ FetchContent_Declare(
FetchContent_MakeAvailable(cli11) FetchContent_MakeAvailable(cli11)
## MDL: adding fmtlib
find_package(FMT QUIET)
if (NOT ${FMT_FOUND})
FetchContent_Declare(
FMT
QUIET
GIT_REPOSITORY https://github.com/fmtlib/fmt
GIT_TAG 0c9fce2ffefecfdce794e1859584e25877b7b592 # 11.0.2
)
FetchContent_MakeAvailable(fmt)
endif()
# add_library(poetlib # add_library(poetlib
# Base/Grid.cpp # Base/Grid.cpp
# Base/SimParams.cpp # Base/SimParams.cpp
@ -85,11 +99,11 @@ file(READ "${PROJECT_SOURCE_DIR}/R_lib/ai_surrogate_model.R" R_AI_SURROGATE_LIB)
configure_file(poet.hpp.in poet.hpp @ONLY) configure_file(poet.hpp.in poet.hpp @ONLY)
add_executable(poet poet.cpp) add_executable(poet poet.cpp)
target_link_libraries(poet PRIVATE POETLib MPI::MPI_C RRuntime CLI11::CLI11) target_link_libraries(poet PRIVATE POETLib MPI::MPI_C RRuntime CLI11::CLI11 fmt::fmt)
target_include_directories(poet PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") target_include_directories(poet PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
add_executable(poet_init initializer.cpp) add_executable(poet_init initializer.cpp)
target_link_libraries(poet_init PRIVATE POETLib RRuntime CLI11::CLI11) target_link_libraries(poet_init PRIVATE POETLib RRuntime CLI11::CLI11 fmt::fmt)
target_include_directories(poet_init PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") target_include_directories(poet_init PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
install(TARGETS poet poet_init DESTINATION bin) install(TARGETS poet poet_init DESTINATION bin)

View File

@ -44,6 +44,7 @@
#include <poet.hpp> #include <poet.hpp>
#include <vector> #include <vector>
#include <fmt/core.h>
// using namespace std; // using namespace std;
using namespace poet; using namespace poet;
@ -298,7 +299,7 @@ static Rcpp::List RunMasterLoop(RInsidePOET &R, const RuntimeParameters &params,
MSG("Going through iteration " + std::to_string(iter) + "/" + MSG("Going through iteration " + std::to_string(iter) + "/" +
std::to_string(maxiter)); std::to_string(maxiter));
MSG("Current time step is " + std::to_string(dt)); MSG("Current time step is " + fmt::format("{:.2f}", dt));
/* run transport */ /* run transport */
diffusion.simulate(dt); diffusion.simulate(dt);