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.

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