From 97a7689c673d727ad04a22e88b638230d5fdb640 Mon Sep 17 00:00:00 2001 From: dehnert Date: Tue, 11 Apr 2017 20:21:47 +0200 Subject: [PATCH] gcc and clang working on Debian Stretch again --- CMakeLists.txt | 14 +++++++--- resources/3rdparty/CMakeLists.txt | 17 ++++++------ resources/3rdparty/include_cpptemplate.cmake | 29 -------------------- resources/3rdparty/include_cudd.cmake | 2 +- resources/3rdparty/include_glpk.cmake | 6 ++-- resources/3rdparty/include_xerces.cmake | 8 +++--- src/storm/CMakeLists.txt | 6 ++-- 7 files changed, 30 insertions(+), 52 deletions(-) delete mode 100644 resources/3rdparty/include_cpptemplate.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a215b5a9..1519ef355 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -223,8 +223,14 @@ if (STORM_COMPILER_CLANG OR STORM_COMPILER_APPLECLANG) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -stdlib=${CLANG_STDLIB} -ftemplate-depth=1024") set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffast-math -fno-finite-math-only") - set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export_dynamic") - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-export_dynamic") + + if(LINUX) + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic") + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic") + elseif(MACOSX) + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export_dynamic") + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-export_dynamic") + endif() elseif (STORM_COMPILER_GCC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprefetch-loop-arrays -ffast-math -fno-finite-math-only") @@ -235,8 +241,8 @@ endif () if (STORM_USE_LTO) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto") - # Fix for problems that occured when using LTO on gcc. This should be removed when it's - # not needed anymore as it makes the the already long link-step potentially longer. + # Fix for problems that occurred when using LTO on gcc. This should be removed when it + # is not needed anymore as it makes the the already long link-step potentially longer. if (STORM_COMPILER_GCC) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto-partition=none") endif() diff --git a/resources/3rdparty/CMakeLists.txt b/resources/3rdparty/CMakeLists.txt index c706ed6a2..1f4f31429 100644 --- a/resources/3rdparty/CMakeLists.txt +++ b/resources/3rdparty/CMakeLists.txt @@ -190,13 +190,6 @@ endif() ############################################################# include(${STORM_3RDPARTY_SOURCE_DIR}/include_cudd.cmake) -############################################################# -## -## cpptemplate -## -############################################################# -include(${STORM_3RDPARTY_SOURCE_DIR}/include_cpptemplate.cmake) - ############################################################# ## ## carl @@ -377,7 +370,6 @@ ExternalProject_Add( LOG_CONFIGURE ON LOG_BUILD ON BUILD_BYPRODUCTS ${STORM_3RDPARTY_BINARY_DIR}/sylvan/src/libsylvan${STATIC_EXT} - BUILD_ALWAYS 1 ) ExternalProject_Get_Property(sylvan source_dir) @@ -404,6 +396,15 @@ else() endif() endif() +############################################################# +## +## cpptemplate +## +############################################################# + +include_directories(${STORM_3RDPARTY_SOURCE_DIR}/cpptemplate) +list(APPEND STORM_3RDPARTY_SOURCES ${STORM_3RDPARTY_SOURCE_DIR}/cpptemplate/cpptempl.cpp) + ############################################################# ## ## Google Test gtest diff --git a/resources/3rdparty/include_cpptemplate.cmake b/resources/3rdparty/include_cpptemplate.cmake deleted file mode 100644 index ea2a9ba31..000000000 --- a/resources/3rdparty/include_cpptemplate.cmake +++ /dev/null @@ -1,29 +0,0 @@ -string(REPLACE " " ";" CMAKE_CXX_FLAGS_AS_LIST ${CMAKE_CXX_FLAGS}) -if(CMAKE_BUILD_TYPE MATCHES DEBUG) - string(REPLACE " " ";" CMAKE_CXX_FLAGS_DEBUG_AS_LIST ${CMAKE_CXX_FLAGS_DEBUG}) - list(APPEND CMAKE_CXX_FLAGS_AS_LIST ${CMAKE_CXX_FLAGS_DEBUG_AS_LIST}) -else() - string(REPLACE " " ";" CMAKE_CXX_FLAGS_RELEASE_AS_LIST ${CMAKE_CXX_FLAGS_RELEASE}) - list(APPEND CMAKE_CXX_FLAGS_AS_LIST ${CMAKE_CXX_FLAGS_RELEASE_AS_LIST}) -endif() -set(CPPTEMPLATE_LIB_DIR ${STORM_3RDPARTY_BINARY_DIR}/cpptemplate) -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} -c ${CMAKE_CXX_FLAGS_AS_LIST} ${CMAKE_CXX_FLAGS_RELEASE_AS_LIST} -fPIC -I${Boost_INCLUDE_DIRS} ${STORM_3RDPARTY_SOURCE_DIR}/cpptemplate/cpptempl.cpp -o ${CPPTEMPLATE_LIB_DIR}/cpptemplate${STATIC_EXT} - INSTALL_COMMAND "" - BUILD_IN_SOURCE 0 - LOG_BUILD ON - BUILD_BYPRODUCTS ${CPPTEMPLATE_LIB_DIR}/cpptemplate${STATIC_EXT} -) - -set(CPPTEMPLATE_INCLUDE_DIR ${STORM_3RDPARTY_SOURCE_DIR}/cpptemplate) -set(CPPTEMPLATE_STATIC_LIBRARY ${STORM_3RDPARTY_BINARY_DIR}/cpptemplate/cpptemplate${STATIC_EXT}) -add_dependencies(resources cpptemplate) - -message(STATUS "storm - Linking with cpptemplate.") -add_imported_library(cpptempl STATIC ${CPPTEMPLATE_STATIC_LIBRARY} ${CPPTEMPLATE_INCLUDE_DIR}) -list(APPEND STORM_DEP_TARGETS cpptempl_STATIC) diff --git a/resources/3rdparty/include_cudd.cmake b/resources/3rdparty/include_cudd.cmake index 8f17fb35b..e4bcebcb9 100644 --- a/resources/3rdparty/include_cudd.cmake +++ b/resources/3rdparty/include_cudd.cmake @@ -54,4 +54,4 @@ else() list(APPEND STORM_DEP_TARGETS cudd_STATIC) endif() -message(STATUS "storm - Linking with CUDD ${CUDD_VERSION_STRING}.") +message(STATUS "Storm - Linking with CUDD ${CUDD_VERSION_STRING}.") diff --git a/resources/3rdparty/include_glpk.cmake b/resources/3rdparty/include_glpk.cmake index 1f1eed1f1..e7dc55149 100644 --- a/resources/3rdparty/include_glpk.cmake +++ b/resources/3rdparty/include_glpk.cmake @@ -1,8 +1,8 @@ find_package(GLPK QUIET) if(GLPK_FOUND) - message (STATUS "storm - Using system version of glpk.") + message (STATUS "Storm - Using system version of glpk.") else() - message (STATUS "storm - Using shipped version of glpk.") + message (STATUS "Storm - Using shipped version of glpk.") set(GLPK_LIB_DIR ${STORM_3RDPARTY_BINARY_DIR}/glpk-4.57/lib) ExternalProject_Add(glpk_ext DOWNLOAD_COMMAND "" @@ -25,7 +25,7 @@ endif() # Since there is a shipped version, always use GLPK set(STORM_HAVE_GLPK ON) -message (STATUS "storm - Linking with glpk ${GLPK_VERSION_STRING}") +message (STATUS "Storm - Linking with glpk ${GLPK_VERSION_STRING}") add_imported_library(glpk SHARED ${GLPK_LIBRARIES} ${GLPK_INCLUDE_DIR}) list(APPEND STORM_DEP_TARGETS glpk_SHARED) \ No newline at end of file diff --git a/resources/3rdparty/include_xerces.cmake b/resources/3rdparty/include_xerces.cmake index d7ed7e1f9..4a464835d 100644 --- a/resources/3rdparty/include_xerces.cmake +++ b/resources/3rdparty/include_xerces.cmake @@ -1,9 +1,9 @@ if(USE_XERCESC) find_package(XercesC QUIET) if(XercesC_FOUND) - message(STATUS "storm - Use system version of xerces.") + message(STATUS "Storm - Use system version of xerces.") else() - message(STATUS "storm - Use shipped version of xerces.") + message(STATUS "Storm - Use shipped version of xerces.") set(XercesC_LIB_DIR ${STORM_3RDPARTY_BINARY_DIR}/xercesc-3.1.2/lib) ExternalProject_Add( xercesc @@ -31,7 +31,7 @@ if(USE_XERCESC) add_dependencies(resources xercesc) endif() - message (STATUS "storm - Linking with xercesc.") + message (STATUS "Storm - Linking with xercesc.") set(STORM_HAVE_XERCES ON) include_directories(${XercesC_INCLUDE_DIRS}) if(APPLE) @@ -44,5 +44,5 @@ if(USE_XERCESC) list(APPEND STORM_GSPN_LINK_LIBRARIES ${XercesC_LIBRARIES} ${COREFOUNDATION_LIBRARY} ${CORESERVICES_LIBRARY} ${CURL_LIBRARIES}) else() set(STORM_HAVE_XERCES OFF) - message (WARNING "torm - Building without Xerces disables parsing XML formats (for GSPNs)") + message (WARNING "Storm - Building without Xerces disables parsing XML formats (for GSPNs)") endif(USE_XERCESC) diff --git a/src/storm/CMakeLists.txt b/src/storm/CMakeLists.txt index f3e915fbd..a57805ed9 100644 --- a/src/storm/CMakeLists.txt +++ b/src/storm/CMakeLists.txt @@ -14,7 +14,7 @@ file(GLOB_RECURSE STORM_MAIN_FILE ${PROJECT_SOURCE_DIR}/src/storm/storm.cpp) # Additional include files like the storm-config.h file(GLOB_RECURSE STORM_BUILD_HEADERS ${PROJECT_BINARY_DIR}/include/*.h) -set(STORM_LIB_SOURCES ${STORM_SOURCES_WITHOUT_MAIN}) +set(STORM_LIB_SOURCES ${STORM_3RDPARTY_SOURCES} ${STORM_SOURCES_WITHOUT_MAIN}) set(STORM_LIB_HEADERS ${STORM_HEADERS}) set(STORM_MAIN_SOURCES ${STORM_MAIN_FILE}) @@ -43,13 +43,13 @@ add_library(storm SHARED ${STORM_LIB_SOURCES} ${STORM_LIB_HEADERS}) set_target_properties(storm PROPERTIES DEFINE_SYMBOL "") add_dependencies(storm resources) #The library that needs symbols must be first, then the library that resolves the symbol. -target_link_libraries(storm PUBLIC ${STORM_DEP_TARGETS} ${STORM_DEP_IMP_TARGETS} ${STORM_LINK_LIBRARIES}) +target_link_libraries(storm PUBLIC ${STORM_DEP_TARGETS} ${STORM_DEP_IMP_TARGETS} ${STORM_LINK_LIBRARIES}) list(APPEND STORM_TARGETS storm) set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE) # Create storm. add_executable(storm-main ${STORM_MAIN_SOURCES} ${STORM_MAIN_HEADERS}) -target_link_libraries(storm-main storm) +target_link_libraries(storm-main PUBLIC storm) set_target_properties(storm-main PROPERTIES OUTPUT_NAME "storm") # Install storm headers to include directory.