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.

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