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.

768 lines
28 KiB

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