You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.2 KiB

  1. cmake_minimum_required(VERSION 3.0.0)
  2. project(pystorm)
  3. option(STORMPY_DISABLE_SIGNATURE_DOC "disables the signature in the documentation" ON)
  4. find_package(storm REQUIRED)
  5. add_subdirectory(resources/pybind11)
  6. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/generated/config.h)
  7. message(STATUS "STORM-DIR: ${storm_DIR}")
  8. set(STORMPY_LIB_DIR "${CMAKE_SOURCE_DIR}/lib/stormpy" CACHE STRING "Sets the storm library dir")
  9. function(stormpy_module NAME)
  10. # second, optional argument is LIBRARY_OUTPUT_DIRECTORY,
  11. # defaults to subdir with module name
  12. # third, optional argument are ADDITIONAL_LIBRARIES
  13. # fourth, optional argument are ADDITIONAL_INCLUDES
  14. if(ARGC GREATER 1)
  15. set(LIB_PATH "${ARGV1}")
  16. else()
  17. set(LIB_PATH "${STORMPY_LIB_DIR}/${NAME}")
  18. endif()
  19. file(GLOB_RECURSE "STORM_${NAME}_SOURCES" "${CMAKE_CURRENT_SOURCE_DIR}/src/${NAME}/*.cpp")
  20. pybind11_add_module(${NAME} "${CMAKE_CURRENT_SOURCE_DIR}/src/mod_${NAME}.cpp" ${STORM_${NAME}_SOURCES})
  21. if(ARGC GREATER 2)
  22. # Additional libraries
  23. target_include_directories(${NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${storm_INCLUDE_DIR} ${ARGV3} ${CMAKE_CURRENT_BINARY_DIR}/src/generated)
  24. target_link_libraries(${NAME} PRIVATE storm ${ARGV2})
  25. else()
  26. target_include_directories(${NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${storm_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src/generated)
  27. target_link_libraries(${NAME} PRIVATE storm)
  28. endif()
  29. # setup.py will override this (because pip may want a different install
  30. # path), but also specifying it here has the advantage that invoking cmake
  31. # manually uses the correct path if the default is used (i.e. the
  32. # STORMPY_LIB_DIR hardcoded above)
  33. set_target_properties(${NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${LIB_PATH}")
  34. endfunction(stormpy_module)
  35. stormpy_module(core "${STORMPY_LIB_DIR}")
  36. stormpy_module(info)
  37. stormpy_module(logic)
  38. stormpy_module(storage)
  39. stormpy_module(utility)
  40. if(HAVE_STORM_PARS)
  41. stormpy_module(pars "${STORMPY_LIB_DIR}/pars" storm-pars "${storm-pars_INCLUDE_DIR}")
  42. endif()
  43. if(HAVE_STORM_DFT)
  44. stormpy_module(dft "${STORMPY_LIB_DIR}/dft" storm-dft "${storm-dft_INCLUDE_DIR}")
  45. endif()