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.

732 lines
32 KiB

  1. cmake_minimum_required (VERSION 2.8.6)
  2. # Set project name
  3. project (storm CXX C)
  4. # Add base folder for better inclusion paths
  5. include_directories("${PROJECT_SOURCE_DIR}")
  6. include_directories("${PROJECT_SOURCE_DIR}/src")
  7. # Add the version of Eigen3 in the repository to the include pathes
  8. set(EIGEN3_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/resources/3rdparty/eigen")
  9. include_directories(${EIGEN3_INCLUDE_DIR})
  10. # Add the version of GMM in the repository to the include pathes
  11. set(GMMXX_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/resources/3rdparty/gmm-4.2/include")
  12. include_directories(${GMMXX_INCLUDE_DIR})
  13. #############################################################
  14. ##
  15. ## CMake options of StoRM
  16. ##
  17. #############################################################
  18. option(STORM_DEBUG "Sets whether the DEBUG mode is used" ON)
  19. option(STORM_USE_POPCNT "Sets whether the popcnt instruction is going to be used." ON)
  20. option(USE_BOOST_STATIC_LIBRARIES "Sets whether the Boost libraries should be linked statically." ON)
  21. option(STORM_USE_INTELTBB "Sets whether the Intel TBB libraries should be used." OFF)
  22. option(STORM_USE_COTIRE "Sets whether Cotire should be used (for building precompiled headers)." OFF)
  23. option(LINK_LIBCXXABI "Sets whether libc++abi should be linked." OFF)
  24. option(USE_LIBCXX "Sets whether the standard library is libc++." OFF)
  25. set(GUROBI_ROOT "" CACHE STRING "The root directory of Gurobi (if available).")
  26. set(CUDA_ROOT "" CACHE STRING "The root directory of CUDA.")
  27. set(MSAT_ROOT "" CACHE STRING "The root directory of MathSAT (if available).")
  28. set(ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "Additional directories added to the include directories.")
  29. set(ADDITIONAL_LINK_DIRS "" CACHE STRING "Additional directories added to the link directories.")
  30. set(CUSTOM_BOOST_ROOT "" CACHE STRING "A custom path to the Boost root directory.")
  31. #############################################################
  32. ##
  33. ## Inclusion of required libraries
  34. ##
  35. #############################################################
  36. # Add the resources/cmake folder to Module Search Path for FindTBB.cmake
  37. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/resources/cmake/")
  38. # Boost Option variables
  39. set(Boost_USE_STATIC_LIBS ON)
  40. set(Boost_USE_MULTITHREADED ON)
  41. set(Boost_USE_STATIC_RUNTIME OFF)
  42. # If a custom boost root directory was specified, we set the corresponding hint for the script to find it.
  43. if(CUSTOM_BOOST_ROOT)
  44. message(STATUS "StoRM - Using Boost from CUSTOM_BOOST_ROOT located at ${CUSTOM_BOOST_ROOT}")
  45. set(BOOST_ROOT "${CUSTOM_BOOST_ROOT}")
  46. endif(CUSTOM_BOOST_ROOT)
  47. set(TBB_INSTALL_DIR "${PROJECT_SOURCE_DIR}/resources/3rdparty/tbb42_20140122_merged-win-lin-mac")
  48. find_package(Boost REQUIRED)
  49. find_package(Doxygen REQUIRED)
  50. find_package(Gurobi)
  51. find_package(TBB)
  52. find_package(Threads REQUIRED)
  53. find_package(GMP)
  54. find_package(Z3)
  55. # If the DEBUG option was turned on, we will target a debug version and a release version otherwise.
  56. if (STORM_DEBUG)
  57. set (CMAKE_BUILD_TYPE "DEBUG")
  58. else()
  59. set (CMAKE_BUILD_TYPE "RELEASE")
  60. endif()
  61. message(STATUS "StoRM - Building ${CMAKE_BUILD_TYPE} version.")
  62. if ("${GUROBI_ROOT}" STREQUAL "" AND NOT GUROBI_FOUND)
  63. set(ENABLE_GUROBI OFF)
  64. else()
  65. set(ENABLE_GUROBI ON)
  66. endif()
  67. if ("${CUDA_ROOT}" STREQUAL "")
  68. set(ENABLE_CUDA OFF)
  69. else()
  70. set(ENABLE_CUDA ON)
  71. endif()
  72. if ("${MSAT_ROOT}" STREQUAL "")
  73. set(ENABLE_MSAT OFF)
  74. else()
  75. set(ENABLE_MSAT ON)
  76. endif()
  77. find_package(carl QUIET)
  78. if(carl_FOUND)
  79. message(STATUS "StoRM - Activating CArL.")
  80. set(STORM_HAVE_CARL ON)
  81. endif()
  82. message(STATUS "StoRM - CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
  83. message(STATUS "StoRM - CMAKE_BUILD_TYPE (ENV): $ENV{CMAKE_BUILD_TYPE}")
  84. #############################################################
  85. ##
  86. ## Compiler specific settings and definitions
  87. ##
  88. #############################################################
  89. # Path to the no-strict-aliasing target
  90. set(CONVERSIONHELPER_TARGET "${PROJECT_SOURCE_DIR}/src/utility/ConversionHelper.cpp")
  91. if(CMAKE_COMPILER_IS_GNUCC)
  92. set(STORM_COMPILED_BY "GCC")
  93. # Set standard flags for GCC
  94. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops")
  95. add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
  96. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic")
  97. # Turn on popcnt instruction if desired (yes by default)
  98. if (STORM_USE_POPCNT)
  99. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")
  100. endif(STORM_USE_POPCNT)
  101. # Set the no-strict-aliasing target for GCC
  102. set_source_files_properties(${CONVERSIONHELPER_TARGET} PROPERTIES COMPILE_FLAGS " -fno-strict-aliasing ")
  103. elseif(MSVC)
  104. set(STORM_COMPILED_BY "MSVC")
  105. # required for GMM to compile, ugly error directive in their code
  106. add_definitions(/D_SCL_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS)
  107. # required as the PRCTL Parser bloats object files (COFF) beyond their maximum size (see http://msdn.microsoft.com/en-us/library/8578y171(v=vs.110).aspx)
  108. add_definitions(/bigobj)
  109. # required by GTest and PrismGrammar::createIntegerVariable
  110. add_definitions(/D_VARIADIC_MAX=10)
  111. # Windows.h breaks GMM in gmm_except.h because of its macro definition for min and max
  112. add_definitions(/DNOMINMAX)
  113. # Boost Defs, required for using boost's transform iterator
  114. add_definitions(/DBOOST_RESULT_OF_USE_DECLTYPE)
  115. # since nobody cares at the moment
  116. add_definitions(/wd4250)
  117. # MSVC does not do strict-aliasing, so no option needed
  118. else(CLANG)
  119. set(STORM_COMPILED_BY "Clang (LLVM)")
  120. # As CLANG is not set as a variable, we need to set it in case we have not matched another compiler.
  121. set (CLANG ON)
  122. # Set standard flags for clang
  123. set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops -O3")
  124. if(UNIX AND NOT APPLE AND NOT USE_LIBCXX)
  125. set(CLANG_STDLIB libstdc++)
  126. message(STATUS "StoRM - Linking against libstdc++")
  127. else()
  128. set(CLANG_STDLIB libc++)
  129. message(STATUS "StoRM - Linking against libc++")
  130. # Disable Cotire
  131. set(STORM_USE_COTIRE OFF)
  132. # Set up some Xcode specific settings
  133. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
  134. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
  135. endif()
  136. add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
  137. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=${CLANG_STDLIB} -Wall -pedantic -Wno-unused-variable -ftemplate-depth=1024")
  138. # Turn on popcnt instruction if desired (yes by default)
  139. if (STORM_USE_POPCNT)
  140. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")
  141. endif(STORM_USE_POPCNT)
  142. # Set the no-strict-aliasing target for Clang
  143. set_source_files_properties(${CONVERSIONHELPER_TARGET} PROPERTIES COMPILE_FLAGS " -fno-strict-aliasing ")
  144. endif()
  145. message(STATUS "StoRM - Using Compiler Configuration: ${STORM_COMPILED_BY}")
  146. #############################################################
  147. ##
  148. ## CMake-generated Config File for StoRM
  149. ##
  150. #############################################################
  151. #
  152. # Make a version file containing the current version from git.
  153. #
  154. include(GetGitRevisionDescription)
  155. git_describe_checkout(STORM_GIT_VERSION_STRING)
  156. message(STATUS "STORM_GIT_VERSION_STRING: ${STORM_GIT_VERSION_STRING}")
  157. # Parse the git Tag into variables
  158. string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" STORM_CPP_VERSION_MAJOR "${STORM_GIT_VERSION_STRING}")
  159. string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" STORM_CPP_VERSION_MINOR "${STORM_GIT_VERSION_STRING}")
  160. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" STORM_CPP_VERSION_PATCH "${STORM_GIT_VERSION_STRING}")
  161. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+)\\-.*" "\\1" STORM_CPP_VERSION_COMMITS_AHEAD "${STORM_GIT_VERSION_STRING}")
  162. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-([a-z0-9]+).*" "\\1" STORM_CPP_VERSION_HASH "${STORM_GIT_VERSION_STRING}")
  163. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-[a-z0-9]+\\-(.*)" "\\1" STORM_CPP_VERSION_APPENDIX "${STORM_GIT_VERSION_STRING}")
  164. if ("${STORM_CPP_VERSION_APPENDIX}" MATCHES "^.*dirty.*$")
  165. set(STORM_CPP_VERSION_DIRTY 1)
  166. else()
  167. set(STORM_CPP_VERSION_DIRTY 0)
  168. endif()
  169. message(STATUS "StoRM - Version information: ${STORM_CPP_VERSION_MAJOR}.${STORM_CPP_VERSION_MINOR}.${STORM_CPP_VERSION_PATCH} (${STORM_CPP_VERSION_COMMITS_AHEAD} commits ahead of Tag) build from ${STORM_CPP_VERSION_HASH} (Dirty: ${STORM_CPP_VERSION_DIRTY})")
  170. # Base path for test files
  171. set(STORM_CPP_TESTS_BASE_PATH "${PROJECT_SOURCE_DIR}/test")
  172. # Gurobi Defines
  173. set(STORM_HAVE_GUROBI ${ENABLE_GUROBI})
  174. # CUDA Defines
  175. if (ENABLE_CUDA)
  176. set(STORM_CPP_CUDA_DEF "define")
  177. else()
  178. set(STORM_CPP_CUDA_DEF "undef")
  179. endif()
  180. # glpk defines
  181. set(STORM_HAVE_GLPK 1)
  182. # CUDA Defines
  183. set(STORM_CPP_CUDAFORSTORM_DEF "undef")
  184. # Z3 Defines
  185. set(STORM_HAVE_Z3 ${FOUND_Z3})
  186. # MathSAT Defines
  187. set(STORM_HAVE_MSAT ${ENABLE_MSAT})
  188. # Intel TBB Defines
  189. if (TBB_FOUND AND STORM_USE_INTELTBB)
  190. set(STORM_CPP_INTELTBB_DEF "define")
  191. else()
  192. set(STORM_CPP_INTELTBB_DEF "undef")
  193. endif()
  194. # Configure a header file to pass some of the CMake settings to the source code
  195. configure_file (
  196. "${PROJECT_SOURCE_DIR}/storm-config.h.in"
  197. "${PROJECT_BINARY_DIR}/include/storm-config.h"
  198. )
  199. # Configure a header file to pass the storm version to the source code
  200. configure_file (
  201. "${PROJECT_SOURCE_DIR}/storm-version.cpp.in"
  202. "${PROJECT_SOURCE_DIR}/src/utility/storm-version.cpp"
  203. )
  204. # Add the binary dir include directory for storm-config.h
  205. include_directories("${PROJECT_BINARY_DIR}/include")
  206. #############################################################
  207. ##
  208. ## CUDA Library generation
  209. ##
  210. #############################################################
  211. if(ENABLE_CUDA)
  212. # Test for type alignment
  213. try_run(STORM_CUDA_RUN_RESULT_TYPEALIGNMENT STORM_CUDA_COMPILE_RESULT_TYPEALIGNMENT
  214. ${PROJECT_BINARY_DIR} "${PROJECT_SOURCE_DIR}/cuda/CMakeAlignmentCheck.cpp"
  215. COMPILE_OUTPUT_VARIABLE OUTPUT_TEST_VAR
  216. )
  217. if(NOT STORM_CUDA_COMPILE_RESULT_TYPEALIGNMENT)
  218. message(FATAL_ERROR "StoRM (CudaPlugin) - Could not test type alignment, there was an Error while compiling the file ${PROJECT_SOURCE_DIR}/cuda/CMakeAlignmentCheck.cpp: ${OUTPUT_TEST_VAR}")
  219. elseif(STORM_CUDA_RUN_RESULT_TYPEALIGNMENT EQUAL 0)
  220. message(STATUS "StoRM (CudaPlugin) - Result of Type Alignment Check: OK.")
  221. else()
  222. message(FATAL_ERROR "StoRM (CudaPlugin) - Result of Type Alignment Check: FAILED (Code ${STORM_CUDA_RUN_RESULT_TYPEALIGNMENT})")
  223. endif()
  224. # Test for Float 64bit Alignment
  225. try_run(STORM_CUDA_RUN_RESULT_FLOATALIGNMENT STORM_CUDA_COMPILE_RESULT_FLOATALIGNMENT
  226. ${PROJECT_BINARY_DIR} "${PROJECT_SOURCE_DIR}/cuda/CMakeFloatAlignmentCheck.cpp"
  227. COMPILE_OUTPUT_VARIABLE OUTPUT_TEST_VAR
  228. )
  229. if(NOT STORM_CUDA_COMPILE_RESULT_FLOATALIGNMENT)
  230. message(FATAL_ERROR "StoRM (CudaPlugin) - Could not test float type alignment, there was an Error while compiling the file ${PROJECT_SOURCE_DIR}/cuda/CMakeFloatAlignmentCheck.cpp: ${OUTPUT_TEST_VAR}")
  231. elseif(STORM_CUDA_RUN_RESULT_FLOATALIGNMENT EQUAL 2)
  232. message(STATUS "StoRM (CudaPlugin) - Result of Float Type Alignment Check: 64bit alignment active.")
  233. set(STORM_CUDAPLUGIN_FLOAT_64BIT_ALIGN_DEF "define")
  234. elseif(STORM_CUDA_RUN_RESULT_FLOATALIGNMENT EQUAL 3)
  235. message(STATUS "StoRM (CudaPlugin) - Result of Float Type Alignment Check: 64bit alignment disabled.")
  236. set(STORM_CUDAPLUGIN_FLOAT_64BIT_ALIGN_DEF "undef")
  237. else()
  238. message(FATAL_ERROR "StoRM (CudaPlugin) - Result of Float Type Alignment Check: FAILED (Code ${STORM_CUDA_RUN_RESULT_FLOATALIGNMENT})")
  239. endif()
  240. #
  241. # Make a version file containing the current version from git.
  242. #
  243. include(GetGitRevisionDescription)
  244. git_describe_checkout(STORM_GIT_VERSION_STRING)
  245. # Parse the git Tag into variables
  246. string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" STORM_CUDAPLUGIN_VERSION_MAJOR "${STORM_GIT_VERSION_STRING}")
  247. string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" STORM_CUDAPLUGIN_VERSION_MINOR "${STORM_GIT_VERSION_STRING}")
  248. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" STORM_CUDAPLUGIN_VERSION_PATCH "${STORM_GIT_VERSION_STRING}")
  249. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+)\\-.*" "\\1" STORM_CUDAPLUGIN_VERSION_COMMITS_AHEAD "${STORM_GIT_VERSION_STRING}")
  250. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-([a-z0-9]+).*" "\\1" STORM_CUDAPLUGIN_VERSION_HASH "${STORM_GIT_VERSION_STRING}")
  251. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-[a-z0-9]+\\-(.*)" "\\1" STORM_CUDAPLUGIN_VERSION_APPENDIX "${STORM_GIT_VERSION_STRING}")
  252. if ("${STORM_CUDAPLUGIN_VERSION_APPENDIX}" MATCHES "^.*dirty.*$")
  253. set(STORM_CUDAPLUGIN_VERSION_DIRTY 1)
  254. else()
  255. set(STORM_CUDAPLUGIN_VERSION_DIRTY 0)
  256. endif()
  257. message(STATUS "StoRM (CudaPlugin) - Version information: ${STORM_CUDAPLUGIN_VERSION_MAJOR}.${STORM_CUDAPLUGIN_VERSION_MINOR}.${STORM_CUDAPLUGIN_VERSION_PATCH} (${STORM_CUDAPLUGIN_VERSION_COMMITS_AHEAD} commits ahead of Tag) build from ${STORM_CUDAPLUGIN_VERSION_HASH} (Dirty: ${STORM_CUDAPLUGIN_VERSION_DIRTY})")
  258. # Configure a header file to pass some of the CMake settings to the source code
  259. configure_file (
  260. "${PROJECT_SOURCE_DIR}/cuda/storm-cudaplugin-config.h.in"
  261. "${PROJECT_BINARY_DIR}/include/storm-cudaplugin-config.h"
  262. )
  263. #create library
  264. find_package(CUDA REQUIRED)
  265. set(CUSP_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/resources/3rdparty/cusplibrary")
  266. find_package(Cusp REQUIRED)
  267. find_package(Thrust REQUIRED)
  268. set(STORM_CUDA_LIB_NAME "storm-cuda")
  269. file(GLOB_RECURSE STORM_CUDA_KERNEL_FILES ${PROJECT_SOURCE_DIR}/cuda/kernels/*.cu)
  270. file(GLOB_RECURSE STORM_CUDA_HEADER_FILES ${PROJECT_SOURCE_DIR}/cuda/kernels/*.h)
  271. source_group(kernels FILES ${STORM_CUDA_KERNEL_FILES} ${STORM_CUDA_HEADER_FILES})
  272. include_directories(${PROJECT_SOURCE_DIR}/cuda/kernels/)
  273. #set(CUDA_PROPAGATE_HOST_FLAGS OFF)
  274. set(CUDA_NVCC_FLAGS "-arch=sm_30")
  275. #############################################################
  276. ##
  277. ## CUSP
  278. ##
  279. #############################################################
  280. if(CUSP_FOUND)
  281. include_directories(${CUSP_INCLUDE_DIR})
  282. cuda_include_directories(${CUSP_INCLUDE_DIR})
  283. message(STATUS "StoRM (CudaPlugin) - Found CUSP Version ${CUSP_VERSION} in location ${CUSP_INCLUDE_DIR}")
  284. else()
  285. message(FATAL_ERROR "StoRM (CudaPlugin) - Could not find CUSP!")
  286. endif()
  287. #############################################################
  288. ##
  289. ## Thrust
  290. ##
  291. #############################################################
  292. if(THRUST_FOUND)
  293. include_directories(${THRUST_INCLUDE_DIR})
  294. cuda_include_directories(${THRUST_INCLUDE_DIR})
  295. message(STATUS "StoRM (CudaPlugin) - Found Thrust Version ${THRUST_VERSION} in location ${THRUST_INCLUDE_DIR}")
  296. else()
  297. message(FATAL_ERROR "StoRM (CudaPlugin) - Could not find Thrust! Check your CUDA installation.")
  298. endif()
  299. include_directories(${CUDA_INCLUDE_DIRS})
  300. include_directories(${ADDITIONAL_INCLUDE_DIRS})
  301. cuda_add_library(${STORM_CUDA_LIB_NAME}
  302. ${STORM_CUDA_KERNEL_FILES} ${STORM_CUDA_HEADER_FILES}
  303. )
  304. endif()
  305. #############################################################
  306. ##
  307. ## Source file aggregation and clustering
  308. ##
  309. #############################################################
  310. file(GLOB_RECURSE STORM_HEADERS ${PROJECT_SOURCE_DIR}/src/*.h)
  311. file(GLOB_RECURSE STORM_SOURCES_WITHOUT_MAIN ${PROJECT_SOURCE_DIR}/src/*/*.cpp)
  312. file(GLOB_RECURSE STORM_MAIN_FILE ${PROJECT_SOURCE_DIR}/src/storm.cpp)
  313. set(STORM_SOURCES "${STORM_SOURCES_WITHOUT_MAIN};${STORM_MAIN_FILE};")
  314. file(GLOB_RECURSE STORM_ADAPTERS_FILES ${PROJECT_SOURCE_DIR}/src/adapters/*.h ${PROJECT_SOURCE_DIR}/src/adapters/*.cpp)
  315. file(GLOB_RECURSE STORM_BUILDER_FILES ${PROJECT_SOURCE_DIR}/src/builder/*.h ${PROJECT_SOURCE_DIR}/src/builder/*.cpp)
  316. file(GLOB_RECURSE STORM_EXCEPTIONS_FILES ${PROJECT_SOURCE_DIR}/src/exceptions/*.h ${PROJECT_SOURCE_DIR}/src/exceptions/*.cpp)
  317. file(GLOB_RECURSE STORM_LOGIC_FILES ${PROJECT_SOURCE_DIR}/src/logic/*.h ${PROJECT_SOURCE_DIR}/src/logic/*.cpp)
  318. file(GLOB STORM_MODELCHECKER_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/*.cpp)
  319. file(GLOB_RECURSE STORM_MODELCHECKER_PRCTL_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/prctl/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/prctl/*.cpp)
  320. file(GLOB_RECURSE STORM_MODELCHECKER_CSL_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/csl/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/csl/*.cpp)
  321. file(GLOB_RECURSE STORM_MODELCHECKER_REACHABILITY_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/reachability/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/reachability/*.cpp)
  322. file(GLOB_RECURSE STORM_MODELCHECKER_PROPOSITIONAL_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/propositional/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/propositional/*.cpp)
  323. file(GLOB_RECURSE STORM_MODELCHECKER_RESULTS_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/results/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/results/*.cpp)
  324. file(GLOB_RECURSE STORM_COUNTEREXAMPLES_FILES ${PROJECT_SOURCE_DIR}/src/counterexamples/*.h ${PROJECT_SOURCE_DIR}/src/counterexamples/*.cpp)
  325. file(GLOB STORM_MODELS_FILES ${PROJECT_SOURCE_DIR}/src/models/*.h ${PROJECT_SOURCE_DIR}/src/models/*.cpp)
  326. file(GLOB_RECURSE STORM_MODELS_SPARSE_FILES ${PROJECT_SOURCE_DIR}/src/models/sparse/*.h ${PROJECT_SOURCE_DIR}/src/models/sparse/*.cpp)
  327. file(GLOB_RECURSE STORM_MODELS_SYMBOLIC_FILES ${PROJECT_SOURCE_DIR}/src/models/symbolic/*.h ${PROJECT_SOURCE_DIR}/src/models/symbolic/*.cpp)
  328. file(GLOB STORM_PARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/*.h ${PROJECT_SOURCE_DIR}/src/parser/*.cpp)
  329. file(GLOB_RECURSE STORM_PARSER_PRISMPARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.h ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.cpp)
  330. file(GLOB STORM_SETTINGS_FILES ${PROJECT_SOURCE_DIR}/src/settings/*.h ${PROJECT_SOURCE_DIR}/src/settings/*.cpp)
  331. file(GLOB STORM_SETTINGS_MODULES_FILES ${PROJECT_SOURCE_DIR}/src/settings/modules/*.h ${PROJECT_SOURCE_DIR}/src/settings/modules/*.cpp)
  332. file(GLOB_RECURSE STORM_SOLVER_FILES ${PROJECT_SOURCE_DIR}/src/solver/*.h ${PROJECT_SOURCE_DIR}/src/solver/*.cpp)
  333. file(GLOB STORM_STORAGE_FILES ${PROJECT_SOURCE_DIR}/src/storage/*.h ${PROJECT_SOURCE_DIR}/src/storage/*.cpp)
  334. file(GLOB_RECURSE STORM_STORAGE_DD_FILES ${PROJECT_SOURCE_DIR}/src/storage/dd/*.h ${PROJECT_SOURCE_DIR}/src/storage/dd/*.cpp)
  335. file(GLOB_RECURSE STORM_STORAGE_EXPRESSIONS_FILES ${PROJECT_SOURCE_DIR}/src/storage/expressions/*.h ${PROJECT_SOURCE_DIR}/src/storage/expressions/*.cpp)
  336. file(GLOB_RECURSE STORM_STORAGE_PRISM_FILES ${PROJECT_SOURCE_DIR}/src/storage/prism/*.h ${PROJECT_SOURCE_DIR}/src/storage/prism/*.cpp)
  337. file(GLOB_RECURSE STORM_STORAGE_SPARSE_FILES ${PROJECT_SOURCE_DIR}/src/storage/sparse/*.h ${PROJECT_SOURCE_DIR}/src/storage/sparse/*.cpp)
  338. file(GLOB_RECURSE STORM_UTILITY_FILES ${PROJECT_SOURCE_DIR}/src/utility/*.h ${PROJECT_SOURCE_DIR}/src/utility/*.cpp)
  339. # Test Sources
  340. # Note that the tests also need the source files, except for the main file
  341. file(GLOB STORM_FUNCTIONAL_TEST_MAIN_FILE ${STORM_CPP_TESTS_BASE_PATH}/functional/storm-functional-tests.cpp)
  342. file(GLOB_RECURSE STORM_FUNCTIONAL_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/functional/*.h ${STORM_CPP_TESTS_BASE_PATH}/functional/*.cpp)
  343. file(GLOB STORM_PERFORMANCE_TEST_MAIN_FILE ${STORM_CPP_TESTS_BASE_PATH}/performance/storm-performance-tests.cpp)
  344. file(GLOB_RECURSE STORM_PERFORMANCE_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/performance/*.h ${STORM_CPP_TESTS_BASE_PATH}/performance/*.cpp)
  345. # Additional include files like the storm-config.h
  346. file(GLOB_RECURSE STORM_BUILD_HEADERS ${PROJECT_BINARY_DIR}/include/*.h)
  347. # Group the headers and sources
  348. source_group(main FILES ${STORM_MAIN_FILE})
  349. source_group(adapters FILES ${STORM_ADAPTERS_FILES})
  350. source_group(builder FILES ${STORM_BUILDER_FILES})
  351. source_group(exceptions FILES ${STORM_EXCEPTIONS_FILES})
  352. source_group(logic FILES ${STORM_LOGIC_FILES})
  353. source_group(generated FILES ${STORM_BUILD_HEADERS} ${STORM_BUILD_SOURCES})
  354. source_group(modelchecker FILES ${STORM_MODELCHECKER_FILES})
  355. source_group(modelchecker\\prctl FILES ${STORM_MODELCHECKER_PRCTL_FILES})
  356. source_group(modelchecker\\csl FILES ${STORM_MODELCHECKER_CSL_FILES})
  357. source_group(modelchecker\\reachability FILES ${STORM_MODELCHECKER_REACHABILITY_FILES})
  358. source_group(modelchecker\\propositional FILES ${STORM_MODELCHECKER_PROPOSITIONAL_FILES})
  359. source_group(modelchecker\\results FILES ${STORM_MODELCHECKER_RESULTS_FILES})
  360. source_group(counterexamples FILES ${STORM_COUNTEREXAMPLES_FILES})
  361. source_group(models FILES ${STORM_MODELS_FILES})
  362. source_group(models\\sparse FILES ${STORM_MODELS_SPARSE_FILES})
  363. source_group(models\\symbolic FILES ${STORM_MODELS_SYMBOLIC_FILES})
  364. source_group(parser FILES ${STORM_PARSER_FILES})
  365. source_group(parser\\prismparser FILES ${STORM_PARSER_PRISMPARSER_FILES})
  366. source_group(settings FILES ${STORM_SETTINGS_FILES})
  367. source_group(settings\\modules FILES ${STORM_SETTINGS_MODULES_FILES})
  368. source_group(solver FILES ${STORM_SOLVER_FILES})
  369. source_group(storage FILES ${STORM_STORAGE_FILES})
  370. source_group(storage\\dd FILES ${STORM_STORAGE_DD_FILES})
  371. source_group(storage\\expressions FILES ${STORM_STORAGE_EXPRESSIONS_FILES})
  372. source_group(storage\\prism FILES ${STORM_STORAGE_PRISM_FILES})
  373. source_group(storage\\sparse FILES ${STORM_STORAGE_SPARSE_FILES})
  374. source_group(utility FILES ${STORM_UTILITY_FILES})
  375. source_group(functional-test FILES ${STORM_FUNCTIONAL_TEST_FILES})
  376. source_group(performance-test FILES ${STORM_PERFORMANCE_TEST_FILES} ${})
  377. # Add custom additional include or link directories
  378. if (ADDITIONAL_INCLUDE_DIRS)
  379. message(STATUS "StoRM - Using additional include directories ${ADDITIONAL_INCLUDE_DIRS}")
  380. include_directories(${ADDITIONAL_INCLUDE_DIRS})
  381. endif(ADDITIONAL_INCLUDE_DIRS)
  382. if (ADDITIONAL_LINK_DIRS)
  383. message(STATUS "StoRM - Using additional link directories ${ADDITIONAL_LINK_DIRS}")
  384. link_directories(${ADDITIONAL_LINK_DIRS})
  385. endif(ADDITIONAL_LINK_DIRS)
  386. #############################################################
  387. ##
  388. ## Pre executable-creation link_directories setup
  389. ##
  390. #############################################################
  391. if (ENABLE_GUROBI)
  392. if (NOT GUROBI_FOUND)
  393. message(FATAL_ERROR "Gurobi was requested, but not found!")
  394. endif()
  395. #link_directories("${GUROBI_ROOT}/lib")
  396. endif()
  397. if (ENABLE_MSAT)
  398. link_directories("${MSAT_ROOT}/lib")
  399. endif()
  400. if(GMP_FOUND)
  401. link_directories(${GMP_LIBRARY_DIR})
  402. elseif(MPIR_FOUND)
  403. link_directories(${GMP_MPIR_LIBRARY_DIR} ${GMP_MPIRXX_LIBRARY_DIR})
  404. else(GMP_FOUND)
  405. if (ENABLE_MSAT)
  406. message(FATAL_ERROR "GMP is required for MathSAT, but was not found!")
  407. endif(ENABLE_MSAT)
  408. endif(GMP_FOUND)
  409. if ((NOT Boost_LIBRARY_DIRS) OR ("${Boost_LIBRARY_DIRS}" STREQUAL ""))
  410. set(Boost_LIBRARY_DIRS "${Boost_INCLUDE_DIRS}/stage/lib")
  411. endif ()
  412. link_directories(${Boost_LIBRARY_DIRS})
  413. if (TBB_FOUND AND STORM_USE_INTELTBB)
  414. link_directories(${TBB_LIBRARY_DIRS})
  415. endif()
  416. ###############################################################################
  417. ## #
  418. ## Executable Creation #
  419. ## #
  420. ## All link_directories() calls MUST be made before this point #
  421. ## #
  422. ###############################################################################
  423. add_library(storm ${STORM_SOURCES_WITHOUT_MAIN} ${STORM_HEADERS})
  424. add_executable(storm-main ${STORM_MAIN_FILE})
  425. target_link_libraries(storm-main storm)
  426. set_target_properties(storm-main PROPERTIES OUTPUT_NAME "storm")
  427. add_executable(storm-functional-tests ${STORM_FUNCTIONAL_TEST_MAIN_FILE} ${STORM_FUNCTIONAL_TEST_FILES})
  428. target_link_libraries(storm-functional-tests storm)
  429. add_executable(storm-performance-tests ${STORM_PERFORMANCE_TEST_MAIN_FILE} ${STORM_PERFORMANCE_TEST_FILES})
  430. target_link_libraries(storm-performance-tests storm)
  431. #############################################################
  432. ##
  433. ## Boost
  434. ##
  435. #############################################################
  436. include_directories(${Boost_INCLUDE_DIRS})
  437. target_link_libraries(storm ${Boost_LIBRARIES})
  438. #message(STATUS "BOOST_INCLUDE_DIRS is ${Boost_INCLUDE_DIRS}")
  439. #message(STATUS "BOOST_LIBRARY_DIRS is ${Boost_LIBRARY_DIRS}")
  440. #############################################################
  441. ##
  442. ## CUDD
  443. ##
  444. #############################################################
  445. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0")
  446. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/cudd")
  447. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/epd")
  448. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/mtr")
  449. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/nanotrav")
  450. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/obj")
  451. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/st")
  452. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/util")
  453. target_link_libraries(storm cudd)
  454. #############################################################
  455. ##
  456. ## Gurobi (optional)
  457. ##
  458. #############################################################
  459. if (ENABLE_GUROBI)
  460. message (STATUS "StoRM - Linking with Gurobi (include: ${GUROBI_INCLUDE_DIRS})")
  461. include_directories(${GUROBI_INCLUDE_DIRS})
  462. target_link_libraries(storm ${GUROBI_LIBRARY})
  463. endif(ENABLE_GUROBI)
  464. #############################################################
  465. ##
  466. ## CUDA (optional)
  467. ##
  468. #############################################################
  469. if (ENABLE_CUDA)
  470. message (STATUS "StoRM - Linking with CUDA")
  471. target_link_libraries(storm ${STORM_CUDA_LIB_NAME})
  472. include_directories("${PROJECT_SOURCE_DIR}/cuda/kernels/")
  473. endif(ENABLE_CUDA)
  474. #############################################################
  475. ##
  476. ## glpk
  477. ##
  478. #############################################################
  479. message (STATUS "StoRM - Linking with glpk")
  480. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/glpk-4.53")
  481. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/glpk-4.53/src")
  482. target_link_libraries(storm "glpk")
  483. #############################################################
  484. ##
  485. ## ExprTk
  486. ##
  487. #############################################################
  488. message (STATUS "StoRM - Including ExprTk")
  489. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/exprtk")
  490. #############################################################
  491. ##
  492. ## Z3 (optional)
  493. ##
  494. #############################################################
  495. if(STORM_HAVE_Z3)
  496. message (STATUS "StoRM - Linking with Z3")
  497. include_directories(${Z3_INCLUDE_DIRS})
  498. target_link_libraries(storm ${Z3_LIBRARIES})
  499. endif(STORM_HAVE_Z3)
  500. #############################################################
  501. ##
  502. ## carl
  503. ##
  504. #############################################################
  505. if(STORM_HAVE_CARL)
  506. message(STATUS "StoRM - Linking with carl.")
  507. include_directories("${carl_INCLUDE_DIR}")
  508. target_link_libraries(storm lib_carl)
  509. endif()
  510. #############################################################
  511. ##
  512. ## MathSAT (optional)
  513. ##
  514. #############################################################
  515. if (ENABLE_MSAT)
  516. message (STATUS "StoRM - Linking with MathSAT")
  517. include_directories("${MSAT_ROOT}/include")
  518. target_link_libraries(storm "mathsat")
  519. if(GMP_FOUND)
  520. include_directories("${GMP_INCLUDE_DIR}")
  521. target_link_libraries(storm "gmp")
  522. elseif(MPIR_FOUND)
  523. include_directories("${GMP_INCLUDE_DIR}")
  524. target_link_libraries(storm "mpir" "mpirxx")
  525. else(GMP_FOUND)
  526. message(FATAL_ERROR "GMP is required for MathSAT, but was not found!")
  527. endif(GMP_FOUND)
  528. endif(ENABLE_MSAT)
  529. #############################################################
  530. ##
  531. ## Google Test gtest
  532. ##
  533. #############################################################
  534. set(gtest_force_shared_crt ON)
  535. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.7.0")
  536. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.7.0/include")
  537. enable_testing()
  538. target_link_libraries(storm-functional-tests gtest)
  539. target_link_libraries(storm-performance-tests gtest)
  540. add_test(NAME storm-functional-tests COMMAND storm-functional-tests)
  541. add_test(NAME storm-performance-tests COMMAND storm-performance-tests)
  542. #############################################################
  543. ##
  544. ## Log4CPlus
  545. ##
  546. #############################################################
  547. set(BUILD_SHARED_LIBS OFF CACHE BOOL "If TRUE, log4cplus is built as a shared library, otherwise as a static library")
  548. set(LOG4CPLUS_BUILD_LOGGINGSERVER OFF)
  549. set(LOG4CPLUS_BUILD_TESTING OFF)
  550. set(LOG4CPLUS_USE_UNICODE OFF)
  551. set(LOG4CPLUS_DEFINE_INSTALL_TARGET OFF)
  552. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1")
  553. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include")
  554. include_directories("${PROJECT_BINARY_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include") # This adds the defines.hxx file
  555. target_link_libraries(storm log4cplusS)
  556. target_link_libraries(storm-functional-tests log4cplusS)
  557. target_link_libraries(storm-performance-tests log4cplusS)
  558. if (UNIX AND NOT APPLE)
  559. target_link_libraries(storm rt)
  560. if (STORM_USE_COTIRE)
  561. target_link_libraries(storm_unity rt)
  562. endif(STORM_USE_COTIRE)
  563. endif(UNIX AND NOT APPLE)
  564. #############################################################
  565. ##
  566. ## Intel Threading Building Blocks (optional)
  567. ##
  568. #############################################################
  569. if (TBB_FOUND)
  570. message(STATUS "StoRM - Found Intel TBB with interface version ${TBB_INTERFACE_VERSION}.")
  571. if (STORM_USE_INTELTBB)
  572. message(STATUS "StoRM - Linking with Intel TBB in ${TBB_LIBRARY_DIRS}.")
  573. include_directories(${TBB_INCLUDE_DIRS})
  574. target_link_libraries(storm tbb tbbmalloc)
  575. endif(STORM_USE_INTELTBB)
  576. endif(TBB_FOUND)
  577. #############################################################
  578. ##
  579. ## Threads
  580. ##
  581. #############################################################
  582. include_directories(${THREADS_INCLUDE_DIRS})
  583. target_link_libraries(storm ${CMAKE_THREAD_LIBS_INIT})
  584. if (STORM_USE_COTIRE)
  585. target_link_libraries(storm_unity ${CMAKE_THREAD_LIBS_INIT})
  586. endif(STORM_USE_COTIRE)
  587. if (MSVC)
  588. # Add the DebugHelper DLL
  589. set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} Dbghelp.lib")
  590. target_link_libraries(storm "Dbghelp.lib")
  591. endif(MSVC)
  592. #############################################################
  593. ##
  594. ## Cotire
  595. ##
  596. #############################################################
  597. message (STATUS "StoRM - Using Cotire: ${STORM_USE_COTIRE}")
  598. if (STORM_USE_COTIRE)
  599. # Include Cotire for PCH Generation
  600. set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/resources/cmake")
  601. include(cotire)
  602. cotire(storm)
  603. target_link_libraries(storm_unity ${Boost_LIBRARIES})
  604. #cotire(storm-functional-tests)
  605. #cotire(storm-performance-tests)
  606. endif()
  607. #############################################################
  608. ##
  609. ## libc++abi
  610. ##
  611. #############################################################
  612. # Link against libc++abi if requested. May be needed to build on Linux systems using clang.
  613. if (LINK_LIBCXXABI)
  614. message (STATUS "StoRM - Linking against libc++abi.")
  615. target_link_libraries(storm "c++abi")
  616. endif(LINK_LIBCXXABI)
  617. #############################################################
  618. ##
  619. ## Doxygen
  620. ##
  621. #############################################################
  622. # Add a target to generate API documentation with Doxygen
  623. if(DOXYGEN_FOUND)
  624. set(CMAKE_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc")
  625. string(REGEX REPLACE ";" " " CMAKE_DOXYGEN_INPUT_LIST "${PROJECT_SOURCE_DIR}/src")
  626. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" @ONLY)
  627. add_custom_target(doc ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" COMMENT "Generating API documentation with Doxygen" VERBATIM)
  628. endif(DOXYGEN_FOUND)
  629. #############################################################
  630. ##
  631. ## memcheck targets
  632. ##
  633. #############################################################
  634. add_custom_target(memcheck valgrind --leak-check=full --show-reachable=yes ${PROJECT_BINARY_DIR}/storm -v --fix-deadlocks ${PROJECT_SOURCE_DIR}/examples/dtmc/crowds/crowds5_5.tra examples/dtmc/crowds/crowds5_5.lab DEPENDS storm)
  635. add_custom_target(memcheck-functional-tests valgrind --leak-check=full --show-reachable=yes ${PROJECT_BINARY_DIR}/storm-functional-tests -v --fix-deadlocks DEPENDS storm-functional-tests)
  636. add_custom_target(memcheck-performance-tests valgrind --leak-check=full --show-reachable=yes ${PROJECT_BINARY_DIR}/storm-performance-tests -v --fix-deadlocks DEPENDS storm-performance-tests)
  637. set(CPPLINT_ARGS --filter=-whitespace/tab,-whitespace/line_length,-legal/copyright,-readability/streams)
  638. add_custom_target(style python cpplint.py ${CPPLINT_ARGS} `find ./src/ -iname "*.h" -or -iname "*.cpp" `)
  639. INSTALL(TARGETS storm-main storm-functional-tests storm-performance-tests
  640. RUNTIME DESTINATION bin
  641. LIBRARY DESTINATION lib
  642. ARCHIVE DESTINATION lib
  643. )
  644. include(StormCPackConfig.cmake)