Skip to content

Commit a4645ba

Browse files
authored
Add verbosity for openfast library version at build and runtime (#1691)
1 parent 7346fd2 commit a4645ba

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,17 @@ if(AMR_WIND_ENABLE_OPENFAST)
188188
if(AMR_WIND_OPENFAST_VERSION VERSION_GREATER_EQUAL "4" AND AMR_WIND_OPENFAST_VERSION VERSION_LESS "4.1")
189189
message(FATAL_ERROR "AMR-Wind does not support OpenFAST version 4.0. Either update to 4.1 or revert to 3.")
190190
endif()
191+
message(STATUS "AMR_WIND_OPENFAST_VERSION = ${AMR_WIND_OPENFAST_VERSION}")
191192
string(REPLACE "." ";" OPENFAST_VERSION_LIST ${AMR_WIND_OPENFAST_VERSION})
192193
list(LENGTH OPENFAST_VERSION_LIST OPENFAST_VERSION_LIST_LENGTH)
193194
if(OPENFAST_VERSION_LIST_LENGTH GREATER_EQUAL 1)
194195
list(GET OPENFAST_VERSION_LIST 0 OPENFAST_VERSION_MAJOR)
195196
endif()
197+
if(OPENFAST_VERSION_LIST_LENGTH GREATER_EQUAL 2)
198+
list(GET OPENFAST_VERSION_LIST 1 OPENFAST_VERSION_MINOR)
199+
endif()
196200
target_compile_definitions(${amr_wind_lib_name} PUBLIC OPENFAST_VERSION_MAJOR=${OPENFAST_VERSION_MAJOR})
201+
target_compile_definitions(${amr_wind_lib_name} PUBLIC OPENFAST_VERSION_MINOR=${OPENFAST_VERSION_MINOR})
197202
endif()
198203

199204
if(AMR_WIND_ENABLE_ASCENT)

amr-wind/utilities/console_io.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#ifdef AMR_WIND_USE_ASCENT
2222
#include "ascent_config.h"
2323
#endif
24+
#define STRINGIFY(x) #x
25+
#define TOSTRING(x) STRINGIFY(x)
2426

2527
namespace amrex {
2628
const char* buildInfoGetBuildDate();
@@ -194,7 +196,9 @@ void print_tpls(std::ostream& out)
194196
tpls.push_back(std::string("HYPRE ") + HYPRE_RELEASE_VERSION);
195197
#endif
196198
#ifdef AMR_WIND_USE_OPENFAST
197-
tpls.push_back(std::string("OpenFAST "));
199+
std::string of_version =
200+
TOSTRING(OPENFAST_VERSION_MAJOR) "." TOSTRING(OPENFAST_VERSION_MINOR);
201+
tpls.push_back(std::string("OpenFAST ") + of_version);
198202
#endif
199203
#ifdef AMR_WIND_USE_MASA
200204
tpls.push_back(std::string("MASA ") + MASA_LIB_VERSION);

0 commit comments

Comments
 (0)