Browse Source

made jit model builder work on Ubuntu 16.04/g++

Former-commit-id: c9473408cc [formerly dca321927e]
Former-commit-id: 1bcd57f6da
tempestpy_adaptions
dehnert 8 years ago
parent
commit
392f56aab5
  1. 6
      CMakeLists.txt
  2. 7
      resources/3rdparty/include_cpptemplate.cmake
  3. 2
      src/builder/jit/Choice.h
  4. 15
      src/builder/jit/ExplicitJitJaniModelBuilder.cpp

6
CMakeLists.txt

@ -131,10 +131,10 @@ if(CMAKE_COMPILER_IS_GNUCC)
# Fix thanks to: https://github.com/freeorion/freeorion/issues/777
add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE -DBOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -pedantic -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unknown-pragmas")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -flto -Wall -pedantic -fprefetch-loop-arrays -ffast-math -fno-finite-math-only -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unknown-pragmas")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wno-deprecated-declarations")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
message(FATAL_ERROR "GCC version must be at least 5.0!")
message(FATAL_ERROR "GCC version must be at least 5.0.")
endif()
# Turn on popcnt instruction if desired (yes by default)
if (STORM_USE_POPCNT)
@ -165,7 +165,7 @@ else(CLANG)
# As CLANG is not set as a variable, we need to set it in case we have not matched another compiler.
set (CLANG ON)
# Set standard flags for clang
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops -ffast-math -fno-finite-math-only")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto -fprefetch-loop-arrays -ffast-math -fno-finite-math-only")
if(UNIX AND NOT APPLE)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2)

7
resources/3rdparty/include_cpptemplate.cmake

@ -1,18 +1,19 @@
string(REPLACE " " ";" CMAKE_CXX_FLAGS_AS_LIST ${CMAKE_CXX_FLAGS})
ExternalProject_Add(
cpptemplate
DOWNLOAD_COMMAND ""
SOURCE_DIR ${STORM_3RDPARTY_SOURCE_DIR}/cpptemplate
PREFIX ${STORM_3RDPARTY_BINARY_DIR}/cpptemplate
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_CXX_COMPILER} -std=c++14 -stdlib=libc++ -O3 -I${Boost_INCLUDE_DIRS} -I${STORM_3RDPARTY_SOURCE_DIR}/utf8_v2_3_4/source -shared ${STORM_3RDPARTY_SOURCE_DIR}/cpptemplate/cpptempl.cpp -o ${STORM_3RDPARTY_BINARY_DIR}/cpptemplate/cpptemplate${DYNAMIC_EXT}
BUILD_COMMAND ${CMAKE_CXX_COMPILER} -c ${CMAKE_CXX_FLAGS_AS_LIST} -fPIC -I${Boost_INCLUDE_DIRS} -I${STORM_3RDPARTY_SOURCE_DIR}/utf8_v2_3_4/source ${STORM_3RDPARTY_SOURCE_DIR}/cpptemplate/cpptempl.cpp -o ${STORM_3RDPARTY_BINARY_DIR}/cpptemplate/cpptemplate${STATIC_EXT}
INSTALL_COMMAND ""
BUILD_IN_SOURCE 0
LOG_BUILD ON
)
set(CPPTEMPLATE_INCLUDE_DIR ${STORM_3RDPARTY_SOURCE_DIR}/cpptemplate)
set(CPPTEMPLATE_SHARED_LIBRARY ${STORM_3RDPARTY_BINARY_DIR}/cpptemplate/cpptemplate${DYNAMIC_EXT})
list(APPEND STORM_LINK_LIBRARIES ${CPPTEMPLATE_SHARED_LIBRARY})
set(CPPTEMPLATE_STATIC_LIBRARY ${STORM_3RDPARTY_BINARY_DIR}/cpptemplate/cpptemplate${STATIC_EXT})
list(APPEND STORM_LINK_LIBRARIES ${CPPTEMPLATE_STATIC_LIBRARY})
add_dependencies(resources cpptemplate)
message(STATUS "StoRM - Linking with cpptemplate")

