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.

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