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.

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