You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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