From ab83d8c3502d7cf0354529d1a39cff92057f60d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20L=C3=BCbke?= Date: Wed, 6 Mar 2024 12:34:02 +0100 Subject: [PATCH] Add R library file as string to executable --- src/CMakeLists.txt | 4 +++- src/poet.cpp | 3 +-- src/poet.hpp.in | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 984e2c2d0..1494c0849 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,7 +38,9 @@ if (POET_PHT_ADDITIONAL_INFO) target_compile_definitions(poetlib PRIVATE POET_PHT_ADD) endif() -configure_file(poet.hpp.in poet.hpp) +file(READ "${PROJECT_SOURCE_DIR}/R_lib/kin_r_library.R" R_KIN_LIB ) + +configure_file(poet.hpp.in poet.hpp @ONLY) add_executable(poet poet.cpp) target_link_libraries(poet PRIVATE poetlib MPI::MPI_C RRuntime) diff --git a/src/poet.cpp b/src/poet.cpp index c4996dc97..10c706a0d 100644 --- a/src/poet.cpp +++ b/src/poet.cpp @@ -302,8 +302,7 @@ int main(int argc, char *argv[]) { /*Loading Dependencies*/ // TODO: kann raus - std::string r_load_dependencies = "source('../R_lib/kin_r_library.R');"; - R.parseEvalQ(r_load_dependencies); + R.parseEvalQ(kin_r_library); SimParams params(world_rank, world_size); int pret = params.parseFromCmdl(argv, R); diff --git a/src/poet.hpp.in b/src/poet.hpp.in index 6a85179d4..666fbaa08 100644 --- a/src/poet.hpp.in +++ b/src/poet.hpp.in @@ -1,8 +1,10 @@ #ifndef POET_H #define POET_H +#include static const char *poet_version = "@POET_VERSION@"; -static const char *CHEMISTRY_MODULE_NAME = "state_C"; +// using the Raw string literal to avoid escaping the quotes +static inline std::string kin_r_library = R"(@R_KIN_LIB@)"; #endif // POET_H