2
src/builder/jit/Choice.h

@ -1,5 +1,7 @@
#pragma once
#include <cstdint>
#include "src/builder/jit/Distribution.h"
namespace storm {

15
src/builder/jit/ExplicitJitJaniModelBuilder.cpp

@ -57,10 +57,10 @@ namespace storm {
compilerFlags = settings.getCompilerFlags();
} else {
#ifdef LINUX
compilerFlags = "-std=c++11 -fPIC -O3 -shared -funroll-loops -undefined dynamic_lookup";
compilerFlags = "-std=c++14 -fPIC -O3 -shared";
#endif
#ifdef MACOSX
compilerFlags = "-std=c++11 -stdlib=libc++ -fPIC -O3 -shared -funroll-loops -undefined dynamic_lookup";
compilerFlags = "-std=c++14 -stdlib=libc++ -fPIC -O3 -shared -undefined dynamic_lookup";
#endif
}
if (settings.isBoostIncludeDirectorySet()) {
@ -184,8 +184,6 @@ namespace storm {
std::string problem = "Unable to compile empty program with C++ compiler. Is the C++ compiler '" + compiler + "' installed and working?";
try {
std::string emptyProgram = R"(
#include <cstdint>
int main() {
return 0;
}
@ -252,7 +250,6 @@ namespace storm {
std::string problem = "Unable to compile program using boost. Is boosts's include directory '" + boostIncludeDirectory + "' set correctly?";
try {
std::string program = R"(
#include <cstdint>
#include <boost/optional.hpp>
int main() {
@ -264,7 +261,7 @@ namespace storm {
boost::filesystem::path outputFile = temporaryFile;
outputFile += ".out";
std::string outputFilename = boost::filesystem::absolute(outputFile).string();
boost::optional<std::string> error = execute(compiler + " " + temporaryFilename + " -I" + boostIncludeDirectory + " -o " + outputFilename);
boost::optional<std::string> error = execute(compiler + " " + compilerFlags + " " + temporaryFilename + " -I" + boostIncludeDirectory + " -o " + outputFilename);
if (error) {
result = false;
@ -286,7 +283,6 @@ namespace storm {
std::string problem = "Unable to compile program using boost's dll library. Is boosts's include directory '" + boostIncludeDirectory + "' pointing to a boost installation with version at least 1.61?";
try {
std::string program = R"(
#include <cstdint>
#include <boost/dll/alias.hpp>
int main() {
@ -298,7 +294,7 @@ namespace storm {
boost::filesystem::path outputFile = temporaryFile;
outputFile += ".out";
std::string outputFilename = boost::filesystem::absolute(outputFile).string();
boost::optional<std::string> error = execute(compiler + " " + temporaryFilename + " -I" + boostIncludeDirectory + " -o " + outputFilename);
boost::optional<std::string> error = execute(compiler + " " + compilerFlags + " " + temporaryFilename + " -I" + boostIncludeDirectory + " -o " + outputFilename);
if (error) {
result = false;
@ -320,7 +316,6 @@ namespace storm {
std::string problem = "Unable to compile program using Storm data structures. Is Storm's root directory '" + stormRoot + "' set correctly? Does the directory contain the source subtree under src/ ?";
try {
std::string program = R"(
#include <cstdint>
#include "src/builder/RewardModelInformation.h"
int main() {
@ -332,7 +327,7 @@ namespace storm {
boost::filesystem::path outputFile = temporaryFile;
outputFile += ".out";
std::string outputFilename = boost::filesystem::absolute(outputFile).string();
boost::optional<std::string> error = execute(compiler + " " + temporaryFilename + " -I" + stormRoot + " -o " + outputFilename);
boost::optional<std::string> error = execute(compiler + " " + compilerFlags + " " + temporaryFilename + " -I" + stormRoot + " -o " + outputFilename);
if (error) {
result = false;

Loading…
Cancel
Save