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.

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