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.

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