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.

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