install netgen_version.hpp, set version in Archive

This commit is contained in:
Matthias Hochsteger 2020-07-23 16:24:22 +02:00
parent 2f88502729
commit dcc0484be0
3 changed files with 19 additions and 1 deletions

View File

@ -79,6 +79,7 @@ endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include (${CMAKE_CURRENT_LIST_DIR}/cmake/generate_version_file.cmake)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/netgen_version.hpp DESTINATION ${NG_INSTALL_DIR_INCLUDE}/include COMPONENT netgen_devel)
set(CPACK_PACKAGE_VERSION "${NETGEN_VERSION}")

View File

@ -36,7 +36,17 @@ endif()
set(NETGEN_VERSION_LONG ${NETGEN_VERSION_SHORT}-${NETGEN_VERSION_TWEAK}-${NETGEN_VERSION_HASH})
set(version_file ${BDIR}/netgen_version.hpp)
set(new_version_file_string "#define NETGEN_VERSION \"${NETGEN_VERSION}\"\n")
set(new_version_file_string "\
#ifndef NETGEN_VERSION_HPP_INCLUDED
#define NETGEN_VERSION_HPP_INCLUDED
#define NETGEN_VERSION \"${NETGEN_VERSION}\"
#define NETGEN_VERSION_MAJOR ${NETGEN_VERSION_MAJOR}
#define NETGEN_VERSION_MINOR ${NETGEN_VERSION_MINOR}
#define NETGEN_VERSION_PATCH ${NETGEN_VERSION_PATCH}
#define NETGEN_VERSION_TWEAK ${NETGEN_VERSION_TWEAK}
#define NETGEN_VERSION_HASH \"${NETGEN_VERSION_HASH}\"
#endif // NETGEN_VERSION_HPP_INCLUDED
")
if(EXISTS ${version_file})
file(READ ${version_file} old_version_file_string )
if(${old_version_file_string} STREQUAL ${new_version_file_string})

View File

@ -1,5 +1,6 @@
#include "archive.hpp"
#include <netgen_version.hpp>
#ifndef WIN32
#include <cxxabi.h>
@ -44,4 +45,10 @@ namespace ngcore
std::make_unique<std::map<std::string, detail::ClassArchiveInfo>>();
return type_register->count(classname) != 0;
}
static bool dummy = [](){
SetLibraryVersion("netgen", NETGEN_VERSION);
return true;
}();
} // namespace ngcore