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.

507 lines
19 KiB

  1. cmake_minimum_required (VERSION 3.2)
  2. cmake_policy(VERSION 3.2)
  3. # When searching for packages, we would like to first search in prefixes specified by <PackageName>_ROOT.
  4. # However, this behavior is only supported since CMake 3.12.
  5. if(POLICY CMP0074)
  6. cmake_policy(SET CMP0074 NEW)
  7. endif()
  8. # Set project name
  9. project (storm CXX C)
  10. # Add base folder for better inclusion paths
  11. include_directories("${PROJECT_SOURCE_DIR}/src")
  12. include_directories("${PROJECT_SOURCE_DIR}/src/storm")
  13. # Add the resources/cmake folder to Module Search Path for FindTBB.cmake
  14. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/resources/cmake/find_modules" "${PROJECT_SOURCE_DIR}/resources/cmake/macros")
  15. include(ExternalProject)
  16. include(RegisterSourceGroup)
  17. include(imported)
  18. include(CheckCXXSourceCompiles)
  19. include(CheckCSourceCompiles)
  20. #############################################################
  21. ##
  22. ## CMake options of Storm
  23. ##
  24. #############################################################
  25. option(STORM_DEVELOPER "Sets whether the development mode is used." OFF)
  26. option(STORM_ALLWARNINGS "Compile with even more warnings" OFF)
  27. option(STORM_USE_LTO "Sets whether link-time optimizations are enabled." ON)
  28. MARK_AS_ADVANCED(STORM_USE_LTO)
  29. option(STORM_PORTABLE "Sets whether a build needs to be portable." OFF)
  30. MARK_AS_ADVANCED(STORM_PORTABLE)
  31. # Force POPCNT is helpful for portable code targetting platforms with SSE4.2 operation support.
  32. option(STORM_FORCE_POPCNT "Sets whether the popcnt instruction is forced to be used (advanced)." OFF)
  33. MARK_AS_ADVANCED(STORM_FORCE_POPCNT)
  34. option(USE_BOOST_STATIC_LIBRARIES "Sets whether the Boost libraries should be linked statically." OFF)
  35. option(STORM_USE_INTELTBB "Sets whether the Intel TBB libraries should be used." OFF)
  36. option(STORM_USE_GUROBI "Sets whether Gurobi should be used." OFF)
  37. set(STORM_CARL_DIR_HINT "" CACHE STRING "A hint where the preferred CArL version can be found. If CArL cannot be found there, it is searched in the OS's default paths.")
  38. option(STORM_FORCE_SHIPPED_CARL "Sets whether the shipped version of carl is to be used no matter whether carl is found or not." OFF)
  39. MARK_AS_ADVANCED(STORM_FORCE_SHIPPED_CARL)
  40. option(USE_SMTRAT "Sets whether SMT-RAT should be included." OFF)
  41. option(USE_HYPRO "Sets whether HyPro should be included." OFF)
  42. option(XML_SUPPORT "Sets whether xml based format parsing should be included." ON)
  43. option(FORCE_COLOR "Force color output" OFF)
  44. mark_as_advanced(FORCE_COLOR)
  45. option(STORM_COMPILE_WITH_CCACHE "Compile using CCache [if found]" ON)
  46. mark_as_advanced(STORM_COMPILE_WITH_CCACHE)
  47. option(STORM_LOG_DISABLE_DEBUG "Disable log and trace message support" OFF)
  48. option(STORM_USE_CLN_EA "Sets whether CLN instead of GMP numbers should be used for exact arithmetic." OFF)
  49. export_option(STORM_USE_CLN_EA)
  50. option(STORM_USE_CLN_RF "Sets whether CLN instead of GMP numbers should be used for rational functions." ON)
  51. export_option(STORM_USE_CLN_RF)
  52. option(BUILD_SHARED_LIBS "Build the Storm library dynamically" OFF)
  53. option(STORM_DEBUG_CUDD "Build CUDD in debug mode." OFF)
  54. MARK_AS_ADVANCED(STORM_DEBUG_CUDD)
  55. set(BOOST_ROOT "" CACHE STRING "A hint to the root directory of Boost (optional).")
  56. set(GUROBI_ROOT "" CACHE STRING "A hint to the root directory of Gurobi (optional).")
  57. set(Z3_ROOT "" CACHE STRING "A hint to the root directory of Z3 (optional).")
  58. set(CUDA_ROOT "" CACHE STRING "The hint to the root directory of CUDA (optional).")
  59. set(MSAT_ROOT "" CACHE STRING "The hint to the root directory of MathSAT (optional).")
  60. set(STORM_QVBS_ROOT "" CACHE STRING "The hint to the root directory of the Quantitative Verification Benchmark Set (QVBS) (optional).")
  61. set(ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "Additional directories added to the include directories.")
  62. set(ADDITIONAL_LINK_DIRS "" CACHE STRING "Additional directories added to the link directories.")
  63. set(USE_XERCESC ${XML_SUPPORT})
  64. mark_as_advanced(USE_XERCESC)
  65. # Set some CMAKE Variables as advanced
  66. mark_as_advanced(CMAKE_OSX_ARCHITECTURES)
  67. mark_as_advanced(CMAKE_OSX_SYSROOT)
  68. mark_as_advanced(CMAKE_OSX_DEPLOYMENT_TARGET)
  69. # Offer the user the choice of overriding the installation directories
  70. set(INCLUDE_INSTALL_DIR include/ CACHE PATH "Installation directory for header files" )
  71. set(LIB_INSTALL_DIR lib/ CACHE PATH "Installation directory for libraries")
  72. #set(SYSCONFIG_INSTALL_DIR etc/carl/ CACHE PATH "Installation for system configuration files)
  73. set(BIN_INSTALL_DIR lib/ CACHE PATH "Installation directory for executables")
  74. # Install dir for cmake files (info for other libraries that include Storm)
  75. set(DEF_INSTALL_CMAKE_DIR "lib/CMake/storm")
  76. set(CMAKE_INSTALL_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
  77. # Add CMake install prefix
  78. foreach(p LIB BIN INCLUDE CMAKE)
  79. set(var ${p}_INSTALL_DIR)
  80. if(NOT IS_ABSOLUTE "${${var}}")
  81. set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
  82. endif()
  83. endforeach()
  84. message(STATUS "Storm - CMake install dir: ${CMAKE_INSTALL_DIR}")
  85. # If the STORM_DEVELOPER option was turned on, by default we target a debug version, otherwise a release version.
  86. if (STORM_DEVELOPER)
  87. if (NOT CMAKE_BUILD_TYPE)
  88. set(CMAKE_BUILD_TYPE "DEBUG")
  89. endif()
  90. add_definitions(-DSTORM_DEV)
  91. else()
  92. set(STORM_LOG_DISABLE_DEBUG ON)
  93. if (NOT CMAKE_BUILD_TYPE)
  94. set(CMAKE_BUILD_TYPE "RELEASE")
  95. endif()
  96. endif()
  97. message(STATUS "Storm - Building ${CMAKE_BUILD_TYPE} version.")
  98. if(STORM_COMPILE_WITH_CCACHE)
  99. find_program(CCACHE_FOUND ccache)
  100. mark_as_advanced(CCACHE_FOUND)
  101. if(CCACHE_FOUND)
  102. message(STATUS "Storm - Using ccache")
  103. set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
  104. set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
  105. else()
  106. message(STATUS "Storm - Could not find ccache.")
  107. endif()
  108. else()
  109. message(STATUS "Storm - Disabled use of ccache.")
  110. endif()
  111. # Directory for test resources.
  112. set(STORM_TEST_RESOURCES_DIR "${PROJECT_SOURCE_DIR}/resources/examples/testfiles")
  113. # Auto-detect operating system.
  114. set(MACOSX 0)
  115. set(LINUX 0)
  116. if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  117. # Mac OS
  118. set(OPERATING_SYSTEM "Mac OS")
  119. set(MACOSX 1)
  120. elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  121. # Linux
  122. set(OPERATING_SYSTEM "Linux")
  123. set(LINUX 1)
  124. elseif(WIN32)
  125. # Assuming Windows.
  126. set(OPERATING_SYSTEM "Windows")
  127. else()
  128. message(WARNING "We are unsure about your operating system.")
  129. set(OPERATING_SYSTEM "Linux")
  130. set(LINUX 1)
  131. ENDIF()
  132. message(STATUS "Storm - Detected operating system ${OPERATING_SYSTEM}.")
  133. set(DYNAMIC_EXT ".so")
  134. set(STATIC_EXT ".a")
  135. set(LIB_PREFIX "lib")
  136. if(MACOSX)
  137. set(DYNAMIC_EXT ".dylib")
  138. set(STATIC_EXT ".a")
  139. set(LIB_PREFIX "lib")
  140. elseif (WIN32)
  141. set(DYNAMIC_EXT ".dll")
  142. set(STATIC_EXT ".lib")
  143. set(LIB_PREFIX "")
  144. endif()
  145. message(STATUS "Storm - Assuming extension for shared libraries: ${DYNAMIC_EXT}")
  146. message(STATUS "Storm - Assuming extension for static libraries: ${STATIC_EXT}")
  147. if(BUILD_SHARED_LIBS)
  148. set(LIB_EXT ${DYNAMIC_EXT})
  149. message(STATUS "Storm - Build dynamic libraries.")
  150. else()
  151. set(LIB_EXT ${STATIC_EXT})
  152. message(STATUS "Storm - Build static libraries.")
  153. endif()
  154. #############################################################
  155. ##
  156. ## Compiler detection and initial configuration
  157. ##
  158. #############################################################
  159. if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  160. # using Clang
  161. if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2)
  162. message(FATAL_ERROR "Clang version must be at least 3.2.")
  163. endif()
  164. set(STORM_COMPILER_CLANG ON)
  165. set(CLANG ON)
  166. set(STORM_COMPILER_ID "clang")
  167. elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
  168. # using AppleClang
  169. if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3)
  170. message(FATAL_ERROR "AppleClang version must be at least 7.3.")
  171. endif()
  172. set(STORM_COMPILER_APPLECLANG ON)
  173. set(CLANG ON)
  174. set(STORM_COMPILER_ID "AppleClang")
  175. set(CMAKE_MACOSX_RPATH ON)
  176. elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  177. set(GCC ON)
  178. # using GCC
  179. if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
  180. message(FATAL_ERROR "gcc version must be at least 5.0.")
  181. endif()
  182. set(STORM_COMPILER_GCC ON)
  183. set(STORM_COMPILER_ID "gcc")
  184. elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
  185. message(FATAL_ERROR "Intel compiler is currently not supported.")
  186. elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
  187. message(FATAL_ERROR "Visual Studio compiler is currently not supported.")
  188. endif()
  189. set(STORM_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
  190. if(CCACHE_FOUND)
  191. set(STORM_COMPILER_ID "${STORM_COMPILER_ID} (ccache)")
  192. endif()
  193. #############################################################
  194. ##
  195. ## Compiler independent settings
  196. ##
  197. #############################################################
  198. if (STORM_FORCE_POPCNT)
  199. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")
  200. endif()
  201. # TODO: remove forcing the old version of optional as soon as the related Spirit bug is fixed:
  202. # https://svn.boost.org/trac/boost/ticket/12349
  203. # Fix thanks to: https://github.com/freeorion/freeorion/issues/777
  204. add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE -DBOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL)
  205. #############################################################
  206. ##
  207. ## Compiler specific settings
  208. ##
  209. #############################################################
  210. if (STORM_COMPILER_CLANG OR STORM_COMPILER_APPLECLANG)
  211. if(FORCE_COLOR)
  212. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
  213. endif()
  214. if (LINUX)
  215. set(CLANG_STDLIB libstdc++)
  216. else()
  217. set(CLANG_STDLIB libc++)
  218. endif()
  219. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -stdlib=${CLANG_STDLIB} -ftemplate-depth=1024")
  220. set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
  221. if(LINUX)
  222. set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic")
  223. set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
  224. elseif(MACOSX)
  225. set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export_dynamic")
  226. set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-export_dynamic")
  227. endif()
  228. elseif (STORM_COMPILER_GCC)
  229. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
  230. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprefetch-loop-arrays")
  231. set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic")
  232. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
  233. endif ()
  234. if (STORM_USE_LTO)
  235. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
  236. # Fix for problems that occurred when using LTO on gcc. This should be removed when it
  237. # is not needed anymore as it makes the the already long link-step potentially longer.
  238. if (STORM_COMPILER_GCC)
  239. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto-partition=none")
  240. endif()
  241. message(STATUS "Storm - Enabling link-time optimizations.")
  242. else()
  243. message(STATUS "Storm - Disabling link-time optimizations.")
  244. endif()
  245. # In release mode, we turn on even more optimizations if we do not have to provide a portable binary.
  246. if (NOT STORM_PORTABLE)
  247. set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native")
  248. endif ()
  249. if (STORM_DEVELOPER)
  250. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
  251. if (STORM_ALLWARNINGS)
  252. if (CLANG)
  253. # Enable strictly every warning and then disable selected ones.
  254. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything")
  255. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++98-compat -Wno-c++98-compat-pedantic")
  256. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast")
  257. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reserved-id-macro")
  258. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-newline-eof")
  259. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-documentation")
  260. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-weak-vtables")
  261. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-global-constructors")
  262. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-exit-time-destructors")
  263. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch-enum")
  264. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-covered-switch-default")
  265. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-padded")
  266. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-float-equal")
  267. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedef")
  268. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-variable-declarations")
  269. endif ()
  270. else ()
  271. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
  272. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
  273. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
  274. endif ()
  275. else()
  276. set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer")
  277. endif()
  278. # Test compiler by compiling small program.
  279. CHECK_C_SOURCE_COMPILES("
  280. #include <stdio.h>
  281. int main() {
  282. const char* text = \"A Storm is coming.\";
  283. return 0;
  284. }"
  285. COMPILER_C_WORKS
  286. )
  287. CHECK_CXX_SOURCE_COMPILES("
  288. #include <string>
  289. int main() {
  290. const std::string text = \"A Storm is coming.\";
  291. return 0;
  292. }"
  293. COMPILER_CXX_WORKS
  294. )
  295. if ((NOT COMPILER_CXX_WORKS) OR (NOT COMPILER_C_WORKS))
  296. if (MACOSX)
  297. message(FATAL_ERROR "The C/C++ compiler is not configured correctly.\nTry running 'xcode-select --install'.")
  298. else()
  299. message(FATAL_ERROR "The C/C++ compiler is not configured correctly.")
  300. endif()
  301. endif()
  302. #############################################################
  303. ##
  304. ## RPATH settings
  305. ##
  306. #############################################################
  307. # don't skip the full RPATH for the build tree
  308. SET(CMAKE_SKIP_BUILD_RPATH FALSE)
  309. # when building, don't use the install RPATH already (but only when installing)
  310. SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  311. # the RPATH to be used when installing
  312. SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
  313. # don't add the automatically determined parts of the RPATH
  314. # which point to directories outside the build tree to the install RPATH
  315. SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
  316. #############################################################
  317. ##
  318. ## Generator specific settings
  319. ##
  320. #############################################################
  321. if ("${CMAKE_GENERATOR}" STREQUAL "Xcode")
  322. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
  323. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
  324. endif()
  325. # Display information about build configuration.
  326. message(STATUS "Storm - Using compiler configuration ${STORM_COMPILER_ID} ${STORM_COMPILER_VERSION}.")
  327. if (STORM_DEVELOPER)
  328. message(STATUS "Storm - CXX Flags: ${CMAKE_CXX_FLAGS}")
  329. message(STATUS "Storm - CXX Debug Flags: ${CMAKE_CXX_FLAGS_DEBUG}")
  330. message(STATUS "Storm - CXX Release Flags: ${CMAKE_CXX_FLAGS_RELEASE}")
  331. message(STATUS "Storm - Build type: ${CMAKE_BUILD_TYPE}")
  332. endif()
  333. #############################################################
  334. #############################################################
  335. ##
  336. ## Inclusion of required libraries
  337. ##
  338. #############################################################
  339. #############################################################
  340. #############################################################
  341. ##
  342. ## Include the targets for non-system resources
  343. ##
  344. #############################################################
  345. # In 3rdparty, targets are being defined that can be used
  346. # in the the system does not have a library
  347. include(resources/3rdparty/CMakeLists.txt)
  348. # Include Doxygen
  349. include(resources/doxygen/CMakeLists.txt)
  350. #############################################################
  351. ##
  352. ## CMake-generated Config File for Storm
  353. ##
  354. #############################################################
  355. # try to obtain the current version from git.
  356. include(GetGitRevisionDescription)
  357. get_git_head_revision(STORM_VERSION_REFSPEC STORM_VERSION_GIT_HASH)
  358. git_describe(STORM_GIT_VERSION_STRING)
  359. # parse the git tag into variables
  360. # start with major.minor.patch
  361. string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)$" STORM_VERSION_MATCH "${STORM_GIT_VERSION_STRING}")
  362. set(STORM_VERSION_MAJOR "${CMAKE_MATCH_1}")
  363. set(STORM_VERSION_MINOR "${CMAKE_MATCH_2}")
  364. set(STORM_VERSION_PATCH "${CMAKE_MATCH_3}")
  365. set(STORM_GIT_VERSION_REST "${CMAKE_MATCH_4}")
  366. # parse rest of the form (-label)-commitsahead-hash(-appendix)
  367. string(REGEX MATCH "^(\\-([a-z][a-z0-9\\.]+))?\\-([0-9]+)\\-([a-z0-9]+)(\\-.*)?$" STORM_VERSION_REST_MATCH "${STORM_GIT_VERSION_REST}")
  368. set(STORM_VERSION_LABEL "${CMAKE_MATCH_2}") # might be empty
  369. set(STORM_VERSION_COMMITS_AHEAD "${CMAKE_MATCH_3}")
  370. set(STORM_VERSION_TAG_HASH "${CMAKE_MATCH_4}") # is not used
  371. set(STORM_VERSION_APPENDIX "${CMAKE_MATCH_5}") # might be empty
  372. # check whether the git version lookup failed
  373. if (STORM_GIT_VERSION_STRING MATCHES "NOTFOUND")
  374. set(STORM_VERSION_SOURCE "VersionSource::Static")
  375. set(STORM_VERSION_COMMITS_AHEAD 0)
  376. set(STORM_VERSION_DIRTY boost::none)
  377. include(version.cmake)
  378. message(WARNING "Storm - Git version information not available, statically assuming version ${STORM_VERSION_MAJOR}.${STORM_VERSION_MINOR}.${STORM_VERSION_PATCH}.")
  379. else()
  380. set(STORM_VERSION_SOURCE "VersionSource::Git")
  381. if ("${STORM_VERSION_APPENDIX}" MATCHES "^.*dirty.*$")
  382. set(STORM_VERSION_DIRTY "true")
  383. else()
  384. set(STORM_VERSION_DIRTY "false")
  385. endif()
  386. endif()
  387. # check whether there is a label ('alpha', 'pre', etc.)
  388. if ("${STORM_VERSION_LABEL}" STREQUAL "")
  389. set(STORM_VERSION_LABEL_STRING "")
  390. else()
  391. set(STORM_VERSION_LABEL_STRING "-${STORM_VERSION_LABEL}")
  392. endif()
  393. # check for development version with commits ahead of latest tag
  394. if(STORM_VERSION_COMMITS_AHEAD)
  395. set(STORM_VERSION_DEV "true")
  396. set(STORM_VERSION_DEV_STRING " (dev)")
  397. if ("${STORM_VERSION_LABEL}" STREQUAL "")
  398. # increase patch number to indicate newer version
  399. MATH(EXPR STORM_VERSION_DEV_PATCH "${STORM_VERSION_PATCH}+1")
  400. else()
  401. set(STORM_VERSION_DEV_PATCH "${STORM_VERSION_PATCH}")
  402. endif()
  403. else()
  404. set(STORM_VERSION_COMMITS_AHEAD 0)
  405. set(STORM_VERSION_DEV "false")
  406. set(STORM_VERSION_DEV_STRING "")
  407. set(STORM_VERSION_DEV_PATCH ${STORM_VERSION_PATCH})
  408. endif()
  409. # set final Storm version
  410. set(STORM_VERSION "${STORM_VERSION_MAJOR}.${STORM_VERSION_MINOR}.${STORM_VERSION_DEV_PATCH}")
  411. set(STORM_VERSION_STRING "${STORM_VERSION}${STORM_VERSION_LABEL_STRING}${STORM_VERSION_DEV_STRING}")
  412. message(STATUS "Storm - Version is ${STORM_VERSION_STRING} (version ${STORM_VERSION_MAJOR}.${STORM_VERSION_MINOR}.${STORM_VERSION_PATCH}${STORM_VERSION_LABEL_STRING} + ${STORM_VERSION_COMMITS_AHEAD} commits), building from git: ${STORM_VERSION_GIT_HASH} (dirty: ${STORM_VERSION_DIRTY}).")
  413. # Configure a header file to pass some of the CMake settings to the source code
  414. configure_file (
  415. "${PROJECT_SOURCE_DIR}/storm-config.h.in"
  416. "${PROJECT_BINARY_DIR}/include/storm-config.h"
  417. )
  418. # Configure a source file to pass the Storm version to the source code
  419. configure_file (
  420. "${PROJECT_SOURCE_DIR}/storm-version.cpp.in"
  421. "${PROJECT_SOURCE_DIR}/src/storm/utility/storm-version.cpp"
  422. )
  423. set(STORM_GENERATED_SOURCES "${PROJECT_BINARY_DIR}/src/storm/utility/storm-version.cpp")
  424. # Add the binary dir include directory for storm-config.h
  425. include_directories("${PROJECT_BINARY_DIR}/include")
  426. include(CTest)
  427. # Compiles all tests
  428. add_custom_target(tests)
  429. # Compiles and runs all tests
  430. add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
  431. set(CMAKE_CTEST_COMMAND_VERBOSE ${CMAKE_CTEST_COMMAND} -V)
  432. add_custom_target(check-verbose COMMAND ${CMAKE_CTEST_COMMAND_VERBOSE})
  433. add_dependencies(check tests)
  434. add_dependencies(check-verbose tests)
  435. set(STORM_TARGETS "")
  436. add_subdirectory(src)
  437. include(export)
  438. install(FILES ${CMAKE_BINARY_DIR}/stormConfig.install.cmake DESTINATION ${CMAKE_INSTALL_DIR} RENAME stormConfig.cmake)
  439. install(FILES ${CMAKE_BINARY_DIR}/stormConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_DIR})
  440. install(EXPORT storm_Targets FILE stormTargets.cmake DESTINATION ${CMAKE_INSTALL_DIR})
  441. include(StormCPackConfig.cmake)