Browse Source

Jit: Fixed issues when CLN and/or GMP is installed via carl

tempestpy_adaptions
Tim Quatmann 5 years ago
parent
commit
2cb7b5769e
  1. 13
      resources/3rdparty/CMakeLists.txt
  2. 27
      src/storm/builder/jit/ExplicitJitJaniModelBuilder.cpp
  3. 6
      src/storm/builder/jit/ExplicitJitJaniModelBuilder.h
  4. 7
      storm-config.h.in

13
resources/3rdparty/CMakeLists.txt

@ -374,10 +374,6 @@ endif()
## gmp ## gmp
## ##
############################################################# #############################################################
#
#find_package(GMP QUIET REQUIRED)
#
get_target_property(GMPXX_LIB GMPXX_SHARED IMPORTED_LIB_LOCATION) get_target_property(GMPXX_LIB GMPXX_SHARED IMPORTED_LIB_LOCATION)
get_target_property(GMP_LIB GMP_SHARED IMPORTED_LIB_LOCATION) get_target_property(GMP_LIB GMP_SHARED IMPORTED_LIB_LOCATION)
@ -387,10 +383,13 @@ get_filename_component(GMP_LIB_LOCATION ${GMP_LIB} DIRECTORY)
get_filename_component(GMPXX_LIB_LOCATION ${GMPXX_LIB} DIRECTORY) get_filename_component(GMPXX_LIB_LOCATION ${GMPXX_LIB} DIRECTORY)
#############################################################
##
## cln
##
#############################################################
#message(STATUS "Storm - Linking with gmp.")
#include_directories("${GMP_INCLUDE_DIR}")
#list(APPEND STORM_LINK_LIBRARIES ${GMP_LIBRARY})
get_target_property(CLN_INCLUDE_DIR CLN_SHARED INTERFACE_INCLUDE_DIRECTORIES)
############################################################# #############################################################
## ##

27
src/storm/builder/jit/ExplicitJitJaniModelBuilder.cpp

@ -99,6 +99,16 @@ namespace storm {
} else { } else {
carlIncludeDirectory = STORM_CARL_INCLUDE_DIR; carlIncludeDirectory = STORM_CARL_INCLUDE_DIR;
} }
#ifdef STORM_HAVE_CLN
clnIncludeDirectory = CLN_INCLUDE_DIR;
#else
clnIncludeDirectory = "";
#endif
#ifdef STORM_HAVE_GMP
gmpIncludeDirectory = GMP_INCLUDE_DIR;
#else
gmpIncludeDirectory = "";
#endif
sparseppIncludeDirectory = STORM_BUILD_DIR "/include/resources/3rdparty/sparsepp/"; sparseppIncludeDirectory = STORM_BUILD_DIR "/include/resources/3rdparty/sparsepp/";
// Register all transient variables as transient. // Register all transient variables as transient.
@ -393,7 +403,13 @@ namespace storm {
boost::filesystem::path outputFile = temporaryFile; boost::filesystem::path outputFile = temporaryFile;
outputFile += ".out"; outputFile += ".out";
std::string outputFilename = boost::filesystem::absolute(outputFile).string(); std::string outputFilename = boost::filesystem::absolute(outputFile).string();
boost::optional<std::string> error = execute(compiler + " " + compilerFlags + " " + temporaryFilename + " -I" + stormIncludeDirectory + " -I" + carlIncludeDirectory + " -o " + outputFilename);
std::string includes = "";
for (std::string const& dir : {stormIncludeDirectory, carlIncludeDirectory, clnIncludeDirectory, gmpIncludeDirectory}) {
if (dir != "") {
includes += " -I" + dir;
}
}
boost::optional<std::string> error = execute(compiler + " " + compilerFlags + " " + temporaryFilename + includes + " -o " + outputFilename);
if (error) { if (error) {
result = false; result = false;
@ -2488,8 +2504,13 @@ namespace storm {
auto dynamicLibraryPath = sourceFile; auto dynamicLibraryPath = sourceFile;
dynamicLibraryPath += DYLIB_EXTENSION; dynamicLibraryPath += DYLIB_EXTENSION;
std::string dynamicLibraryFilename = boost::filesystem::absolute(dynamicLibraryPath).string(); std::string dynamicLibraryFilename = boost::filesystem::absolute(dynamicLibraryPath).string();
std::string command = compiler + " " + sourceFilename + " " + compilerFlags + " -I" + stormIncludeDirectory + " -I" + sparseppIncludeDirectory + " -I" + boostIncludeDirectory + " -I" + carlIncludeDirectory + " -o " + dynamicLibraryFilename;
std::string includes = "";
for (std::string const& dir : {stormIncludeDirectory, sparseppIncludeDirectory, boostIncludeDirectory, carlIncludeDirectory, clnIncludeDirectory, gmpIncludeDirectory}) {
if (dir != "") {
includes += " -I" + dir;
}
}
std::string command = compiler + " " + sourceFilename + " " + compilerFlags + includes + " -o " + dynamicLibraryFilename;
boost::optional<std::string> error = execute(command); boost::optional<std::string> error = execute(command);
if (error) { if (error) {

6
src/storm/builder/jit/ExplicitJitJaniModelBuilder.h

@ -195,6 +195,12 @@ namespace storm {
/// The include directory of sparsepp. /// The include directory of sparsepp.
std::string sparseppIncludeDirectory; std::string sparseppIncludeDirectory;
/// The include directory for cln
std::string clnIncludeDirectory;
/// The include directory for gmp
std::string gmpIncludeDirectory;
/// A cache that is used by carl. /// A cache that is used by carl.
std::shared_ptr<carl::Cache<carl::PolynomialFactorizationPair<RawPolynomial>>> cache; std::shared_ptr<carl::Cache<carl::PolynomialFactorizationPair<RawPolynomial>>> cache;
}; };

7
storm-config.h.in

@ -66,9 +66,16 @@
// Whether CLN is available and to be used (define/undef) // Whether CLN is available and to be used (define/undef)
#cmakedefine STORM_HAVE_CLN #cmakedefine STORM_HAVE_CLN
// Include directory for CLN headers
#cmakedefine CLN_INCLUDE_DIR "@CLN_INCLUDE_DIR@"
// Whether GMP is available (it is always available nowadays) // Whether GMP is available (it is always available nowadays)
#define STORM_HAVE_GMP #define STORM_HAVE_GMP
// Include directory for GMP headers
#cmakedefine GMP_INCLUDE_DIR "@GMP_INCLUDE_DIR@"
#cmakedefine GMPXX_INCLUDE_DIR "@GMPXX_INCLUDE_DIR@"
// Whether carl is available and to be used. // Whether carl is available and to be used.
#cmakedefine STORM_HAVE_CARL #cmakedefine STORM_HAVE_CARL

Loading…
Cancel
Save