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.

766 lines
33 KiB

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