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.

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