Browse Source

Removed fixed lib path in cmake

refactoring
Matthias Volk 7 years ago
parent
commit
bef2feceb2
  1. 35
      CMakeLists.txt
  2. 12
      cmake/CMakeLists.txt

35
CMakeLists.txt

@ -1,57 +1,42 @@
cmake_minimum_required(VERSION 3.0.0) cmake_minimum_required(VERSION 3.0.0)
project(pystorm) project(pystorm)
option(STORMPY_DISABLE_SIGNATURE_DOC "disables the signature in the documentation" ON)
find_package(storm REQUIRED) find_package(storm REQUIRED)
add_subdirectory(resources/pybind11) add_subdirectory(resources/pybind11)
option(STORMPY_DISABLE_SIGNATURE_DOC "disables the signature in the documentation" ON)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/generated/config.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/generated/config.h)
message(STATUS "STORM-DIR: ${storm_DIR}") message(STATUS "STORM-DIR: ${storm_DIR}")
set(STORMPY_LIB_DIR "${CMAKE_SOURCE_DIR}/lib/stormpy" CACHE STRING "Sets the storm library dir")
function(stormpy_module NAME) function(stormpy_module NAME)
# second, optional argument is LIBRARY_OUTPUT_DIRECTORY,
# defaults to subdir with module name
# third, optional argument are ADDITIONAL_LIBRARIES
# fourth, optional argument are ADDITIONAL_INCLUDES
if(ARGC GREATER 1)
set(LIB_PATH "${ARGV1}")
else()
set(LIB_PATH "${STORMPY_LIB_DIR}/${NAME}")
endif()
# second, optional argument are ADDITIONAL_LIBRARIES
# third, optional argument are ADDITIONAL_INCLUDES
file(GLOB_RECURSE "STORM_${NAME}_SOURCES" "${CMAKE_CURRENT_SOURCE_DIR}/src/${NAME}/*.cpp") file(GLOB_RECURSE "STORM_${NAME}_SOURCES" "${CMAKE_CURRENT_SOURCE_DIR}/src/${NAME}/*.cpp")
pybind11_add_module(${NAME} "${CMAKE_CURRENT_SOURCE_DIR}/src/mod_${NAME}.cpp" ${STORM_${NAME}_SOURCES}) pybind11_add_module(${NAME} "${CMAKE_CURRENT_SOURCE_DIR}/src/mod_${NAME}.cpp" ${STORM_${NAME}_SOURCES})
if(ARGC GREATER 2)
if(ARGC GREATER 1)
# Additional libraries # Additional libraries
target_include_directories(${NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${storm_INCLUDE_DIR} ${ARGV3} ${CMAKE_CURRENT_BINARY_DIR}/src/generated)
target_link_libraries(${NAME} PRIVATE storm ${ARGV2})
target_include_directories(${NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${storm_INCLUDE_DIR} ${ARGV2} ${CMAKE_CURRENT_BINARY_DIR}/src/generated)
target_link_libraries(${NAME} PRIVATE storm ${ARGV1})
else() else()
target_include_directories(${NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${storm_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src/generated) target_include_directories(${NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${storm_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src/generated)
target_link_libraries(${NAME} PRIVATE storm) target_link_libraries(${NAME} PRIVATE storm)
endif() endif()
# setup.py will override this (because pip may want a different install
# path), but also specifying it here has the advantage that invoking cmake
# manually uses the correct path if the default is used (i.e. the
# STORMPY_LIB_DIR hardcoded above)
set_target_properties(${NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${LIB_PATH}")
endfunction(stormpy_module) endfunction(stormpy_module)
stormpy_module(core "${STORMPY_LIB_DIR}")
stormpy_module(core)
stormpy_module(info) stormpy_module(info)
stormpy_module(logic) stormpy_module(logic)
stormpy_module(storage) stormpy_module(storage)
stormpy_module(utility) stormpy_module(utility)
if(HAVE_STORM_PARS) if(HAVE_STORM_PARS)
stormpy_module(pars "${STORMPY_LIB_DIR}/pars" storm-pars "${storm-pars_INCLUDE_DIR}")
stormpy_module(pars storm-pars "${storm-pars_INCLUDE_DIR}")
endif() endif()
if(HAVE_STORM_DFT) if(HAVE_STORM_DFT)
stormpy_module(dft "${STORMPY_LIB_DIR}/dft" storm-dft "${storm-dft_INCLUDE_DIR}")
stormpy_module(dft storm-dft "${storm-dft_INCLUDE_DIR}")
endif() endif()

12
cmake/CMakeLists.txt

@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.0.0)
project(storm-version) project(storm-version)
find_package(storm REQUIRED) find_package(storm REQUIRED)
# Set configuration
set(STORM_DIR ${storm_DIR})
set(STORM_VERSION ${storm_VERSION})
# Check for storm-pars # Check for storm-pars
if(EXISTS "${storm_DIR}/lib/libstorm-pars.dylib") if(EXISTS "${storm_DIR}/lib/libstorm-pars.dylib")
set(HAVE_STORM_PARS TRUE) set(HAVE_STORM_PARS TRUE)
@ -20,10 +25,6 @@ else()
set(HAVE_STORM_DFT FALSE) set(HAVE_STORM_DFT FALSE)
endif() endif()
# Set configuration
set(STORM_DIR ${storm_DIR})
set(STORM_VERSION ${storm_VERSION})
if(HAVE_STORM_PARS) if(HAVE_STORM_PARS)
set(HAVE_STORM_PARS_BOOL "True") set(HAVE_STORM_PARS_BOOL "True")
else() else()
@ -48,7 +49,4 @@ else()
set(STORM_CLN_RF_BOOL "False") set(STORM_CLN_RF_BOOL "False")
endif() endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.py.in ${CMAKE_CURRENT_BINARY_DIR}/generated/config.py @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.py.in ${CMAKE_CURRENT_BINARY_DIR}/generated/config.py @ONLY)
Loading…
Cancel
Save