Browse Source

Moved generated file `storm-version.cpp` to build folder. Moved version information to new library `storm-version-info` (addressing Github issue #78)

tempestpy_adaptions
Tim Quatmann 5 years ago
parent
commit
70d10bd037
  1. 8
      CMakeLists.txt
  2. 1
      src/CMakeLists.txt
  3. 6
      src/storm-cli-utilities/CMakeLists.txt
  4. 8
      src/storm-cli-utilities/cli.cpp
  5. 1
      src/storm-cli-utilities/model-handling.h
  6. 47
      src/storm-version-info/CMakeLists.txt
  7. 24
      src/storm-version-info/storm-version.cpp.in
  8. 98
      src/storm-version-info/storm-version.h
  9. 100
      src/storm/utility/storm-version.h
  10. 26
      storm-version.cpp.in

8
CMakeLists.txt

@ -488,14 +488,6 @@ configure_file (
"${PROJECT_BINARY_DIR}/include/storm-config.h"
)
# Configure a source file to pass the Storm version to the source code
configure_file (
"${PROJECT_SOURCE_DIR}/storm-version.cpp.in"
"${PROJECT_SOURCE_DIR}/src/storm/utility/storm-version.cpp"
)
set(STORM_GENERATED_SOURCES "${PROJECT_BINARY_DIR}/src/storm/utility/storm-version.cpp")
# Add the binary dir include directory for storm-config.h
include_directories("${PROJECT_BINARY_DIR}/include")

1
src/CMakeLists.txt

@ -7,6 +7,7 @@ add_custom_target(binaries)
add_subdirectory(storm)
add_subdirectory(storm-counterexamples)
add_subdirectory(storm-parsers)
add_subdirectory(storm-version-info)
add_subdirectory(storm-cli-utilities)
add_subdirectory(storm-pgcl)
add_subdirectory(storm-pgcl-cli)

6
src/storm-cli-utilities/CMakeLists.txt

@ -8,7 +8,7 @@ file(GLOB_RECURSE STORM_CLI_UTIL_SOURCES ${PROJECT_SOURCE_DIR}/src/storm-cli-uti
file(GLOB_RECURSE STORM_CLI_UTIL_HEADERS ${PROJECT_SOURCE_DIR}/src/storm-cli-utilities/*.h)
# Create storm-pars.
# Create storm-cli-utilities.
add_library(storm-cli-utilities SHARED ${STORM_CLI_UTIL_SOURCES} ${STORM_CLI_UTIL_HEADERS})
# Remove define symbol for shared libstorm.
@ -17,7 +17,7 @@ set_target_properties(storm-cli-utilities PROPERTIES DEFINE_SYMBOL "")
list(APPEND STORM_TARGETS storm-cli-utilities)
set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE)
target_link_libraries(storm-cli-utilities PUBLIC storm storm-counterexamples storm-parsers)
target_link_libraries(storm-cli-utilities PUBLIC storm storm-counterexamples storm-parsers storm-version-info)
# Install storm headers to include directory.
foreach(HEADER ${STORM_CLI_UTIL_HEADERS})
@ -33,7 +33,7 @@ foreach(HEADER ${STORM_CLI_UTIL_HEADERS})
list(APPEND STORM_CLI_UTIL_OUTPUT_HEADERS "${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}")
endforeach()
add_custom_target(copy_storm_cli_util_headers DEPENDS ${STORM_CLI_UTIL_OUTPUT_HEADERS} ${STORM_CLI_UTIL_HEADERS})
add_dependencies(storm-cli-utilities copy_storm_pars_headers)
add_dependencies(storm-cli-utilities copy_storm_cli_util_headers)
# installation
install(TARGETS storm-cli-utilities EXPORT storm_Targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL)

8
src/storm-cli-utilities/cli.cpp

@ -3,7 +3,7 @@
#include "storm/utility/resources.h"
#include "storm/utility/file.h"
#include "storm/utility/storm-version.h"
#include "storm-version-info/storm-version.h"
#include "storm/utility/macros.h"
#include "storm/utility/initialize.h"
#include "storm/utility/SignalHandler.h"
@ -88,7 +88,7 @@ namespace storm {
}
void printHeader(std::string const& name, const int argc, const char** argv) {
STORM_PRINT(name << " " << storm::utility::StormVersion::shortVersionString() << std::endl << std::endl);
STORM_PRINT(name << " " << storm::StormVersion::shortVersionString() << std::endl << std::endl);
// "Compute" the command line argument string with which storm was invoked.
std::stringstream commandStream;
@ -107,8 +107,8 @@ namespace storm {
}
void printVersion(std::string const& name) {
STORM_PRINT(storm::utility::StormVersion::longVersionString() << std::endl);
STORM_PRINT(storm::utility::StormVersion::buildInfo() << std::endl);
STORM_PRINT(storm::StormVersion::longVersionString() << std::endl);
STORM_PRINT(storm::StormVersion::buildInfo() << std::endl);
#ifdef STORM_HAVE_INTELTBB
STORM_PRINT("Linked with Intel Threading Building Blocks v" << TBB_VERSION_MAJOR << "." << TBB_VERSION_MINOR << " (Interface version " << TBB_INTERFACE_VERSION << ")." << std::endl);

1
src/storm-cli-utilities/model-handling.h

@ -7,7 +7,6 @@
#include "storm/utility/SignalHandler.h"
#include "storm/utility/file.h"
#include "storm/utility/storm-version.h"
#include "storm/utility/macros.h"
#include "storm/utility/NumberTraits.h"
#include "storm/utility/Engine.h"

47
src/storm-version-info/CMakeLists.txt

@ -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)

24
src/storm-version-info/storm-version.cpp.in

@ -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
}

98
src/storm-version-info/storm-version.h

@ -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();
}
};
}

100
src/storm/utility/storm-version.h

@ -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();
}
};
}
}

26
storm-version.cpp.in

@ -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
}
}
Loading…
Cancel
Save