diff --git a/CMakeLists.txt b/CMakeLists.txt index 516ffcd551..1f54d653cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -721,11 +721,29 @@ list(APPEND COMPLEX_GENERATED_HEADERS ${COMPLEX_GENERATED_PYTHON_HEADER} ) -set(COMPLEX_GENERATED_VERSION_HEADER ${COMPLEX_GENERATED_HEADER_DIR}/ComplexVersion.h) -configure_file(${complex_SOURCE_DIR}/cmake/ComplexVersion.h.in ${COMPLEX_GENERATED_VERSION_HEADER}) +# set(COMPLEX_GENERATED_VERSION_HEADER ${COMPLEX_GENERATED_HEADER_DIR}/ComplexVersion.h) +# configure_file(${complex_SOURCE_DIR}/cmake/ComplexVersion.h.in ${COMPLEX_GENERATED_VERSION_HEADER}) + + +set(CMP_VERSION_HDR_TEMPLATE_FILE ${complex_SOURCE_DIR}/cmake/ComplexVersion.hpp) +set(CMP_VERSION_SRC_TEMPLATE_FILE ${complex_SOURCE_DIR}/cmake/ComplexVersion.cpp.in) +set(VERSION_GEN_HEADER_FILE_NAME "ComplexVersion.hpp") + +cmpBuildDateRevisionString(GENERATED_HEADER_FILE_PATH "generated/complex/ComplexVersion.hpp" + GENERATED_SOURCE_FILE_PATH "generated/complex/ComplexVersion.cpp" + NAMESPACE complex + PROJECT_NAME complex + EXPORT_MACRO "" + VERSION_MACRO_PATH "" + STRING_CLASS std::string + STRING_INCLUDE "#include " +) + + list(APPEND COMPLEX_GENERATED_HEADERS - ${COMPLEX_GENERATED_VERSION_HEADER} + ${COMPLEX_GENERATED_HEADER_DIR}/ComplexVersion.hpp + ${COMPLEX_GENERATED_HEADER_DIR}/ComplexVersion.cpp ) set(COMPLEX_ALL_HDRS diff --git a/cmake/ComplexVersion.cpp.in b/cmake/ComplexVersion.cpp.in new file mode 100644 index 0000000000..868f394172 --- /dev/null +++ b/cmake/ComplexVersion.cpp.in @@ -0,0 +1,189 @@ +/*-------------------------------------------------------------------------- + * This file is autogenerated from: + * @CMAKE_CURRENT_LIST_DIR@/ComplexVersion.cpp.in + * during the cmake configuration of your project. If you need to make changes, + * edit the original file NOT THIS FILE. + * --------------------------------------------------------------------------*/ + +#include "ComplexVersion.hpp" + +// ----------------------------------------------------------------------------- +@GVS_STRING_CLASS@ @VERSION_GEN_NAMESPACE@::Version::ApplicationName() +{ + return {"@PROJECT_PREFIX@"}; +} + +// ----------------------------------------------------------------------------- +@GVS_STRING_CLASS@ @VERSION_GEN_NAMESPACE@::Version::Complete() +{ + return {"@VERSION_GEN_VER_MAJOR@.@VERSION_GEN_VER_MINOR@.@VERSION_GEN_VER_PATCH@@VERSION_GEN_VER_SUFFIX@"}; +} + +// ----------------------------------------------------------------------------- +@GVS_STRING_CLASS@ @VERSION_GEN_NAMESPACE@::Version::Major() +{ + return {"@VERSION_GEN_VER_MAJOR@"}; +} + +// ----------------------------------------------------------------------------- +@GVS_STRING_CLASS@ @VERSION_GEN_NAMESPACE@::Version::Minor() +{ + return {"@VERSION_GEN_VER_MINOR@"}; +} + +// ----------------------------------------------------------------------------- +@GVS_STRING_CLASS@ @VERSION_GEN_NAMESPACE@::Version::Patch() +{ + return {"@VERSION_GEN_VER_PATCH@"}; +} + +// ----------------------------------------------------------------------------- +@GVS_STRING_CLASS@ @VERSION_GEN_NAMESPACE@::Version::Suffix() +{ + return {"@VERSION_GEN_VER_SUFFIX@"}; +} + +// ----------------------------------------------------------------------------- +@GVS_STRING_CLASS@ @VERSION_GEN_NAMESPACE@::Version::Package() +{ + return {"@VERSION_GEN_VER_MAJOR@.@VERSION_GEN_VER_MINOR@.@VERSION_GEN_VER_PATCH@@VERSION_GEN_VER_SUFFIX@"}; +} + +// ----------------------------------------------------------------------------- +@GVS_STRING_CLASS@ @VERSION_GEN_NAMESPACE@::Version::PackageComplete() +{ + return {"@PROJECT_PREFIX@ Version @VERSION_GEN_VER_MAJOR@.@VERSION_GEN_VER_MINOR@.@VERSION_GEN_VER_PATCH@@VERSION_GEN_VER_SUFFIX@"}; +} + +// ----------------------------------------------------------------------------- +@GVS_STRING_CLASS@ @VERSION_GEN_NAMESPACE@::Version::BuildDate() +{ + return {"@VERSION_BUILD_DATE@"}; +} + +// ----------------------------------------------------------------------------- +@GVS_STRING_CLASS@ @VERSION_GEN_NAMESPACE@::Version::GitHashShort() +{ + return {"@VERSION_GEN_GIT_HASH_SHORT@"}; +} + +// ----------------------------------------------------------------------------- +@GVS_STRING_CLASS@ @VERSION_GEN_NAMESPACE@::Version::GitHash() +{ + return {"@GVS_GIT_HASH@"}; +} + +// ----------------------------------------------------------------------------- +@VERSION_GEN_NAMESPACE@::Version::AppVersion::AppVersion() = default; + +// ----------------------------------------------------------------------------- +@VERSION_GEN_NAMESPACE@::Version::AppVersion::AppVersion(int majorNum, int minorNum, int patchNum) +{ + m_MajorNum = majorNum; + m_MinorNum = minorNum; + m_PatchNum = patchNum; +} + +// ----------------------------------------------------------------------------- +@VERSION_GEN_NAMESPACE@::Version::AppVersion::~AppVersion() = default; + +// ----------------------------------------------------------------------------- +@VERSION_GEN_NAMESPACE@::Version::AppVersion::AppVersion(const @VERSION_GEN_NAMESPACE@::Version::AppVersion& rhs) +{ + m_MajorNum = rhs.m_MajorNum; + m_MinorNum = rhs.m_MinorNum; + m_PatchNum = rhs.m_PatchNum; +} + +// ----------------------------------------------------------------------------- +@VERSION_GEN_NAMESPACE@::Version::AppVersion& @VERSION_GEN_NAMESPACE@::Version::AppVersion::operator=(const AppVersion& rhs) = default; + +// ----------------------------------------------------------------------------- +bool @VERSION_GEN_NAMESPACE@::Version::AppVersion::operator==(const @VERSION_GEN_NAMESPACE@::Version::AppVersion& rhs) +{ + return (m_MajorNum == rhs.m_MajorNum && m_MinorNum == rhs.m_MinorNum && m_PatchNum == rhs.m_PatchNum); +} + +// ----------------------------------------------------------------------------- +bool @VERSION_GEN_NAMESPACE@::Version::AppVersion::operator>(const @VERSION_GEN_NAMESPACE@::Version::AppVersion& rhs) +{ + if(m_MajorNum > rhs.m_MajorNum) + { + return true; + } + + if(m_MajorNum == rhs.m_MajorNum) + { + if(m_MinorNum > rhs.m_MinorNum) + { + return true; + } + + if(m_MinorNum == rhs.m_MinorNum) + { + return m_PatchNum > rhs.m_PatchNum; + } + return false; + } + return false; +} + +// ----------------------------------------------------------------------------- +bool @VERSION_GEN_NAMESPACE@::Version::AppVersion::operator<(const @VERSION_GEN_NAMESPACE@::Version::AppVersion& rhs) +{ + if(m_MajorNum < rhs.m_MajorNum) + { + return true; + } + + if(m_MajorNum == rhs.m_MajorNum) + { + if(m_MinorNum < rhs.m_MinorNum) + { + return true; + } + + if(m_MinorNum == rhs.m_MinorNum) + { + return m_PatchNum < rhs.m_PatchNum; + } + return false; + } + return false; +} + +// ----------------------------------------------------------------------------- +int @VERSION_GEN_NAMESPACE@::Version::AppVersion::getMajorNum() +{ + return m_MajorNum; +} + +// ----------------------------------------------------------------------------- +int @VERSION_GEN_NAMESPACE@::Version::AppVersion::getMinorNum() +{ + return m_MinorNum; +} + +// ----------------------------------------------------------------------------- +int @VERSION_GEN_NAMESPACE@::Version::AppVersion::getPatchNum() +{ + return m_PatchNum; +} + +// ----------------------------------------------------------------------------- +void @VERSION_GEN_NAMESPACE@::Version::AppVersion::setMajorNum(int major) +{ + m_MajorNum = major; +} + +// ----------------------------------------------------------------------------- +void @VERSION_GEN_NAMESPACE@::Version::AppVersion::setMinorNum(int minor) +{ + m_MinorNum = minor; +} + +// ----------------------------------------------------------------------------- +void @VERSION_GEN_NAMESPACE@::Version::AppVersion::setPatchNum(int patch) +{ + m_PatchNum = patch; +} diff --git a/cmake/ComplexVersion.h.in b/cmake/ComplexVersion.h.in deleted file mode 100644 index 31ad1f83b6..0000000000 --- a/cmake/ComplexVersion.h.in +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Since we are only using this to print versions in the files a lot of functionality from the main applications version is not necessary -#define COMPLEX_PACKAGE_COMPLETE "Complex Version @complex_VERSION_MAJOR@.@complex_VERSION_MINOR@.@complex_VERSION_PATCH@" -#define COMPLEX_VERSION_COMPLETE "@complex_VERSION_MAJOR@.@complex_VERSION_MINOR@.@complex_VERSION_PATCH@" -#define COMPLEX_VERSION_MAJOR "@complex_VERSION_MAJOR@" -#define COMPLEX_VERSION_MINOR "@complex_VERSION_MINOR@" -#define COMPLEX_VERSION_PATCH "@complex_VERSION_PATCH@" diff --git a/cmake/ComplexVersion.hpp b/cmake/ComplexVersion.hpp new file mode 100644 index 0000000000..4ec8d54e7f --- /dev/null +++ b/cmake/ComplexVersion.hpp @@ -0,0 +1,52 @@ +#pragma once + +#include "complex/complex_export.hpp" + +#include + +namespace complex::Version +{ + +COMPLEX_EXPORT std::string ApplicationName(); +COMPLEX_EXPORT std::string Complete(); +COMPLEX_EXPORT std::string Major(); +COMPLEX_EXPORT std::string Minor(); +COMPLEX_EXPORT std::string Patch(); +COMPLEX_EXPORT std::string Suffix(); +COMPLEX_EXPORT std::string Package(); +COMPLEX_EXPORT std::string PackageComplete(); +COMPLEX_EXPORT std::string BuildDate(); +COMPLEX_EXPORT std::string GitHashShort(); +COMPLEX_EXPORT std::string GitHash(); + +class COMPLEX_EXPORT AppVersion +{ +public: + AppVersion(); + AppVersion(int majorNum, int minorNum, int patchNum); + + AppVersion(const AppVersion&); + AppVersion(const AppVersion&&) = delete; + AppVersion& operator=(const AppVersion&); + AppVersion& operator=(AppVersion&&) = delete; + + bool operator==(const AppVersion&); + bool operator>(const AppVersion&); + bool operator<(const AppVersion&); + + virtual ~AppVersion(); + + int getMajorNum(); + int getMinorNum(); + int getPatchNum(); + + void setMajorNum(int major); + void setMinorNum(int minor); + void setPatchNum(int patch); + +private: + int m_MajorNum = -1; + int m_MinorNum = -1; + int m_PatchNum = -1; +}; +} // namespace complex::Version diff --git a/cmake/Utility.cmake b/cmake/Utility.cmake index ee070a91c0..e3eeb42f2c 100644 --- a/cmake/Utility.cmake +++ b/cmake/Utility.cmake @@ -283,4 +283,180 @@ function(create_pipeline_tests) endfunction() -#set_tests_properties(dependsTest12 PROPERTIES DEPENDS "baseTest1;baseTest2") +#------------------------------------------------------------------------------- +# This function generates a file ONLY if the MD5 between the "to be" generated file +# and the current file are different. This will help reduce recompiles based on +# the generation of files that are really the same. +#------------------------------------------------------------------------------- +function(cmpConfigureFileWithMD5Check) + set(options) + set(oneValueArgs CONFIGURED_TEMPLATE_PATH GENERATED_FILE_PATH ) + cmake_parse_arguments(GVS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + + # message(STATUS " GVS_CONFIGURED_TEMPLATE_PATH: ${GVS_CONFIGURED_TEMPLATE_PATH}") + # message(STATUS " GVS_GENERATED_FILE_PATH: ${GVS_GENERATED_FILE_PATH}") + + # Only Generate a file if it is different than what is already there. + if(EXISTS ${GVS_GENERATED_FILE_PATH} ) + file(MD5 ${GVS_GENERATED_FILE_PATH} VERSION_HDR_MD5) + configure_file(${GVS_CONFIGURED_TEMPLATE_PATH} ${GVS_GENERATED_FILE_PATH}_tmp ) + + file(MD5 ${GVS_GENERATED_FILE_PATH}_tmp VERSION_GEN_HDR_MD5) + #message(STATUS " File Exists, doing MD5 Comparison") + + # Compare the MD5 checksums. If they are different then configure the file into the proper location + if(NOT "${VERSION_HDR_MD5}" STREQUAL "${VERSION_GEN_HDR_MD5}") + #message(STATUS " ${VERSION_GEN_HDR_MD5}") + #message(STATUS " ${VERSION_HDR_MD5}") + #message(STATUS " Files differ: Replacing with newly generated file") + configure_file(${GVS_CONFIGURED_TEMPLATE_PATH} ${GVS_GENERATED_FILE_PATH} ) + else() + #message(STATUS " NO Difference in Files") + endif() + file(REMOVE ${GVS_GENERATED_FILE_PATH}_tmp) + else() + # message(STATUS " File does NOT Exist, Generating one...") + configure_file(${GVS_CONFIGURED_TEMPLATE_PATH} ${GVS_GENERATED_FILE_PATH} ) + endif() + +endfunction() + + + +#------------------------------------------------------------------------------- +# We are going to use Git functionality to create a version number for our package +# The MAJOR.MINOR.PATCH is based off of YYYY.MM.DD +# The TWEAK is the git hash of project. +#------------------------------------------------------------------------------- +function(cmpBuildDateRevisionString) + set(options) + set(oneValueArgs GENERATED_HEADER_FILE_PATH GENERATED_SOURCE_FILE_PATH + NAMESPACE PROJECT_NAME EXPORT_MACRO VERSION_MACRO_PATH STRING_CLASS STRING_INCLUDE) + cmake_parse_arguments(GVS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + + if(NOT DEFINED GVS_STRING_CLASS) + set(GVS_STRING_CLASS "std::string") + endif() + + if(NOT DEFINED GVS_STRING_INCLUDE) + set(GVS_STRING_INCLUDE "") + endif() + + if(0) + message(STATUS "--------------------------------------------") + message(STATUS "GVS_NAMESPACE: ${GVS_NAMESPACE}") + message(STATUS "GVS_PROJECT_NAME: ${GVS_PROJECT_NAME}") + message(STATUS "GVS_GENERATED_HEADER_FILE_PATH: ${GVS_GENERATED_HEADER_FILE_PATH}") + message(STATUS "GVS_GENERATED_SOURCE_FILE_PATH: ${GVS_GENERATED_SOURCE_FILE_PATH}") + message(STATUS "GVS_PROJECT_VERSION_MAJOR: ${GVS_PROJECT_VERSION_MAJOR}") + message(STATUS "GVS_EXPORT_MACRO: ${GVS_EXPORT_MACRO}") + message(STATUS "${GVS_PROJECT_NAME}_BUILD_DATE: ${${GVS_PROJECT_NAME}_BUILD_DATE}") + message(STATUS "${GVS_PROJECT_NAME}_SOURCE_DIR: ${${GVS_PROJECT_NAME}_SOURCE_DIR}") + message(STATUS "--------------------------------------------") + endif() + + string(STRIP "${${GVS_PROJECT_NAME}_BUILD_DATE}" DVERS) + string(REPLACE "/" "-" DVERS "${DVERS}") + # Run 'git describe' to get our tag offset + # execute_process(COMMAND ${GIT_EXECUTABLE} describe --long + # OUTPUT_VARIABLE DVERS + # RESULT_VARIABLE did_run + # ERROR_VARIABLE git_error + # WORKING_DIRECTORY ${${GVS_PROJECT_NAME}_SOURCE_DIR} ) + + #message(STATUS "DVERS: ${DVERS}") + set(PROJECT_PREFIX "${GVS_PROJECT_NAME}") + set(VERSION_GEN_NAME "${GVS_PROJECT_NAME}") + set(VERSION_GEN_NAMESPACE "${GVS_NAMESPACE}") + string(TOLOWER "${VERSION_GEN_NAMESPACE}" VERSION_INCLUDE_GUARD) + set(VERSION_GEN_NAMESPACE_EXPORT "${GVS_EXPORT_MACRO}") + set(VERSION_GEN_VER_MAJOR ${${GVS_PROJECT_NAME}_VERSION_MAJOR}) + set(VERSION_GEN_VER_MINOR ${${GVS_PROJECT_NAME}_VERSION_MINOR}) + set(VERSION_GEN_VER_PATCH ${${GVS_PROJECT_NAME}_VERSION_PATCH}) + set(VERSION_GEN_VER_SUFFIX ${${GVS_PROJECT_NAME}_VERSION_SUFFIX}) + set(VERSION_GEN_GIT_HASH_SHORT "0") + + string(TIMESTAMP VERSION_BUILD_DATE "%Y/%m/%d") + + set(VERSION_GEN_HEADER_FILE_NAME ${GVS_GENERATED_HEADER_FILE_PATH}) + + #-- Make sure that actually worked and if not just generate some dummy values + if(NOT "${DVERS}" STREQUAL "") + string(STRIP ${DVERS} DVERS) + string(REPLACE "-" ";" VERSION_LIST ${DVERS}) + list(LENGTH VERSION_LIST VERSION_LIST_LENGTH) + + set(VERSION_GEN_VER_PATCH "0") + set(VERSION_GEN_GIT_HASH_SHORT "0") + + list(LENGTH VERSION_LIST LIST_LENGTH) + if(LIST_LENGTH GREATER 1) + list(GET VERSION_LIST 0 VERSION_GEN_VER_MAJOR) + list(GET VERSION_LIST 1 VERSION_GEN_VER_MINOR) + list(GET VERSION_LIST 2 VERSION_GEN_VER_PATCH) + endif() + + endif() + + find_package(Git) + # Run 'git rev-parse --short HEAD' to get our revision + execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD + OUTPUT_VARIABLE DVERS + RESULT_VARIABLE did_run + ERROR_VARIABLE git_error + WORKING_DIRECTORY ${${GVS_PROJECT_NAME}_SOURCE_DIR} ) + string(STRIP "${DVERS}" DVERS) + if(DVERS STREQUAL "") + message(STATUS "[${GVS_PROJECT_NAME}] 'git rev-parse --short HEAD' did not return anything valid") + set(VERSION_GEN_GIT_HASH_SHORT "000000000000") + else() + set(VERSION_GEN_GIT_HASH_SHORT "${DVERS}") + endif() + + set(${GVS_PROJECT_NAME}_VERSION_MAJOR "${VERSION_GEN_VER_MAJOR}" PARENT_SCOPE) + set(${GVS_PROJECT_NAME}_VERSION_MINOR "${VERSION_GEN_VER_MINOR}" PARENT_SCOPE) + set(${GVS_PROJECT_NAME}_VERSION_PATCH "${VERSION_GEN_VER_PATCH}" PARENT_SCOPE) + set(${GVS_PROJECT_NAME}_VERSION_TWEAK "${VERSION_GEN_GIT_HASH_SHORT}" PARENT_SCOPE) + + set(CMP_TOP_HEADER_INCLUDE_STATMENT "") + if(NOT "${CMP_TOP_HEADER_FILE}" STREQUAL "") + set(CMP_TOP_HEADER_INCLUDE_STATMENT "#include \"${CMP_TOP_HEADER_FILE}\"") + endif() + + execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --verify HEAD + OUTPUT_VARIABLE GVS_GIT_HASH + RESULT_VARIABLE did_run + ERROR_VARIABLE git_error + WORKING_DIRECTORY ${${GVS_PROJECT_NAME}_SOURCE_DIR} + ) + string(REPLACE "\n" "" GVS_GIT_HASH "${GVS_GIT_HASH}") + set_property(GLOBAL PROPERTY ${GVS_PROJECT_NAME}_GIT_HASH ${GVS_GIT_HASH}) + + execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty='%cd' --date=format:%Y-%m-%d-%H:%M:%S + OUTPUT_VARIABLE GVS_GIT_COMMIT_DATE + RESULT_VARIABLE did_run + ERROR_VARIABLE git_error + WORKING_DIRECTORY ${${GVS_PROJECT_NAME}_SOURCE_DIR} + ) + string(REPLACE "\n" "" GVS_GIT_COMMIT_DATE "${GVS_GIT_COMMIT_DATE}") + set_property(GLOBAL PROPERTY ${GVS_PROJECT_NAME}_GIT_COMMIT_DATE ${GVS_GIT_COMMIT_DATE}) + + if(NOT "${GVS_GENERATED_HEADER_FILE_PATH}" STREQUAL "") + # message(STATUS "Generating: ${${GVS_PROJECT_NAME}_BINARY_DIR}/${GVS_GENERATED_HEADER_FILE_PATH}") + cmpConfigureFileWithMD5Check( GENERATED_FILE_PATH ${${GVS_PROJECT_NAME}_BINARY_DIR}/${GVS_GENERATED_HEADER_FILE_PATH} + CONFIGURED_TEMPLATE_PATH ${CMP_VERSION_HDR_TEMPLATE_FILE} ) + endif() + + if(NOT "${GVS_GENERATED_SOURCE_FILE_PATH}" STREQUAL "") + # message(STATUS "Generating: ${${GVS_PROJECT_NAME}_BINARY_DIR}/${GVS_GENERATED_SOURCE_FILE_PATH}") + cmpConfigureFileWithMD5Check( GENERATED_FILE_PATH ${${GVS_PROJECT_NAME}_BINARY_DIR}/${GVS_GENERATED_SOURCE_FILE_PATH} + CONFIGURED_TEMPLATE_PATH ${CMP_VERSION_SRC_TEMPLATE_FILE} ) + endif() + + if(NOT "${GVS_VERSION_MACRO_PATH}" STREQUAL "") + # message(STATUS "Generating: ${${GVS_PROJECT_NAME}_BINARY_DIR}/${GVS_VERSION_MACRO_PATH}") + cmpConfigureFileWithMD5Check( GENERATED_FILE_PATH ${${GVS_PROJECT_NAME}_BINARY_DIR}/${GVS_VERSION_MACRO_PATH} + CONFIGURED_TEMPLATE_PATH ${CMP_CONFIGURED_FILES_SOURCE_DIR}/cmpVersionMacro.h.in ) + endif() + +endfunction() diff --git a/src/Plugins/ComplexCore/test/ExecuteProcessTest.cpp b/src/Plugins/ComplexCore/test/ExecuteProcessTest.cpp index d42014568e..7802b8f885 100644 --- a/src/Plugins/ComplexCore/test/ExecuteProcessTest.cpp +++ b/src/Plugins/ComplexCore/test/ExecuteProcessTest.cpp @@ -1,5 +1,6 @@ #include +#include "complex/ComplexVersion.hpp" #include "complex/Parameters/BoolParameter.hpp" #include "complex/Parameters/FileSystemPathParameter.hpp" #include "complex/Parameters/NumberParameter.hpp" @@ -45,10 +46,14 @@ TEST_CASE("ComplexCore::ExecuteProcessFilter: Valid filter execution") std::ifstream processOutputFile(processOutput); REQUIRE(processOutputFile.is_open()); + std::stringstream buffer; + buffer << processOutputFile.rdbuf(); + std::string firstLine; - std::getline(processOutputFile, firstLine); - firstLine = StringUtilities::rtrim(firstLine); - REQUIRE(firstLine == "nxrunner version 1.0.0"); + std::vector outputLines = complex::StringUtilities::split(buffer.str(), '\n'); + firstLine = StringUtilities::trimmed(outputLines[0]); + const std::string correctOutput = fmt::format("nxrunner: Version {} Build Date:{}", complex::Version::Package(), complex::Version::BuildDate()); + REQUIRE(firstLine == correctOutput); } TEST_CASE("ComplexCore::ExecuteProcessFilter: InValid filter execution") diff --git a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/INLWriter.cpp b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/INLWriter.cpp index 74de2932e7..28e754240b 100644 --- a/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/INLWriter.cpp +++ b/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/INLWriter.cpp @@ -1,6 +1,6 @@ #include "INLWriter.hpp" -#include "complex/ComplexVersion.h" +#include "complex/ComplexVersion.hpp" #include "complex/DataStructure/DataArray.hpp" #include "complex/DataStructure/DataPath.hpp" #include "complex/DataStructure/Geometry/ImageGeom.hpp" @@ -105,7 +105,7 @@ Result<> INLWriter::operator()() FloatVec3 origin = imageGeom.getOrigin(); // Write the header, Each line starts with a "#" symbol - fout << "# File written from " << COMPLEX_PACKAGE_COMPLETE << "\n"; + fout << "# File written from " << complex::Version::PackageComplete() << "\n"; fout << "# X_STEP: " << std::fixed << res[0] << "\n"; fout << "# Y_STEP: " << std::fixed << res[1] << "\n"; fout << "# Z_STEP: " << std::fixed << res[2] << "\n"; diff --git a/src/nxrunner/src/nxrunner.cpp b/src/nxrunner/src/nxrunner.cpp index 712858f523..eee59821ca 100644 --- a/src/nxrunner/src/nxrunner.cpp +++ b/src/nxrunner/src/nxrunner.cpp @@ -1,12 +1,12 @@ #include "CliObserver.hpp" #include "complex/Common/Result.hpp" +#include "complex/ComplexPython.hpp" +#include "complex/ComplexVersion.hpp" #include "complex/Core/Application.hpp" #include "complex/Pipeline/Pipeline.hpp" #include "complex/Utilities/StringUtilities.hpp" -#include "complex/ComplexPython.hpp" - #include #include @@ -402,8 +402,7 @@ std::vector GetPythonPluginList() int main(int argc, char* argv[]) { - - cliOut << "nxrunner version 1.0.0\n"; + cliOut << fmt::format("nxrunner: Version {} Build Date:{}\n\n", complex::Version::Package(), complex::Version::BuildDate()); // cliOut.endline(); // cliOut << "ARGUMENT LISTING START\n"; // for(int argIndex = 0; argIndex < argc; argIndex++)