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.

500 lines
19 KiB

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