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.

609 lines
22 KiB

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