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.

516 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. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
  236. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprefetch-loop-arrays")
  237. set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic")
  238. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
  239. endif ()
  240. if (STORM_USE_THIN_LTO)
  241. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto=thin")
  242. message(STATUS "Storm - Enabling link-time optimizations using ThinLTO.")
  243. elseif (STORM_USE_LTO)
  244. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
  245. # Fix for problems that occurred when using LTO on gcc. This should be removed when it
  246. # is not needed anymore as it makes the the already long link-step potentially longer.
  247. if (STORM_COMPILER_GCC)
  248. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto-partition=none")
  249. endif()
  250. message(STATUS "Storm - Enabling link-time optimizations.")
  251. else()
  252. message(STATUS "Storm - Disabling link-time optimizations.")
  253. endif()
  254. # In release mode, we turn on even more optimizations if we do not have to provide a portable binary.
  255. if (NOT STORM_PORTABLE)
  256. set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native")
  257. endif ()
  258. if (STORM_DEVELOPER)
  259. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
  260. if (STORM_ALLWARNINGS)
  261. if (CLANG)
  262. # Enable strictly every warning and then disable selected ones.
  263. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything")
  264. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++98-compat -Wno-c++98-compat-pedantic")
  265. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast")
  266. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reserved-id-macro")
  267. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-newline-eof")
  268. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-documentation")
  269. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-weak-vtables")
  270. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-global-constructors")
  271. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-exit-time-destructors")
  272. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch-enum")
  273. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-covered-switch-default")
  274. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-padded")
  275. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-float-equal")
  276. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedef")
  277. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-variable-declarations")
  278. endif ()
  279. else ()
  280. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
  281. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
  282. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
  283. endif ()
  284. else()
  285. set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer")
  286. endif()
  287. # Test compiler by compiling small program.
  288. CHECK_C_SOURCE_COMPILES("
  289. #include <stdio.h>
  290. int main() {
  291. const char* text = \"A Storm is coming.\";
  292. return 0;
  293. }"
  294. COMPILER_C_WORKS
  295. )
  296. CHECK_CXX_SOURCE_COMPILES("
  297. #include <string>
  298. int main() {
  299. const std::string text = \"A Storm is coming.\";
  300. return 0;
  301. }"
  302. COMPILER_CXX_WORKS
  303. )
  304. if ((NOT COMPILER_CXX_WORKS) OR (NOT COMPILER_C_WORKS))
  305. if (MACOSX)
  306. message(FATAL_ERROR "The C/C++ compiler is not configured correctly.\nTry running 'xcode-select --install'.")
  307. else()
  308. message(FATAL_ERROR "The C/C++ compiler is not configured correctly.")
  309. endif()
  310. endif()
  311. #############################################################
  312. ##
  313. ## RPATH settings
  314. ##
  315. #############################################################
  316. # don't skip the full RPATH for the build tree
  317. SET(CMAKE_SKIP_BUILD_RPATH FALSE)
  318. # when building, don't use the install RPATH already (but only when installing)
  319. SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  320. # the RPATH to be used when installing
  321. SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
  322. # don't add the automatically determined parts of the RPATH
  323. # which point to directories outside the build tree to the install RPATH
  324. SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
  325. #############################################################
  326. ##
  327. ## Generator specific settings
  328. ##
  329. #############################################################
  330. if ("${CMAKE_GENERATOR}" STREQUAL "Xcode")
  331. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
  332. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
  333. endif()
  334. # Display information about build configuration.
  335. message(STATUS "Storm - Using compiler configuration ${STORM_COMPILER_ID} ${STORM_COMPILER_VERSION}.")
  336. if (STORM_DEVELOPER)
  337. message(STATUS "Storm - CXX Flags: ${CMAKE_CXX_FLAGS}")
  338. message(STATUS "Storm - CXX Debug Flags: ${CMAKE_CXX_FLAGS_DEBUG}")
  339. message(STATUS "Storm - CXX Release Flags: ${CMAKE_CXX_FLAGS_RELEASE}")
  340. message(STATUS "Storm - Build type: ${CMAKE_BUILD_TYPE}")
  341. endif()
  342. #############################################################
  343. #############################################################
  344. ##
  345. ## Inclusion of required libraries
  346. ##
  347. #############################################################
  348. #############################################################
  349. #############################################################
  350. ##
  351. ## Include the targets for non-system resources
  352. ##
  353. #############################################################
  354. # In 3rdparty, targets are being defined that can be used
  355. # in the the system does not have a library
  356. include(resources/3rdparty/CMakeLists.txt)
  357. # Include Doxygen
  358. include(resources/doxygen/CMakeLists.txt)
  359. #############################################################
  360. ##
  361. ## CMake-generated Config File for Storm
  362. ##
  363. #############################################################
  364. # try to obtain the current version from git.
  365. include(GetGitRevisionDescription)
  366. get_git_head_revision(STORM_VERSION_REFSPEC STORM_VERSION_GIT_HASH)
  367. git_describe(STORM_GIT_VERSION_STRING)
  368. # parse the git tag into variables
  369. # start with major.minor.patch
  370. string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)$" STORM_VERSION_MATCH "${STORM_GIT_VERSION_STRING}")
  371. set(STORM_VERSION_MAJOR "${CMAKE_MATCH_1}")
  372. set(STORM_VERSION_MINOR "${CMAKE_MATCH_2}")
  373. set(STORM_VERSION_PATCH "${CMAKE_MATCH_3}")
  374. set(STORM_GIT_VERSION_REST "${CMAKE_MATCH_4}")
  375. # parse rest of the form (-label)-commitsahead-hash(-appendix)
  376. string(REGEX MATCH "^(\\-([a-z][a-z0-9\\.]+))?\\-([0-9]+)\\-([a-z0-9]+)(\\-.*)?$" STORM_VERSION_REST_MATCH "${STORM_GIT_VERSION_REST}")
  377. set(STORM_VERSION_LABEL "${CMAKE_MATCH_2}") # might be empty
  378. set(STORM_VERSION_COMMITS_AHEAD "${CMAKE_MATCH_3}")
  379. set(STORM_VERSION_TAG_HASH "${CMAKE_MATCH_4}") # is not used
  380. set(STORM_VERSION_APPENDIX "${CMAKE_MATCH_5}") # might be empty
  381. # check whether the git version lookup failed
  382. if (STORM_GIT_VERSION_STRING MATCHES "NOTFOUND")
  383. set(STORM_VERSION_SOURCE "VersionSource::Static")
  384. set(STORM_VERSION_COMMITS_AHEAD 0)
  385. set(STORM_VERSION_DIRTY boost::none)
  386. include(version.cmake)
  387. message(WARNING "Storm - Git version information not available, statically assuming version ${STORM_VERSION_MAJOR}.${STORM_VERSION_MINOR}.${STORM_VERSION_PATCH}.")
  388. else()
  389. set(STORM_VERSION_SOURCE "VersionSource::Git")
  390. if ("${STORM_VERSION_APPENDIX}" MATCHES "^.*dirty.*$")
  391. set(STORM_VERSION_DIRTY "true")
  392. else()
  393. set(STORM_VERSION_DIRTY "false")
  394. endif()
  395. endif()
  396. # check whether there is a label ('alpha', 'pre', etc.)
  397. if ("${STORM_VERSION_LABEL}" STREQUAL "")
  398. set(STORM_VERSION_LABEL_STRING "")
  399. else()
  400. set(STORM_VERSION_LABEL_STRING "-${STORM_VERSION_LABEL}")
  401. endif()
  402. # check for development version with commits ahead of latest tag
  403. if(STORM_VERSION_COMMITS_AHEAD)
  404. set(STORM_VERSION_DEV "true")
  405. set(STORM_VERSION_DEV_STRING " (dev)")
  406. if ("${STORM_VERSION_LABEL}" STREQUAL "")
  407. # increase patch number to indicate newer version
  408. MATH(EXPR STORM_VERSION_DEV_PATCH "${STORM_VERSION_PATCH}+1")
  409. else()
  410. set(STORM_VERSION_DEV_PATCH "${STORM_VERSION_PATCH}")
  411. endif()
  412. else()
  413. set(STORM_VERSION_COMMITS_AHEAD 0)
  414. set(STORM_VERSION_DEV "false")
  415. set(STORM_VERSION_DEV_STRING "")
  416. set(STORM_VERSION_DEV_PATCH ${STORM_VERSION_PATCH})
  417. endif()
  418. # set final Storm version
  419. set(STORM_VERSION "${STORM_VERSION_MAJOR}.${STORM_VERSION_MINOR}.${STORM_VERSION_DEV_PATCH}")
  420. set(STORM_VERSION_STRING "${STORM_VERSION}${STORM_VERSION_LABEL_STRING}${STORM_VERSION_DEV_STRING}")
  421. 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}).")
  422. # Configure a header file to pass some of the CMake settings to the source code
  423. configure_file (
  424. "${PROJECT_SOURCE_DIR}/storm-config.h.in"
  425. "${PROJECT_BINARY_DIR}/include/storm-config.h"
  426. )
  427. # Configure a source file to pass the Storm version to the source code
  428. configure_file (
  429. "${PROJECT_SOURCE_DIR}/storm-version.cpp.in"
  430. "${PROJECT_SOURCE_DIR}/src/storm/utility/storm-version.cpp"
  431. )
  432. set(STORM_GENERATED_SOURCES "${PROJECT_BINARY_DIR}/src/storm/utility/storm-version.cpp")
  433. # Add the binary dir include directory for storm-config.h
  434. include_directories("${PROJECT_BINARY_DIR}/include")
  435. include(CTest)
  436. # Compiles all tests
  437. add_custom_target(tests)
  438. # Compiles and runs all tests
  439. add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
  440. set(CMAKE_CTEST_COMMAND_VERBOSE ${CMAKE_CTEST_COMMAND} -V)
  441. add_custom_target(check-verbose COMMAND ${CMAKE_CTEST_COMMAND_VERBOSE})
  442. add_dependencies(check tests)
  443. add_dependencies(check-verbose tests)
  444. set(STORM_TARGETS "")
  445. add_subdirectory(src)
  446. include(export)
  447. install(FILES ${CMAKE_BINARY_DIR}/stormConfig.install.cmake DESTINATION ${CMAKE_INSTALL_DIR} RENAME stormConfig.cmake)
  448. install(FILES ${CMAKE_BINARY_DIR}/stormConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_DIR})
  449. install(EXPORT storm_Targets FILE stormTargets.cmake DESTINATION ${CMAKE_INSTALL_DIR})
  450. include(StormCPackConfig.cmake)