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.

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