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.

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