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.

53 lines
2.1 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. set(STORMPY_LIB_DIR "${CMAKE_SOURCE_DIR}/lib/stormpy" CACHE STRING "Sets the storm library dir")
  8. function(stormpy_module NAME)
  9. # second, optional argument is LIBRARY_OUTPUT_DIRECTORY,
  10. # defaults to subdir with module name
  11. # third, optional argument are ADDITIONAL_LIBRARIES
  12. # fourth, optional argument are ADDITIONAL_INCLUDES
  13. if(ARGC GREATER 1)
  14. set(LIB_PATH "${ARGV1}")
  15. else()
  16. set(LIB_PATH "${STORMPY_LIB_DIR}/${NAME}")
  17. endif()
  18. file(GLOB_RECURSE "STORM_${NAME}_SOURCES" "${CMAKE_CURRENT_SOURCE_DIR}/src/${NAME}/*.cpp")
  19. pybind11_add_module(${NAME} "${CMAKE_CURRENT_SOURCE_DIR}/src/mod_${NAME}.cpp" ${STORM_${NAME}_SOURCES})
  20. if(ARGC GREATER 2)
  21. # Additional libraries
  22. target_include_directories(${NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${storm_INCLUDE_DIR} ${ARGV3} ${CMAKE_CURRENT_BINARY_DIR}/src/generated)
  23. target_link_libraries(${NAME} PRIVATE storm ${ARGV2})
  24. else()
  25. target_include_directories(${NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${storm_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src/generated)
  26. target_link_libraries(${NAME} PRIVATE storm)
  27. endif()
  28. # setup.py will override this (because pip may want a different install
  29. # path), but also specifying it here has the advantage that invoking cmake
  30. # manually uses the correct path if the default is used (i.e. the
  31. # STORMPY_LIB_DIR hardcoded above)
  32. set_target_properties(${NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${LIB_PATH}")
  33. endfunction(stormpy_module)
  34. stormpy_module(core "${STORMPY_LIB_DIR}")
  35. stormpy_module(info)
  36. stormpy_module(expressions)
  37. stormpy_module(logic)
  38. stormpy_module(storage)
  39. stormpy_module(utility)
  40. if(HAVE_STORM_DFT)
  41. stormpy_module(dft "${STORMPY_LIB_DIR}/dft" storm-dft "${storm-dft_INCLUDE_DIR}")
  42. endif()