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.

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