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.

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