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.

613 lines
22 KiB

  1. add_custom_target(resources)
  2. add_custom_target(test-resources)
  3. set(STORM_3RDPARTY_SOURCE_DIR ${PROJECT_SOURCE_DIR}/resources/3rdparty)
  4. set(STORM_3RDPARTY_BINARY_DIR ${PROJECT_BINARY_DIR}/resources/3rdparty)
  5. if (STORM_PYTHON)
  6. find_package(PythonInterp 3 REQUIRED QUIET)
  7. find_package(PythonLibs 3 REQUIRED QUIET)
  8. message(STATUS "Python executable: ${PYTHON_EXECUTABLE}")
  9. message(STATUS "Python include: ${PYTHON_INCLUDE_DIRS}")
  10. message(STATUS "Python include: ${PYTHON_LIBRARIES}")
  11. endif()
  12. #############################################################
  13. ##
  14. ## l3pp
  15. ##
  16. #############################################################
  17. # Do not take a branch, needs internet connection.
  18. ExternalProject_Add(
  19. l3pp
  20. GIT_REPOSITORY https://github.com/hbruintjes/l3pp.git
  21. GIT_TAG e4f8d7fe6c328849aff34d2dfd6fd592c14070d5
  22. SOURCE_DIR ${STORM_3RDPARTY_SOURCE_DIR}/l3pp
  23. UPDATE_COMMAND ""
  24. CONFIGURE_COMMAND ""
  25. BUILD_COMMAND ""
  26. INSTALL_COMMAND ""
  27. LOG_INSTALL ON
  28. )
  29. ExternalProject_Get_Property(l3pp source_dir)
  30. set(l3pp_INCLUDE "${source_dir}/")
  31. include_directories(${l3pp_INCLUDE})
  32. add_dependencies(resources l3pp)
  33. #############################################################
  34. ##
  35. ## gmm
  36. ##
  37. #############################################################
  38. # Add the shipped version of GMM to the include pathes
  39. set(GMMXX_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/resources/3rdparty/gmm-5.0/include")
  40. include_directories(${GMMXX_INCLUDE_DIR})
  41. #############################################################
  42. ##
  43. ## Eigen
  44. ##
  45. #############################################################
  46. # Add the shipped version of Eigen to the include pathes
  47. set(EIGEN_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/resources/3rdparty/eigen-3.3-beta1")
  48. include_directories(${EIGEN_INCLUDE_DIR})
  49. #############################################################
  50. ##
  51. ## Boost
  52. ##
  53. #############################################################
  54. # Boost Option variables
  55. set(Boost_USE_STATIC_LIBS ${USE_BOOST_STATIC_LIBRARIES})
  56. set(Boost_USE_MULTITHREADED ON)
  57. set(Boost_USE_STATIC_RUNTIME OFF)
  58. find_package(Boost 1.61.0 QUIET REQUIRED COMPONENTS filesystem system)
  59. if (NOT Boost_FOUND)
  60. if (Boost_VERSION)
  61. message(FATAL_ERROR "The required Boost version is 1.61.0 or newer, however, only ${Boost_VERSION} was found.")
  62. else ()
  63. message(FATAL_ERROR "Boost was not found.")
  64. endif ()
  65. endif ()
  66. if ((NOT Boost_LIBRARY_DIRS) OR ("${Boost_LIBRARY_DIRS}" STREQUAL ""))
  67. set(Boost_LIBRARY_DIRS "${Boost_INCLUDE_DIRS}/stage/lib")
  68. endif ()
  69. link_directories(${Boost_LIBRARY_DIRS})
  70. include_directories(${Boost_INCLUDE_DIRS})
  71. list(APPEND STORM_LINK_LIBRARIES ${Boost_LIBRARIES})
  72. message(STATUS "Storm - Using boost ${Boost_VERSION} (library version ${Boost_LIB_VERSION}).")
  73. # set the information for the config header
  74. set(STORM_BOOST_INCLUDE_DIR "${Boost_INCLUDE_DIRS}")
  75. #############################################################
  76. ##
  77. ## ExprTk
  78. ##
  79. #############################################################
  80. # Use the shipped version of ExprTK
  81. message (STATUS "Storm - Including ExprTk.")
  82. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/exprtk")
  83. #############################################################
  84. ##
  85. ## Sparsepp
  86. ##
  87. #############################################################
  88. # Use the shipped version of Sparsepp
  89. message (STATUS "Storm - Including Sparsepp.")
  90. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/sparsepp")
  91. # Add sparsepp.h to the headers that are copied to the include directory in thebuild directory.
  92. add_custom_command(
  93. OUTPUT ${CMAKE_BINARY_DIR}/include/resources/3rdparty/sparsepp/sparsepp.h
  94. COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/resources/3rdparty/sparsepp
  95. COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/resources/3rdparty/sparsepp/sparsepp.h ${CMAKE_BINARY_DIR}/include/resources/3rdparty/sparsepp/sparsepp.h
  96. DEPENDS ${PROJECT_SOURCE_DIR}/resources/3rdparty/sparsepp/sparsepp.h
  97. )
  98. list(APPEND STORM_RESOURCES_HEADERS "${CMAKE_BINARY_DIR}/include/resources/3rdparty/sparsepp/sparsepp.h")
  99. #############################################################
  100. ##
  101. ## ModernJSON
  102. ##
  103. #############################################################
  104. #use the shipped version of modernjson
  105. message (STATUS "Storm - Including ModernJSON.")
  106. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/modernjson/src/")
  107. #############################################################
  108. ##
  109. ## Z3 (optional)
  110. ##
  111. #############################################################
  112. find_package(Z3 QUIET)
  113. # Z3 Defines
  114. set(STORM_HAVE_Z3 ${Z3_FOUND})
  115. if(Z3_FOUND)
  116. message (STATUS "Storm - Linking with Z3.")
  117. include_directories(${Z3_INCLUDE_DIRS})
  118. list(APPEND STORM_LINK_LIBRARIES ${Z3_LIBRARIES})
  119. endif(Z3_FOUND)
  120. #############################################################
  121. ##
  122. ## glpk
  123. ##
  124. #############################################################
  125. include(${STORM_3RDPARTY_SOURCE_DIR}/include_glpk.cmake)
  126. #############################################################
  127. ##
  128. ## Gurobi (optional)
  129. ##
  130. #############################################################
  131. if (STORM_USE_GUROBI)
  132. find_package(Gurobi QUIET REQUIRED)
  133. set(STORM_HAVE_GUROBI ${GUROBI_FOUND})
  134. if (GUROBI_FOUND)
  135. message (STATUS "Storm - Linking with Gurobi.")
  136. include_directories(${GUROBI_INCLUDE_DIRS})
  137. list(APPEND STORM_LINK_LIBRARIES ${GUROBI_LIBRARY})
  138. #link_directories("${GUROBI_ROOT}/lib")
  139. endif()
  140. else()
  141. set(STORM_HAVE_GUROBI OFF)
  142. endif()
  143. #############################################################
  144. ##
  145. ## CUDD
  146. ##
  147. #############################################################
  148. include(${STORM_3RDPARTY_SOURCE_DIR}/include_cudd.cmake)
  149. #############################################################
  150. ##
  151. ## cpptemplate
  152. ##
  153. #############################################################
  154. include(${STORM_3RDPARTY_SOURCE_DIR}/include_cpptemplate.cmake)
  155. #############################################################
  156. ##
  157. ## CLN
  158. ##
  159. #############################################################
  160. find_package(CLN QUIET)
  161. if(CLN_FOUND)
  162. set(STORM_HAVE_CLN ON)
  163. message(STATUS "Storm - Linking with CLN ${CLN_VERSION_STRING}.")
  164. include_directories("${CLN_INCLUDE_DIR}")
  165. list(APPEND STORM_LINK_LIBRARIES ${CLN_LIBRARIES})
  166. else()
  167. set(STORM_HAVE_CLN OFF)
  168. if(NOT GMP_FOUND)
  169. message(FATAL_ERROR "Storm - Neither CLN nor GMP found.")
  170. endif()
  171. endif()
  172. #############################################################
  173. ##
  174. ## carl
  175. ##
  176. #############################################################
  177. set(STORM_HAVE_CARL OFF)
  178. if(USE_CARL)
  179. find_package(carl QUIET)
  180. if(carl_FOUND)
  181. set(STORM_HAVE_CARL ON)
  182. message(STATUS "Storm - Use system version of carl.")
  183. message(STATUS "Storm - Linking with carl ${carl_VERSION_STRING}.")
  184. include_directories("${carl_INCLUDE_DIR}")
  185. list(APPEND STORM_LINK_LIBRARIES ${carl_LIBRARIES})
  186. else()
  187. message(STATUS "Storm - Using shipped version of carl.")
  188. set(CARL_BUILD_COMMAND make lib_carl)
  189. if(STORM_PYTHON)
  190. set(CARL_BUILD_COMMAND ${CARL_BUILD_COMMAND} PythonBindingsDevelop)
  191. endif()
  192. ExternalProject_Add(
  193. carl
  194. GIT_REPOSITORY https://github.com/smtrat/carl
  195. GIT_TAG master
  196. INSTALL_DIR ${STORM_3RDPARTY_BINARY_DIR}/carl
  197. SOURCE_DIR ${STORM_3RDPARTY_SOURCE_DIR}/carl
  198. CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DBOOST_INCLUDEDIR=${Boost_INCLUDE_DIRS} -DBOOST_LIBRARYDIR=${Boost_LIBRARY_DIRS} -DBoost_NO_SYSTEM_PATHS=1 -DEXPORT_TO_CMAKE=0 -DUSE_CLN_NUMBERS=1 -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=1 -DCMAKE_INSTALL_PREFIX:PATH=${STORM_3RDPARTY_BINARY_DIR}/carl -DBINDINGS_PYTHON=${STORM_PYTHON} -DPYTHON_LIBRARY=${PYTHON_LIBRARY} -DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
  199. BUILD_IN_SOURCE 0
  200. BUILD_COMMAND ${CARL_BUILD_COMMAND}
  201. INSTALL_COMMAND ""
  202. LOG_UPDATE ON
  203. LOG_CONFIGURE ON
  204. LOG_BUILD ON
  205. BUILD_BYPRODUCTS ${STORM_3RDPARTY_BINARY_DIR}/carl/lib/libcarl${DYNAMIC_EXT}
  206. )
  207. add_dependencies(resources carl)
  208. set(carl_INCLUDE_DIR "${STORM_3RDPARTY_BINARY_DIR}/carl/include")
  209. include_directories("${carl_INCLUDE_DIR}")
  210. list(APPEND STORM_LINK_LIBRARIES ${STORM_3RDPARTY_BINARY_DIR}/carl/lib/libcarl${DYNAMIC_EXT})
  211. set(STORM_HAVE_CARL ON)
  212. endif()
  213. endif()
  214. set(STORM_CARL_INCLUDE_DIR "${carl_INCLUDE_DIR}")
  215. #############################################################
  216. ##
  217. ## SMT-RAT
  218. ##
  219. #############################################################
  220. set(STORM_HAVE_SMTRAT OFF)
  221. if(USE_SMTRAT)
  222. find_package(smtrat QUIET REQUIRED)
  223. if(smtrat_FOUND)
  224. set(STORM_HAVE_SMTRAT ON)
  225. message(STATUS "Storm - Linking with smtrat.")
  226. include_directories("${smtrat_INCLUDE_DIR}")
  227. list(APPEND STORM_LINK_LIBRARIES ${smtrat_LIBRARIES})
  228. else()
  229. message(FATAL_ERROR "StoRM - SMT-RAT was requested but not found")
  230. endif()
  231. endif()
  232. #############################################################
  233. ##
  234. ## HyPro
  235. ##
  236. #############################################################
  237. set(STORM_HAVE_HYPRO OFF)
  238. if(USE_HYPRO)
  239. find_package(hypro QUIET REQUIRED)
  240. if(hypro_FOUND)
  241. set(STORM_HAVE_HYPRO ON)
  242. message(STATUS "Storm - Linking with hypro ${hypro_VERSION_STRING}.")
  243. include_directories("${hypro_INCLUDE_DIR}")
  244. link_directories( /Users/tim/hypro/build )
  245. list(APPEND STORM_LINK_LIBRARIES ${hypro_LIBRARIES})
  246. else()
  247. message(FATAL_ERROR "StoRM - HyPro was requested but not found")
  248. endif()
  249. endif()
  250. #############################################################
  251. ##
  252. ## GiNaC
  253. ##
  254. #############################################################
  255. find_package(GiNaC QUIET)
  256. if(GINAC_FOUND)
  257. set(STORM_HAVE_GINAC ON)
  258. message(STATUS "Storm - Linking with GiNaC ${GINAC_VERSION_STRING}.")
  259. # Right now only link with GiNaC for carl
  260. #include_directories("${GINAC_INCLUDE_DIR}")
  261. list(APPEND STORM_LINK_LIBRARIES ${GINAC_LIBRARIES})
  262. else()
  263. set(STORM_HAVE_GINAC OFF)
  264. #TODO: Check if CARL actually requires the use of GiNaC
  265. endif()
  266. #############################################################
  267. ##
  268. ## gmp
  269. ##
  270. #############################################################
  271. # GMP is optional (unless MathSAT is used, see below)
  272. find_package(GMP QUIET)
  273. #############################################################
  274. ##
  275. ## MathSAT (optional)
  276. ##
  277. #############################################################
  278. if ("${MSAT_ROOT}" STREQUAL "")
  279. set(ENABLE_MSAT OFF)
  280. else()
  281. set(ENABLE_MSAT ON)
  282. endif()
  283. # MathSAT Defines
  284. set(STORM_HAVE_MSAT ${ENABLE_MSAT})
  285. if (ENABLE_MSAT)
  286. message (STATUS "Storm - Linking with MathSAT.")
  287. link_directories("${MSAT_ROOT}/lib")
  288. include_directories("${MSAT_ROOT}/include")
  289. list(APPEND STORM_LINK_LIBRARIES "mathsat")
  290. if(GMP_FOUND)
  291. include_directories("${GMP_INCLUDE_DIR}")
  292. list(APPEND STORM_LINK_LIBRARIES "gmp")
  293. elseif(MPIR_FOUND)
  294. include_directories("${GMP_INCLUDE_DIR}")
  295. list(APPEND STORM_LINK_LIBRARIES "mpir" "mpirxx")
  296. else(GMP_FOUND)
  297. message(FATAL_ERROR "GMP is required for MathSAT, but was not found!")
  298. endif(GMP_FOUND)
  299. endif(ENABLE_MSAT)
  300. #############################################################
  301. ##
  302. ## Xerces
  303. ##
  304. #############################################################
  305. include(${STORM_3RDPARTY_SOURCE_DIR}/include_xerces.cmake)
  306. #############################################################
  307. ##
  308. ## Sylvan
  309. ##
  310. #############################################################
  311. ExternalProject_Add(
  312. sylvan
  313. DOWNLOAD_COMMAND ""
  314. PREFIX "sylvan"
  315. SOURCE_DIR ${STORM_3RDPARTY_SOURCE_DIR}/sylvan
  316. CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DSYLVAN_BUILD_TEST=Off -DSYLVAN_BUILD_EXAMPLES=Off -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  317. BINARY_DIR ${PROJECT_BINARY_DIR}/sylvan
  318. BUILD_IN_SOURCE 0
  319. INSTALL_COMMAND ""
  320. INSTALL_DIR ${STORM_3RDPARTY_BINARY_DIR}/sylvan
  321. LOG_CONFIGURE ON
  322. LOG_BUILD ON
  323. BUILD_BYPRODUCTS ${PROJECT_BINARY_DIR}/sylvan/src/libsylvan${STATIC_EXT}
  324. )
  325. ExternalProject_Get_Property(sylvan source_dir)
  326. ExternalProject_Get_Property(sylvan binary_dir)
  327. set(Sylvan_INCLUDE_DIR "${source_dir}/src")
  328. set(Sylvan_LIBRARY "${binary_dir}/src/libsylvan${STATIC_EXT}")
  329. message(STATUS "Storm - Using shipped version of sylvan.")
  330. message(STATUS "Storm - Linking with sylvan.")
  331. include_directories("${Sylvan_INCLUDE_DIR}")
  332. list(APPEND STORM_LINK_LIBRARIES ${Sylvan_LIBRARY})
  333. add_dependencies(resources sylvan)
  334. if(${OPERATING_SYSTEM} MATCHES "Linux")
  335. find_package(Hwloc QUIET REQUIRED)
  336. if(HWLOC_FOUND)
  337. message(STATUS "Storm - Linking with hwloc ${HWLOC_VERSION}.")
  338. list(APPEND STORM_LINK_LIBRARIES ${HWLOC_LIBRARIES})
  339. else()
  340. message(FATAL_ERROR "HWLOC is required but was not found.")
  341. endif()
  342. endif()
  343. #############################################################
  344. ##
  345. ## Google Test gtest
  346. ##
  347. #############################################################
  348. set(GOOGLETEST_LIB_DIR ${STORM_3RDPARTY_BINARY_DIR}/gtest-1.7.0)
  349. ExternalProject_Add(
  350. googletest
  351. #For downloads (may be useful later!)
  352. #SVN_REPOSITORY http://googletest.googlecode.com/svn/trunk/
  353. #TIMEOUT 10
  354. DOWNLOAD_COMMAND ""
  355. SOURCE_DIR "${STORM_3RDPARTY_SOURCE_DIR}/gtest-1.7.0"
  356. # Force the same output paths for debug and release builds so that
  357. # we know in which place the binaries end up when using the Xcode generator
  358. CMAKE_ARGS -Dgtest_force_shared_crt=ON -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=${GOOGLETEST_LIB_DIR} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=${GOOGLETEST_LIB_DIR}
  359. # Disable install step
  360. INSTALL_COMMAND ""
  361. BINARY_DIR ${GOOGLETEST_LIB_DIR}
  362. INSTALL_DIR ${GOOGLETEST_LIB_DIR}
  363. # Wrap download, configure and build steps in a script to log output
  364. LOG_CONFIGURE ON
  365. LOG_BUILD ON
  366. BUILD_BYPRODUCTS ${GOOGLETEST_LIB_DIR}/libgtest${STATIC_EXT} ${GOOGLETEST_LIB_DIR}/libgtest_main${STATIC_EXT}
  367. )
  368. # Specify include dir
  369. ExternalProject_Get_Property(googletest source_dir)
  370. set(GTEST_INCLUDE_DIR ${source_dir}/include)
  371. # Specify MainTest's link libraries
  372. ExternalProject_Get_Property(googletest binary_dir)
  373. set(GTEST_LIBRARIES ${binary_dir}/libgtest${STATIC_EXT} ${binary_dir}/libgtest_main${STATIC_EXT})
  374. add_dependencies(test-resources googletest)
  375. list(APPEND STORM_TEST_LINK_LIBRARIES ${GTEST_LIBRARIES})
  376. #############################################################
  377. ##
  378. ## Intel Threading Building Blocks (optional)
  379. ##
  380. #############################################################
  381. set(STORM_HAVE_INTELTBB OFF)
  382. if (STORM_USE_INTELTBB)
  383. find_package(TBB QUIET REQUIRED)
  384. if (TBB_FOUND)
  385. message(STATUS "Storm - Found Intel TBB with interface version ${TBB_INTERFACE_VERSION}.")
  386. message(STATUS "Storm - Linking with Intel TBB in ${TBB_LIBRARY_DIRS}.")
  387. set(STORM_HAVE_INTELTBB ON)
  388. link_directories(${TBB_LIBRARY_DIRS})
  389. include_directories(${TBB_INCLUDE_DIRS})
  390. list(APPEND STORM_LINK_LIBRARIES tbb tbbmalloc)
  391. else(TBB_FOUND)
  392. message(FATAL_ERROR "Storm - TBB was requested, but not found.")
  393. endif(TBB_FOUND)
  394. endif(STORM_USE_INTELTBB)
  395. #############################################################
  396. ##
  397. ## Threads
  398. ##
  399. #############################################################
  400. find_package(Threads QUIET REQUIRED)
  401. if (NOT Threads_FOUND)
  402. message(FATAL_ERROR "Storm - Threads was requested, but not found.")
  403. endif()
  404. include_directories(${THREADS_INCLUDE_DIRS})
  405. list(APPEND STORM_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
  406. if (STORM_USE_COTIRE)
  407. target_link_libraries(storm_unity ${CMAKE_THREAD_LIBS_INIT})
  408. endif(STORM_USE_COTIRE)
  409. #############################################################
  410. ##
  411. ## CUDA Library generation
  412. ##
  413. #############################################################
  414. if ("${CUDA_ROOT}" STREQUAL "")
  415. set(ENABLE_CUDA OFF)
  416. else()
  417. set(ENABLE_CUDA ON)
  418. endif()
  419. # CUDA Defines
  420. if (ENABLE_CUDA)
  421. set(STORM_CPP_CUDA_DEF "define")
  422. else()
  423. set(STORM_CPP_CUDA_DEF "undef")
  424. endif()
  425. # CUDA Defines
  426. set(STORM_CPP_CUDAFORSTORM_DEF "undef")
  427. if(ENABLE_CUDA)
  428. # Test for type alignment
  429. try_run(STORM_CUDA_RUN_RESULT_TYPEALIGNMENT STORM_CUDA_COMPILE_RESULT_TYPEALIGNMENT
  430. ${PROJECT_BINARY_DIR} "${PROJECT_SOURCE_DIR}/cuda/CMakeAlignmentCheck.cpp"
  431. COMPILE_OUTPUT_VARIABLE OUTPUT_TEST_VAR
  432. )
  433. if(NOT STORM_CUDA_COMPILE_RESULT_TYPEALIGNMENT)
  434. 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}")
  435. elseif(STORM_CUDA_RUN_RESULT_TYPEALIGNMENT EQUAL 0)
  436. message(STATUS "StoRM (CudaPlugin) - Result of Type Alignment Check: OK.")
  437. else()
  438. message(FATAL_ERROR "Storm (CudaPlugin) - Result of Type Alignment Check: FAILED (Code ${STORM_CUDA_RUN_RESULT_TYPEALIGNMENT})")
  439. endif()
  440. # Test for Float 64bit Alignment
  441. try_run(STORM_CUDA_RUN_RESULT_FLOATALIGNMENT STORM_CUDA_COMPILE_RESULT_FLOATALIGNMENT
  442. ${PROJECT_BINARY_DIR} "${PROJECT_SOURCE_DIR}/cuda/CMakeFloatAlignmentCheck.cpp"
  443. COMPILE_OUTPUT_VARIABLE OUTPUT_TEST_VAR
  444. )
  445. if(NOT STORM_CUDA_COMPILE_RESULT_FLOATALIGNMENT)
  446. 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}")
  447. elseif(STORM_CUDA_RUN_RESULT_FLOATALIGNMENT EQUAL 2)
  448. message(STATUS "Storm (CudaPlugin) - Result of Float Type Alignment Check: 64bit alignment active.")
  449. set(STORM_CUDAPLUGIN_FLOAT_64BIT_ALIGN_DEF "define")
  450. elseif(STORM_CUDA_RUN_RESULT_FLOATALIGNMENT EQUAL 3)
  451. message(STATUS "Storm (CudaPlugin) - Result of Float Type Alignment Check: 64bit alignment disabled.")
  452. set(STORM_CUDAPLUGIN_FLOAT_64BIT_ALIGN_DEF "undef")
  453. else()
  454. message(FATAL_ERROR "Storm (CudaPlugin) - Result of Float Type Alignment Check: FAILED (Code ${STORM_CUDA_RUN_RESULT_FLOATALIGNMENT})")
  455. endif()
  456. #
  457. # Make a version file containing the current version from git.
  458. #
  459. include(GetGitRevisionDescription)
  460. git_describe_checkout(STORM_GIT_VERSION_STRING)
  461. # Parse the git Tag into variables
  462. string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" STORM_CUDAPLUGIN_VERSION_MAJOR "${STORM_GIT_VERSION_STRING}")
  463. string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" STORM_CUDAPLUGIN_VERSION_MINOR "${STORM_GIT_VERSION_STRING}")
  464. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" STORM_CUDAPLUGIN_VERSION_PATCH "${STORM_GIT_VERSION_STRING}")
  465. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+)\\-.*" "\\1" STORM_CUDAPLUGIN_VERSION_COMMITS_AHEAD "${STORM_GIT_VERSION_STRING}")
  466. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-([a-z0-9]+).*" "\\1" STORM_CUDAPLUGIN_VERSION_HASH "${STORM_GIT_VERSION_STRING}")
  467. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-[a-z0-9]+\\-(.*)" "\\1" STORM_CUDAPLUGIN_VERSION_APPENDIX "${STORM_GIT_VERSION_STRING}")
  468. if ("${STORM_CUDAPLUGIN_VERSION_APPENDIX}" MATCHES "^.*dirty.*$")
  469. set(STORM_CUDAPLUGIN_VERSION_DIRTY 1)
  470. else()
  471. set(STORM_CUDAPLUGIN_VERSION_DIRTY 0)
  472. endif()
  473. 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})")
  474. # Configure a header file to pass some of the CMake settings to the source code
  475. configure_file (
  476. "${PROJECT_SOURCE_DIR}/cuda/storm-cudaplugin-config.h.in"
  477. "${PROJECT_BINARY_DIR}/include/storm-cudaplugin-config.h"
  478. )
  479. #create library
  480. find_package(CUDA REQUIRED)
  481. set(CUSP_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/resources/3rdparty/cusplibrary")
  482. find_package(Cusp REQUIRED)
  483. find_package(Thrust REQUIRED)
  484. set(STORM_CUDA_LIB_NAME "storm-cuda")
  485. file(GLOB_RECURSE STORM_CUDA_KERNEL_FILES ${PROJECT_SOURCE_DIR}/cuda/kernels/*.cu)
  486. file(GLOB_RECURSE STORM_CUDA_HEADER_FILES ${PROJECT_SOURCE_DIR}/cuda/kernels/*.h)
  487. source_group(kernels FILES ${STORM_CUDA_KERNEL_FILES} ${STORM_CUDA_HEADER_FILES})
  488. include_directories(${PROJECT_SOURCE_DIR}/cuda/kernels/)
  489. #set(CUDA_PROPAGATE_HOST_FLAGS OFF)
  490. set(CUDA_NVCC_FLAGS "-arch=sm_30")
  491. #############################################################
  492. ##
  493. ## CUSP
  494. ##
  495. #############################################################
  496. if(CUSP_FOUND)
  497. include_directories(${CUSP_INCLUDE_DIR})
  498. cuda_include_directories(${CUSP_INCLUDE_DIR})
  499. message(STATUS "Storm (CudaPlugin) - Found CUSP Version ${CUSP_VERSION} in location ${CUSP_INCLUDE_DIR}.")
  500. else()
  501. message(FATAL_ERROR "Storm (CudaPlugin) - Could not find CUSP.")
  502. endif()
  503. #############################################################
  504. ##
  505. ## Thrust
  506. ##
  507. #############################################################
  508. if(THRUST_FOUND)
  509. include_directories(${THRUST_INCLUDE_DIR})
  510. cuda_include_directories(${THRUST_INCLUDE_DIR})
  511. message(STATUS "Storm (CudaPlugin) - Found Thrust Version ${THRUST_VERSION} in location ${THRUST_INCLUDE_DIR}.")
  512. else()
  513. message(FATAL_ERROR "Storm (CudaPlugin) - Could not find Thrust. Check your CUDA installation.")
  514. endif()
  515. include_directories(${CUDA_INCLUDE_DIRS})
  516. include_directories(${ADDITIONAL_INCLUDE_DIRS})
  517. cuda_add_library(${STORM_CUDA_LIB_NAME}
  518. ${STORM_CUDA_KERNEL_FILES} ${STORM_CUDA_HEADER_FILES}
  519. )
  520. message (STATUS "Storm - Linking with CUDA.")
  521. list(APPEND STORM_LINK_LIBRARIES ${STORM_CUDA_LIB_NAME})
  522. include_directories("${PROJECT_SOURCE_DIR}/cuda/kernels/")
  523. endif()
  524. add_custom_target(copy_resources_headers DEPENDS ${CMAKE_BINARY_DIR}/include/resources/3rdparty/sparsepp/sparsepp.h ${CMAKE_BINARY_DIR}/include/resources/3rdparty/sparsepp/sparsepp.h)