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.

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