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.

597 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. ##
  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. if (NOT STORM_FORCE_SHIPPED_CARL)
  158. find_package(carl QUIET)
  159. endif()
  160. if(carl_FOUND AND NOT STORM_FORCE_SHIPPED_CARL)
  161. set(STORM_SHIPPED_CARL OFF)
  162. set(STORM_HAVE_CARL ON)
  163. message(STATUS "storm - Use system version of carl.")
  164. message(STATUS "storm - Linking with carl ${carl_VERSION} (CARL_USE_CLN_NUMBERS: ${CARL_USE_CLN_NUMBERS}).")
  165. set(STORM_HAVE_CLN ${CARL_USE_CLN_NUMBERS})
  166. else()
  167. set(STORM_SHIPPED_CARL ON)
  168. # The first external project will be built at *configure stage*
  169. message("START CARL CONFIG PROCESS")
  170. file(MAKE_DIRECTORY ${STORM_3RDPARTY_BINARY_DIR}/carl_download)
  171. execute_process(
  172. COMMAND ${CMAKE_COMMAND} ${STORM_3RDPARTY_SOURCE_DIR}/carl "-DSTORM_3RDPARTY_BINARY_DIR=${STORM_3RDPARTY_BINARY_DIR}"
  173. WORKING_DIRECTORY ${STORM_3RDPARTY_BINARY_DIR}/carl_download
  174. OUTPUT_VARIABLE carlconfig_out
  175. RESULT_VARIABLE carlconfig_result)
  176. if(NOT carlconfig_result)
  177. message("${carlconfig_out}")
  178. endif()
  179. execute_process(
  180. COMMAND ${CMAKE_COMMAND} --build . --target carl-config
  181. WORKING_DIRECTORY ${STORM_3RDPARTY_BINARY_DIR}/carl_download
  182. OUTPUT_VARIABLE carlconfig_out
  183. RESULT_VARIABLE carlconfig_result
  184. )
  185. if(NOT carlconfig_result)
  186. message("${carlconfig_out}")
  187. endif()
  188. message("END CARL CONFIG PROCESS")
  189. message(STATUS "storm - Using shipped version of carl.")
  190. ExternalProject_Add(
  191. carl
  192. SOURCE_DIR ${STORM_3RDPARTY_BINARY_DIR}/carl
  193. CONFIGURE_COMMAND ""
  194. BUILD_IN_SOURCE 1
  195. BUILD_COMMAND make lib_carl
  196. INSTALL_COMMAND make install
  197. LOG_BUILD ON
  198. LOG_INSTALL ON
  199. BUILD_BYPRODUCTS ${STORM_3RDPARTY_BINARY_DIR}/carl/lib/libcarl${DYNAMIC_EXT}
  200. )
  201. include(${STORM_3RDPARTY_BINARY_DIR}/carl/carlConfig.cmake)
  202. message("CARL_USE_CLN_NUMBERS: ${CARL_USE_CLN_NUMBERS}")
  203. set(STORM_HAVE_CLN ${CARL_USE_CLN_NUMBERS})
  204. add_dependencies(resources carl)
  205. set(carl_INCLUDE_DIR "${STORM_3RDPARTY_BINARY_DIR}/carl/include/")
  206. set(carl_LIBRARIES ${STORM_3RDPARTY_BINARY_DIR}/carl/lib/libcarl${DYNAMIC_EXT})
  207. set(STORM_HAVE_CARL ON)
  208. # install the carl dynamic library if we build it
  209. install(FILES ${STORM_3RDPARTY_BINARY_DIR}/carl/lib/libcarl.1.0.0${DYNAMIC_EXT} DESTINATION lib)
  210. endif()
  211. if(STORM_USE_CLN_NUMBERS AND NOT STORM_HAVE_CLN)
  212. message(FATAL_ERROR "Cannot use CLN numbers if carl is build without")
  213. endif()
  214. list(APPEND STORM_DEP_IMP_TARGETS lib_carl)
  215. endif()
  216. #############################################################
  217. ##
  218. ## SMT-RAT
  219. ##
  220. #############################################################
  221. set(STORM_HAVE_SMTRAT OFF)
  222. if(USE_SMTRAT)
  223. find_package(smtrat QUIET REQUIRED)
  224. if(smtrat_FOUND)
  225. set(STORM_HAVE_SMTRAT ON)
  226. message(STATUS "storm - Linking with smtrat.")
  227. include_directories("${smtrat_INCLUDE_DIR}")
  228. list(APPEND STORM_LINK_LIBRARIES ${smtrat_LIBRARIES})
  229. else()
  230. message(FATAL_ERROR "storm - SMT-RAT was requested but not found")
  231. endif()
  232. endif()
  233. #############################################################
  234. ##
  235. ## HyPro
  236. ##
  237. #############################################################
  238. set(STORM_HAVE_HYPRO OFF)
  239. if(USE_HYPRO)
  240. find_package(hypro QUIET REQUIRED)
  241. if(hypro_FOUND)
  242. set(STORM_HAVE_HYPRO ON)
  243. message(STATUS "storm - Linking with hypro.")
  244. include_directories("${hypro_INCLUDE_DIR}")
  245. list(APPEND STORM_LINK_LIBRARIES ${hypro_LIBRARIES})
  246. else()
  247. message(FATAL_ERROR "storm - HyPro was requested but not found")
  248. endif()
  249. endif()
  250. #############################################################
  251. ##
  252. ## gmp
  253. ##
  254. #############################################################
  255. # GMP is optional (unless MathSAT is used, see below)
  256. find_package(GMP QUIET)
  257. #############################################################
  258. ##
  259. ## MathSAT (optional)
  260. ##
  261. #############################################################
  262. if ("${MSAT_ROOT}" STREQUAL "")
  263. set(ENABLE_MSAT OFF)
  264. else()
  265. set(ENABLE_MSAT ON)
  266. endif()
  267. # MathSAT Defines
  268. set(STORM_HAVE_MSAT ${ENABLE_MSAT})
  269. if (ENABLE_MSAT)
  270. message (STATUS "storm - Linking with MathSAT.")
  271. link_directories("${MSAT_ROOT}/lib")
  272. include_directories("${MSAT_ROOT}/include")
  273. list(APPEND STORM_LINK_LIBRARIES "mathsat")
  274. if(GMP_FOUND)
  275. include_directories("${GMP_INCLUDE_DIR}")
  276. list(APPEND STORM_LINK_LIBRARIES ${GMP_LIBRARY})
  277. elseif(MPIR_FOUND)
  278. include_directories("${GMP_INCLUDE_DIR}")
  279. list(APPEND STORM_LINK_LIBRARIES ${GMP_MPIR_LIBRARY})
  280. list(APPEND STORM_LINK_LIBRARIES ${GMP_MPIRXX_LIBRARY})
  281. else(GMP_FOUND)
  282. message(FATAL_ERROR "GMP is required for MathSAT, but was not found!")
  283. endif(GMP_FOUND)
  284. endif(ENABLE_MSAT)
  285. #############################################################
  286. ##
  287. ## Xerces
  288. ##
  289. #############################################################
  290. include(${STORM_3RDPARTY_SOURCE_DIR}/include_xerces.cmake)
  291. #############################################################
  292. ##
  293. ## Sylvan
  294. ##
  295. #############################################################
  296. ExternalProject_Add(
  297. sylvan
  298. DOWNLOAD_COMMAND ""
  299. PREFIX "sylvan"
  300. SOURCE_DIR ${STORM_3RDPARTY_SOURCE_DIR}/sylvan
  301. CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DSYLVAN_BUILD_TEST=Off -DSYLVAN_BUILD_EXAMPLES=Off -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DUSE_CARL=ON -Dcarl_INCLUDE_DIR=${carl_INCLUDE_DIR} -DSYLVAN_PORTABLE=${STORM_PORTABLE} -Dcarl_LIBRARIES=${carl_LIBRARIES}
  302. BINARY_DIR ${STORM_3RDPARTY_BINARY_DIR}/sylvan
  303. BUILD_IN_SOURCE 0
  304. INSTALL_COMMAND ""
  305. INSTALL_DIR ${STORM_3RDPARTY_BINARY_DIR}/sylvan
  306. LOG_CONFIGURE ON
  307. LOG_BUILD ON
  308. BUILD_BYPRODUCTS ${STORM_3RDPARTY_BINARY_DIR}/sylvan/src/libsylvan${STATIC_EXT}
  309. )
  310. ExternalProject_Get_Property(sylvan source_dir)
  311. ExternalProject_Get_Property(sylvan binary_dir)
  312. set(Sylvan_INCLUDE_DIR "${source_dir}/src")
  313. set(Sylvan_LIBRARY "${binary_dir}/src/libsylvan${STATIC_EXT}")
  314. message(STATUS "storm - Using shipped version of sylvan.")
  315. message(STATUS "storm - Linking with sylvan.")
  316. add_imported_library(sylvan STATIC ${Sylvan_LIBRARY} ${Sylvan_INCLUDE_DIR})
  317. add_dependencies(sylvan_STATIC sylvan)
  318. if(STORM_SHIPPED_CARL)
  319. add_dependencies(sylvan carl)
  320. endif()
  321. list(APPEND STORM_DEP_TARGETS sylvan_STATIC)
  322. find_package(Hwloc QUIET REQUIRED)
  323. if(HWLOC_FOUND)
  324. message(STATUS "storm - Linking with hwloc ${HWLOC_VERSION}.")
  325. add_imported_library(hwloc STATIC ${HWLOC_LIBRARIES} "")
  326. list(APPEND STORM_DEP_TARGETS hwloc_STATIC)
  327. else()
  328. if(${OPERATING_SYSTEM} MATCHES "Linux")
  329. message(FATAL_ERROR "HWLOC is required on Linux 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()
  513. 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)