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.

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