Browse Source

towards exporting targets for storm to be included in other projects

tempestpy_adaptions
sjunges 8 years ago
committed by Sebastian Junges
parent
commit
0260eaa7be
  1. 14
      CMakeLists.txt
  2. 4
      resources/3rdparty/CMakeLists.txt
  3. 26
      resources/cmake/macros/export.cmake
  4. 18
      resources/cmake/stormConfig.cmake.in
  5. 1
      src/storm/CMakeLists.txt

14
CMakeLists.txt

@ -55,10 +55,22 @@ mark_as_advanced(CMAKE_OSX_ARCHITECTURES)
mark_as_advanced(CMAKE_OSX_SYSROOT)
mark_as_advanced(CMAKE_OSX_DEPLOYMENT_TARGET)
# Offer the user the choice of overriding the installation directories
set(INCLUDE_INSTALL_DIR include/ CACHE PATH "Installation directory for header files" )
set(LIB_INSTALL_DIR lib/ CACHE PATH "Installation directory for libraries")
#set(SYSCONFIG_INSTALL_DIR etc/carl/ CACHE PATH "Installation for system configuration files)
set(BIN_INSTALL_DIR lib/ CACHE PATH "Installation directory for executables")
# By default, we build a release version.
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RELEASE")
endif()
# Install dir for cmake files (info for other libraries that include storm)
set(DEF_INSTALL_CMAKE_DIR "lib/CMake/storm")
set(CMAKE_INSTALL_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
message("CMAKE_INSTALL_DIR: ${CMAKE_INSTALL_DIR}")
# If the STORM_DEVELOPER option was turned on, we target a debug version.
if (STORM_DEVELOPER)
@ -354,4 +366,6 @@ endif()
add_subdirectory(src)
include(export)
include(StormCPackConfig.cmake)

4
resources/3rdparty/CMakeLists.txt

@ -216,7 +216,7 @@ if(USE_CARL)
if(carl_FOUND)
set(STORM_HAVE_CARL ON)
message(STATUS "Storm - Use system version of carl.")
message(STATUS "Storm - Linking with carl ${carl_VERSION_STRING}.")
message(STATUS "Storm - Linking with carl ${carl_VERSION} (CARL_USE_CLN_NUMBERS: ${CARL_USE_CLN_NUMBERS}).")
include_directories("${carl_INCLUDE_DIR}")
list(APPEND STORM_LINK_LIBRARIES ${carl_LIBRARIES})
else()
@ -240,6 +240,8 @@ if(USE_CARL)
LOG_BUILD ON
BUILD_BYPRODUCTS ${STORM_3RDPARTY_BINARY_DIR}/carl/lib/libcarl${DYNAMIC_EXT}
)
include(${STORM_3RDPARTY_BINARY_DIR}/carl/carlConfig.cmake)
message("CARL_USE_CLN_NUMBERS: ${CARL_USE_CLN_NUMBERS}")
add_dependencies(resources carl)
set(carl_INCLUDE_DIR "${STORM_3RDPARTY_BINARY_DIR}/carl/include")

26
resources/cmake/macros/export.cmake

@ -0,0 +1,26 @@
# Add all targets to the build-tree export set
export(TARGETS ${STORM_TARGETS} FILE "${PROJECT_BINARY_DIR}/stormTargets.cmake")
message(STATUS "Registered with cmake")
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export(PACKAGE storm)
set(DEP_TARGETS "")
set(EXP_OPTIONS "")
foreach(option ${EXPORTED_OPTIONS})
set(EXP_OPTIONS "${EXP_OPTIONS}\nset(${option} \"${${option}}\")")
endforeach()
include(CMakePackageConfigHelpers)
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src")
message("CMAKE_INSTALL_DIR: ${CMAKE_INSTALL_DIR}")
configure_package_config_file(
resources/cmake/stormConfig.cmake.in
${PROJECT_BINARY_DIR}/stormConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_DIR}
PATH_VARS INCLUDE_INSTALL_DIR #SYSCONFIG_INSTALL_DIR
)

18
resources/cmake/stormConfig.cmake.in

@ -0,0 +1,18 @@
set(storm_VERSION @storm_VERSION@)
@DEP_TARGETS@
@EXP_OPTIONS@
# Our library dependencies (contains definitions for IMPORTED targets)
if(NOT TARGET storm)
include("${PROJECT_BINARY_DIR}/stormTargets.cmake")
endif()
@PACKAGE_INIT@
set(storm_INCLUDE_DIR "@CONF_INCLUDE_DIRS@")
set(storm_LIBRARIES storm)
check_required_components(storm)

1
src/storm/CMakeLists.txt

@ -40,6 +40,7 @@ add_library(storm SHARED ${STORM_LIB_SOURCES} ${STORM_LIB_HEADERS})
set_target_properties(storm PROPERTIES DEFINE_SYMBOL "")
add_dependencies(storm resources)
target_link_libraries(storm ${STORM_LINK_LIBRARIES})
append(STORM_TARGETS storm CACHE STRING INTERNAL FORCE)
# Create storm.
add_executable(storm-main ${STORM_MAIN_SOURCES} ${STORM_MAIN_HEADERS})

Loading…
Cancel
Save