Browse Source
Moved generated file `storm-version.cpp` to build folder. Moved version information to new library `storm-version-info` (addressing Github issue #78)
main
Moved generated file `storm-version.cpp` to build folder. Moved version information to new library `storm-version-info` (addressing Github issue #78)
main
10 changed files with 177 additions and 142 deletions
-
8CMakeLists.txt
-
1src/CMakeLists.txt
-
6src/storm-cli-utilities/CMakeLists.txt
-
8src/storm-cli-utilities/cli.cpp
-
1src/storm-cli-utilities/model-handling.h
-
47src/storm-version-info/CMakeLists.txt
-
24src/storm-version-info/storm-version.cpp.in
-
98src/storm-version-info/storm-version.h
-
100src/storm/utility/storm-version.h
-
26storm-version.cpp.in
@ -0,0 +1,47 @@ |
|||||
|
|
||||
|
file(GLOB_RECURSE ALL_FILES ${PROJECT_SOURCE_DIR}/src/storm-version-info/*.h ${PROJECT_SOURCE_DIR}/src/storm-version-info/*.cpp) |
||||
|
register_source_groups_from_filestructure("${ALL_FILES}" storm-version-info) |
||||
|
|
||||
|
file(GLOB_RECURSE STORM_VERSION_INFO_SOURCES ${PROJECT_SOURCE_DIR}/src/storm-version-info/*.cpp) |
||||
|
file(GLOB_RECURSE STORM_VERSION_INFO_HEADERS ${PROJECT_SOURCE_DIR}/src/storm-version-info/*.h) |
||||
|
|
||||
|
# Configure a source file to pass the Storm version to the source code |
||||
|
configure_file ( |
||||
|
"${PROJECT_SOURCE_DIR}/src/storm-version-info/storm-version.cpp.in" |
||||
|
"${PROJECT_BINARY_DIR}/storm-version.cpp" |
||||
|
) |
||||
|
|
||||
|
# Add the generated source file |
||||
|
list(APPEND STORM_VERSION_INFO_SOURCES "${PROJECT_BINARY_DIR}/storm-version.cpp") |
||||
|
|
||||
|
|
||||
|
# Create storm-version-info lib |
||||
|
add_library(storm-version-info SHARED ${STORM_VERSION_INFO_SOURCES} ${STORM_VERSION_INFO_HEADERS}) |
||||
|
|
||||
|
# Remove define symbol for shared libstorm. |
||||
|
set_target_properties(storm-version-info PROPERTIES DEFINE_SYMBOL "") |
||||
|
|
||||
|
# Add dependency to core storm libary. We are not going to link against it to avoid unnecessary linking steps, but we still want to build storm-version-info as often as possible. |
||||
|
add_dependencies(storm storm-version-info) |
||||
|
list(APPEND STORM_TARGETS storm-version-info) |
||||
|
set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE) |
||||
|
|
||||
|
# Install storm headers to include directory. |
||||
|
foreach(HEADER ${STORM_VERSION_INFO_HEADERS}) |
||||
|
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/src/?" "" RELATIVE_HEADER_PATH ${HEADER}) |
||||
|
string(REGEX MATCH "(.*)[/\\]" RELATIVE_DIRECTORY ${RELATIVE_HEADER_PATH}) |
||||
|
string(REGEX REPLACE "${RELATIVE_DIRECTORY}/?" "" HEADER_FILENAME ${RELATIVE_HEADER_PATH}) |
||||
|
add_custom_command( |
||||
|
OUTPUT ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY} |
||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${HEADER} ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
||||
|
DEPENDS ${HEADER} |
||||
|
) |
||||
|
list(APPEND STORM_VERSION_INFO_OUTPUT_HEADERS "${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}") |
||||
|
endforeach() |
||||
|
add_custom_target(copy_storm_version_info_headers DEPENDS ${STORM_VERSION_INFO_OUTPUT_HEADERS} ${STORM_VERSION_INFO_HEADERS}) |
||||
|
add_dependencies(storm-version-info copy_storm_version_info_headers) |
||||
|
|
||||
|
# installation |
||||
|
install(TARGETS storm-version-info EXPORT storm_Targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL) |
||||
|
|
@ -0,0 +1,24 @@ |
|||||
|
// AUTO GENERATED -- DO NOT CHANGE |
||||
|
#include "storm-version-info/storm-version.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
|
||||
|
const unsigned StormVersion::versionMajor = @STORM_VERSION_MAJOR@; |
||||
|
const unsigned StormVersion::versionMinor = @STORM_VERSION_MINOR@; |
||||
|
const unsigned StormVersion::versionPatch = @STORM_VERSION_DEV_PATCH@; |
||||
|
const std::string StormVersion::versionLabel = "@STORM_VERSION_LABEL@"; |
||||
|
const bool StormVersion::versionDev = @STORM_VERSION_DEV@; |
||||
|
const StormVersion::VersionSource StormVersion::versionSource = @STORM_VERSION_SOURCE@; |
||||
|
const std::string StormVersion::gitRevisionHash = "@STORM_VERSION_GIT_HASH@"; |
||||
|
const unsigned StormVersion::commitsAhead = @STORM_VERSION_COMMITS_AHEAD@; |
||||
|
const boost::optional<bool> StormVersion::dirty = @STORM_VERSION_DIRTY@; |
||||
|
const std::string StormVersion::systemName = "@CMAKE_SYSTEM_NAME@"; |
||||
|
const std::string StormVersion::systemVersion = "@CMAKE_SYSTEM_VERSION@"; |
||||
|
const std::string StormVersion::cxxCompiler = "@STORM_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@"; |
||||
|
#ifdef NDEBUG |
||||
|
const std::string StormVersion::cxxFlags = "@CMAKE_CXX_FLAGS@" " " "@CMAKE_CXX_FLAGS_RELEASE@"; |
||||
|
#else |
||||
|
const std::string StormVersion::cxxFlags = "@CMAKE_CXX_FLAGS@" " " "@CMAKE_CXX_FLAGS_DEBUG@"; |
||||
|
#endif |
||||
|
|
||||
|
} |
@ -0,0 +1,98 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include <string> |
||||
|
#include <sstream> |
||||
|
|
||||
|
#include <boost/optional.hpp> |
||||
|
|
||||
|
namespace storm { |
||||
|
|
||||
|
struct StormVersion { |
||||
|
/// The major version of Storm. |
||||
|
const static unsigned versionMajor; |
||||
|
|
||||
|
/// The minor version of Storm. |
||||
|
const static unsigned versionMinor; |
||||
|
|
||||
|
/// The patch version of Storm. |
||||
|
const static unsigned versionPatch; |
||||
|
|
||||
|
/// The label version of Storm (might be empty). |
||||
|
const static std::string versionLabel; |
||||
|
|
||||
|
/// Flag indicating if the version of Storm is a development version. |
||||
|
const static bool versionDev; |
||||
|
|
||||
|
enum class VersionSource { |
||||
|
Git, Static |
||||
|
}; |
||||
|
|
||||
|
/// The source of the versioning information. |
||||
|
const static VersionSource versionSource; |
||||
|
|
||||
|
/// The short hash of the git commit this build is based on |
||||
|
const static std::string gitRevisionHash; |
||||
|
|
||||
|
/// How many commits passed since the tag was last set. |
||||
|
const static unsigned commitsAhead; |
||||
|
|
||||
|
/// 0 iff there no files were modified in the checkout, 1 otherwise. If none, no information about dirtyness is given. |
||||
|
const static boost::optional<bool> dirty; |
||||
|
|
||||
|
/// The system which has compiled Storm. |
||||
|
const static std::string systemName; |
||||
|
|
||||
|
/// The system version which has compiled Storm. |
||||
|
const static std::string systemVersion; |
||||
|
|
||||
|
/// The compiler version that was used to build Storm. |
||||
|
const static std::string cxxCompiler; |
||||
|
|
||||
|
/// The flags that were used to build Storm. |
||||
|
const static std::string cxxFlags; |
||||
|
|
||||
|
static std::string shortVersionString() { |
||||
|
std::stringstream sstream; |
||||
|
sstream << versionMajor << "." << versionMinor << "." << versionPatch; |
||||
|
if (!versionLabel.empty()) { |
||||
|
sstream << "-" << versionLabel; |
||||
|
} |
||||
|
if (versionDev) { |
||||
|
sstream << " (dev)"; |
||||
|
} |
||||
|
return sstream.str(); |
||||
|
} |
||||
|
|
||||
|
static std::string longVersionString() { |
||||
|
std::stringstream sstream; |
||||
|
sstream << "Version " << shortVersionString(); |
||||
|
if (versionSource == VersionSource::Static) { |
||||
|
sstream << " (derived statically)"; |
||||
|
} |
||||
|
if (commitsAhead > 0) { |
||||
|
sstream << " (+ " << commitsAhead << " commits)"; |
||||
|
} |
||||
|
if (!gitRevisionHash.empty()) { |
||||
|
sstream << " build from revision " << gitRevisionHash; |
||||
|
} else { |
||||
|
sstream << " built from archive"; |
||||
|
} |
||||
|
if (dirty) { |
||||
|
if (dirty.get()) { |
||||
|
sstream << " (dirty)"; |
||||
|
} else { |
||||
|
sstream << " (clean)"; |
||||
|
} |
||||
|
} else { |
||||
|
sstream << " (potentially dirty)"; |
||||
|
} |
||||
|
return sstream.str(); |
||||
|
} |
||||
|
|
||||
|
static std::string buildInfo() { |
||||
|
std::stringstream sstream; |
||||
|
sstream << "Compiled on " << systemName << " " << systemVersion << " using " << cxxCompiler << " with flags '" << cxxFlags << "'"; |
||||
|
return sstream.str(); |
||||
|
} |
||||
|
}; |
||||
|
} |
@ -1,100 +0,0 @@ |
|||||
#pragma once |
|
||||
|
|
||||
#include <string> |
|
||||
#include <sstream> |
|
||||
|
|
||||
#include <boost/optional.hpp> |
|
||||
|
|
||||
namespace storm { |
|
||||
namespace utility { |
|
||||
|
|
||||
struct StormVersion { |
|
||||
/// The major version of Storm. |
|
||||
const static unsigned versionMajor; |
|
||||
|
|
||||
/// The minor version of Storm. |
|
||||
const static unsigned versionMinor; |
|
||||
|
|
||||
/// The patch version of Storm. |
|
||||
const static unsigned versionPatch; |
|
||||
|
|
||||
/// The label version of Storm (might be empty). |
|
||||
const static std::string versionLabel; |
|
||||
|
|
||||
/// Flag indicating if the version of Storm is a development version. |
|
||||
const static bool versionDev; |
|
||||
|
|
||||
enum class VersionSource { |
|
||||
Git, Static |
|
||||
}; |
|
||||
|
|
||||
/// The source of the versioning information. |
|
||||
const static VersionSource versionSource; |
|
||||
|
|
||||
/// The short hash of the git commit this build is based on |
|
||||
const static std::string gitRevisionHash; |
|
||||
|
|
||||
/// How many commits passed since the tag was last set. |
|
||||
const static unsigned commitsAhead; |
|
||||
|
|
||||
/// 0 iff there no files were modified in the checkout, 1 otherwise. If none, no information about dirtyness is given. |
|
||||
const static boost::optional<bool> dirty; |
|
||||
|
|
||||
/// The system which has compiled Storm. |
|
||||
const static std::string systemName; |
|
||||
|
|
||||
/// The system version which has compiled Storm. |
|
||||
const static std::string systemVersion; |
|
||||
|
|
||||
/// The compiler version that was used to build Storm. |
|
||||
const static std::string cxxCompiler; |
|
||||
|
|
||||
/// The flags that were used to build Storm. |
|
||||
const static std::string cxxFlags; |
|
||||
|
|
||||
static std::string shortVersionString() { |
|
||||
std::stringstream sstream; |
|
||||
sstream << versionMajor << "." << versionMinor << "." << versionPatch; |
|
||||
if (!versionLabel.empty()) { |
|
||||
sstream << "-" << versionLabel; |
|
||||
} |
|
||||
if (versionDev) { |
|
||||
sstream << " (dev)"; |
|
||||
} |
|
||||
return sstream.str(); |
|
||||
} |
|
||||
|
|
||||
static std::string longVersionString() { |
|
||||
std::stringstream sstream; |
|
||||
sstream << "Version " << shortVersionString(); |
|
||||
if (versionSource == VersionSource::Static) { |
|
||||
sstream << " (derived statically)"; |
|
||||
} |
|
||||
if (commitsAhead > 0) { |
|
||||
sstream << " (+ " << commitsAhead << " commits)"; |
|
||||
} |
|
||||
if (!gitRevisionHash.empty()) { |
|
||||
sstream << " build from revision " << gitRevisionHash; |
|
||||
} else { |
|
||||
sstream << " built from archive"; |
|
||||
} |
|
||||
if (dirty) { |
|
||||
if (dirty.get()) { |
|
||||
sstream << " (dirty)"; |
|
||||
} else { |
|
||||
sstream << " (clean)"; |
|
||||
} |
|
||||
} else { |
|
||||
sstream << " (potentially dirty)"; |
|
||||
} |
|
||||
return sstream.str(); |
|
||||
} |
|
||||
|
|
||||
static std::string buildInfo() { |
|
||||
std::stringstream sstream; |
|
||||
sstream << "Compiled on " << systemName << " " << systemVersion << " using " << cxxCompiler << " with flags '" << cxxFlags << "'"; |
|
||||
return sstream.str(); |
|
||||
} |
|
||||
}; |
|
||||
} |
|
||||
} |
|
@ -1,26 +0,0 @@ |
|||||
// AUTO GENERATED -- DO NOT CHANGE |
|
||||
#include "storm/utility/storm-version.h" |
|
||||
|
|
||||
namespace storm { |
|
||||
namespace utility { |
|
||||
|
|
||||
const unsigned StormVersion::versionMajor = @STORM_VERSION_MAJOR@; |
|
||||
const unsigned StormVersion::versionMinor = @STORM_VERSION_MINOR@; |
|
||||
const unsigned StormVersion::versionPatch = @STORM_VERSION_DEV_PATCH@; |
|
||||
const std::string StormVersion::versionLabel = "@STORM_VERSION_LABEL@"; |
|
||||
const bool StormVersion::versionDev = @STORM_VERSION_DEV@; |
|
||||
const StormVersion::VersionSource StormVersion::versionSource = @STORM_VERSION_SOURCE@; |
|
||||
const std::string StormVersion::gitRevisionHash = "@STORM_VERSION_GIT_HASH@"; |
|
||||
const unsigned StormVersion::commitsAhead = @STORM_VERSION_COMMITS_AHEAD@; |
|
||||
const boost::optional<bool> StormVersion::dirty = @STORM_VERSION_DIRTY@; |
|
||||
const std::string StormVersion::systemName = "@CMAKE_SYSTEM_NAME@"; |
|
||||
const std::string StormVersion::systemVersion = "@CMAKE_SYSTEM_VERSION@"; |
|
||||
const std::string StormVersion::cxxCompiler = "@STORM_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@"; |
|
||||
#ifdef NDEBUG |
|
||||
const std::string StormVersion::cxxFlags = "@CMAKE_CXX_FLAGS@" " " "@CMAKE_CXX_FLAGS_RELEASE@"; |
|
||||
#else |
|
||||
const std::string StormVersion::cxxFlags = "@CMAKE_CXX_FLAGS@" " " "@CMAKE_CXX_FLAGS_DEBUG@"; |
|
||||
#endif |
|
||||
|
|
||||
} |
|
||||
} |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue