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.

751 lines
33 KiB

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