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.

73 lines
3.5 KiB

  1. file(GLOB_RECURSE ALL_FILES ${PROJECT_SOURCE_DIR}/src/storm/*.h ${PROJECT_SOURCE_DIR}/src/storm/*.cpp)
  2. register_source_groups_from_filestructure("${ALL_FILES}" storm)
  3. #############################################################
  4. ##
  5. ## Source file aggregation and clustering
  6. ##
  7. #############################################################
  8. file(GLOB_RECURSE STORM_HEADERS ${PROJECT_SOURCE_DIR}/src/storm/*.h)
  9. file(GLOB_RECURSE STORM_SOURCES_WITHOUT_MAIN ${PROJECT_SOURCE_DIR}/src/storm/*/*.cpp)
  10. file(GLOB_RECURSE STORM_MAIN_FILE ${PROJECT_SOURCE_DIR}/src/storm/storm.cpp)
  11. # Additional include files like the storm-config.h
  12. file(GLOB_RECURSE STORM_BUILD_HEADERS ${PROJECT_BINARY_DIR}/include/*.h)
  13. set(STORM_LIB_SOURCES ${STORM_SOURCES_WITHOUT_MAIN})
  14. set(STORM_LIB_HEADERS ${STORM_HEADERS})
  15. set(STORM_MAIN_SOURCES ${STORM_MAIN_FILE})
  16. # Add custom additional include or link directories
  17. if (ADDITIONAL_INCLUDE_DIRS)
  18. message(STATUS "storm - Using additional include directories ${ADDITIONAL_INCLUDE_DIRS}")
  19. include_directories(${ADDITIONAL_INCLUDE_DIRS})
  20. endif(ADDITIONAL_INCLUDE_DIRS)
  21. if (ADDITIONAL_LINK_DIRS)
  22. message(STATUS "storm - Using additional link directories ${ADDITIONAL_LINK_DIRS}")
  23. link_directories(${ADDITIONAL_LINK_DIRS})
  24. endif(ADDITIONAL_LINK_DIRS)
  25. # Disable Debug compiler flags for PrismParser to lessen memory consumption during compilation
  26. SET_SOURCE_FILES_PROPERTIES(${PROJECT_SOURCE_DIR}/src/storm/parser/PrismParser.cpp PROPERTIES COMPILE_FLAGS -g0)
  27. ###############################################################################
  28. ##
  29. ## Binary creation (All link_directories() calls must be made before this point.)
  30. ##
  31. ###############################################################################
  32. # Create libstorm.
  33. add_library(storm SHARED ${STORM_LIB_SOURCES} ${STORM_LIB_HEADERS})
  34. # Remove define symbol for shared libstorm.
  35. set_target_properties(storm PROPERTIES DEFINE_SYMBOL "")
  36. add_dependencies(storm resources)
  37. target_link_libraries(storm PUBLIC ${STORM_DEP_TARGETS} ${STORM_DEP_IMP_TARGETS} ${STORM_LINK_LIBRARIES})
  38. list(APPEND STORM_TARGETS storm)
  39. set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE)
  40. # Create storm.
  41. add_executable(storm-main ${STORM_MAIN_SOURCES} ${STORM_MAIN_HEADERS})
  42. target_link_libraries(storm-main storm)
  43. set_target_properties(storm-main PROPERTIES OUTPUT_NAME "storm")
  44. # Install storm headers to include directory.
  45. foreach(HEADER ${STORM_LIB_HEADERS})
  46. string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/src/?" "" RELATIVE_HEADER_PATH ${HEADER})
  47. string(REGEX MATCH "(.*)[/\\]" RELATIVE_DIRECTORY ${RELATIVE_HEADER_PATH})
  48. string(REGEX REPLACE "${RELATIVE_DIRECTORY}/?" "" HEADER_FILENAME ${RELATIVE_HEADER_PATH})
  49. add_custom_command(
  50. OUTPUT ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}
  51. COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}
  52. COMMAND ${CMAKE_COMMAND} -E copy ${HEADER} ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}
  53. DEPENDS ${HEADER}
  54. )
  55. list(APPEND STORM_OUTPUT_HEADERS "${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}")
  56. endforeach()
  57. add_custom_target(copy_storm_headers DEPENDS ${STORM_OUTPUT_HEADERS} ${STORM_LIB_HEADERS})
  58. add_dependencies(storm copy_storm_headers)
  59. add_dependencies(storm copy_resources_headers)
  60. # installation
  61. install(TARGETS storm RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
  62. install(TARGETS storm-main RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL)