File tree Expand file tree Collapse file tree 5 files changed +50
-10
lines changed Expand file tree Collapse file tree 5 files changed +50
-10
lines changed Original file line number Diff line number Diff line change @@ -151,20 +151,22 @@ message(STATUS "Configuring 3rd party libraries")
151151# - FFTW_LIBRARIES (if pfasst_BUILD_EXAMPLES)
152152add_subdirectory (3rdparty)
153153
154+ message (STATUS "********************************************************************************" )
155+ message (STATUS "Configuring sources" )
156+ update_site_config()
157+
158+ add_custom_target (set_version ALL
159+ COMMAND ${pfasst_SOURCE_DIR} /tools/get_pfasst_version.sh
160+ WORKING_DIRECTORY ${pfasst_SOURCE_DIR}
161+ COMMENT "Updating PFASST++ version number"
162+ USES_TERMINAL
163+ )
164+ set (pfasst_DEPENDEND_TARGETS set_version ${pfasst_DEPENDEND_TARGETS} )
165+
154166list (LENGTH pfasst_DEPENDEND_LIBS pfasst_NUM_DEPENDEND_LIBS)
155167list (LENGTH pfasst_DEPENDEND_TARGETS pfasst_NUM_DEPENDEND_TARGETS)
156168list (LENGTH pfasst_TESTS_DEPENDEND_TARGETS pfasst_TESTS_NUM_DEPENDEND_TARGETS)
157169
158- message (STATUS "********************************************************************************" )
159- message (STATUS "Configuring sources" )
160- set (WARNING_COMMENT "/*\n * DO NOT ALTER THIS FILE\n *\n * It will get rewritten on CMake's next run\n *\n */" )
161- if (pfasst_RANDOM_SEED)
162- add_definitions (-DPFASST_DEFAULT_RANDOM_SEED)
163- endif ()
164- configure_file (
165- "${pfasst_SOURCE_DIR} /cmake/site_config.hpp.in"
166- "${CMAKE_CURRENT_SOURCE_DIR} /include/pfasst/site_config.hpp"
167- )
168170add_subdirectory (include )
169171add_subdirectory (src)
170172
Original file line number Diff line number Diff line change 77 #define PFASST_RANDOM_SEED @pfasst_RANDOM_SEED@
88#endif
99
10+ #include <string>
11+ using namespace std;
12+
13+ namespace pfasst
14+ {
15+ static constexpr const char* VERSION = "pfasst_VERSION";
16+ } // ::pfasst
17+
1018#endif // _PFASST__SITE_CONFIG_HPP
Original file line number Diff line number Diff line change @@ -27,3 +27,14 @@ macro(msg_not_installed dependency_name)
2727 message ("! ${dependency_name} manually to your project." )
2828 message ("!!!!" )
2929endmacro (msg_not_installed)
30+
31+ macro (update_site_config)
32+ set (WARNING_COMMENT "/*\n * DO NOT ALTER THIS FILE\n *\n * It will get rewritten on CMake's next run\n */" )
33+ if (pfasst_RANDOM_SEED)
34+ add_definitions (-DPFASST_DEFAULT_RANDOM_SEED)
35+ endif ()
36+ configure_file (
37+ "${pfasst_SOURCE_DIR} /cmake/site_config.hpp.in"
38+ "${CMAKE_CURRENT_SOURCE_DIR} /include/pfasst/site_config.hpp"
39+ )
40+ endmacro (update_site_config)
Original file line number Diff line number Diff line change @@ -390,6 +390,7 @@ namespace pfasst
390390 set_logging_flags ();
391391 load_default_config ();
392392 pfasst::log::stack_position = 0 ;
393+ CLOG (INFO, " default" ) << " PFASST++ version " << pfasst::VERSION;
393394 }
394395 } // ::pfasst::log
395396} // ::pfasst
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ SCRIPTPATH=" $( cd " $( dirname " $0 " ) " ; pwd -P ) "
4+ PFASST_DIR=" ${SCRIPTPATH} /.."
5+ GIT=" ` which git` "
6+
7+ cd " ${PFASST_DIR} "
8+ CONFIG_HPP=" include/pfasst/site_config.hpp"
9+
10+ if [[ -s " ${CONFIG_HPP} " ]]; then
11+ VERSION=` " ${GIT} " describe` || " unknown"
12+ sed -i " s/pfasst_VERSION/${VERSION} /g" " ${CONFIG_HPP} "
13+ echo " PFASST++ version set to ${VERSION} "
14+ exit 0;
15+ else
16+ echo " include/pfasst/site_config.hpp not found"
17+ exit 1;
18+ fi
You can’t perform that action at this time.
0 commit comments