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.

555 lines
25 KiB

  1. cmake_minimum_required (VERSION 2.8.6)
  2. # Set project name
  3. project (storm CXX C)
  4. # Add base folder for better inclusion paths
  5. include_directories("${PROJECT_SOURCE_DIR}")
  6. include_directories("${PROJECT_SOURCE_DIR}/src")
  7. # Add the version of Eigen3 in the repository to the include pathes
  8. set(EIGEN3_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/resources/3rdparty/eigen")
  9. include_directories(${EIGEN3_INCLUDE_DIR})
  10. # Add the version of GMM in the repository to the include pathes
  11. set(GMMXX_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/resources/3rdparty/gmm-4.2/include")
  12. include_directories(${GMMXX_INCLUDE_DIR})
  13. #############################################################
  14. ##
  15. ## CMake options of StoRM
  16. ##
  17. #############################################################
  18. option(STORM_DEBUG "Sets whether the DEBUG mode is used" ON)
  19. option(STORM_USE_POPCNT "Sets whether the popcnt instruction is going to be used." ON)
  20. option(USE_BOOST_STATIC_LIBRARIES "Sets whether the Boost libraries should be linked statically." ON)
  21. option(STORM_USE_INTELTBB "Sets whether the Intel TBB libraries should be used." OFF)
  22. option(STORM_USE_COTIRE "Sets whether Cotire should be used (for building precompiled headers)." OFF)
  23. option(LINK_LIBCXXABI "Sets whether libc++abi should be linked." OFF)
  24. option(USE_LIBCXX "Sets whether the standard library is libc++." OFF)
  25. option(STORM_USE_CUDAFORSTORM "Sets whether StoRM is built with its CUDA extension." OFF)
  26. set(GUROBI_ROOT "" CACHE STRING "The root directory of Gurobi (if available).")
  27. set(Z3_ROOT "" CACHE STRING "The root directory of Z3 (if available).")
  28. set(ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "Additional directories added to the include directories.")
  29. set(ADDITIONAL_LINK_DIRS "" CACHE STRING "Additional directories added to the link directories.")
  30. set(CUSTOM_BOOST_ROOT "" CACHE STRING "A custom path to the Boost root directory.")
  31. #############################################################
  32. ##
  33. ## Inclusion of required libraries
  34. ##
  35. #############################################################
  36. # Add the resources/cmake folder to Module Search Path for FindTBB.cmake
  37. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/resources/cmake/")
  38. # Boost Option variables
  39. set(Boost_USE_STATIC_LIBS ON)
  40. set(Boost_USE_MULTITHREADED ON)
  41. set(Boost_USE_STATIC_RUNTIME OFF)
  42. # If a custom boost root directory was specified, we set the corresponding hint for the script to find it.
  43. if(CUSTOM_BOOST_ROOT)
  44. message(STATUS "StoRM - Using Boost from CUSTOM_BOOST_ROOT located at ${CUSTOM_BOOST_ROOT}")
  45. set(BOOST_ROOT "${CUSTOM_BOOST_ROOT}")
  46. endif(CUSTOM_BOOST_ROOT)
  47. set(TBB_INSTALL_DIR "${PROJECT_SOURCE_DIR}/resources/3rdparty/tbb42_20140122_merged-win-lin-mac")
  48. find_package(Boost REQUIRED)
  49. find_package(Doxygen REQUIRED)
  50. find_package(TBB)
  51. find_package(Threads REQUIRED)
  52. # If the DEBUG option was turned on, we will target a debug version and a release version otherwise
  53. if (STORM_DEBUG)
  54. set (CMAKE_BUILD_TYPE "DEBUG")
  55. else()
  56. set (CMAKE_BUILD_TYPE "RELEASE")
  57. endif()
  58. message(STATUS "StoRM - Building ${CMAKE_BUILD_TYPE} version.")
  59. if ("${GUROBI_ROOT}" STREQUAL "")
  60. set(ENABLE_GUROBI OFF)
  61. else()
  62. set(ENABLE_GUROBI ON)
  63. endif()
  64. if ("${Z3_ROOT}" STREQUAL "")
  65. set(ENABLE_Z3 OFF)
  66. else()
  67. set(ENABLE_Z3 ON)
  68. set(Z3_LIB_NAME "z3")
  69. endif()
  70. message(STATUS "StoRM - CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
  71. message(STATUS "StoRM - CMAKE_BUILD_TYPE (ENV): $ENV{CMAKE_BUILD_TYPE}")
  72. #############################################################
  73. ##
  74. ## Compiler specific settings and definitions
  75. ##
  76. #############################################################
  77. # Path to the no-strict-aliasing target
  78. set(CONVERSIONHELPER_TARGET "${PROJECT_SOURCE_DIR}/src/utility/ConversionHelper.cpp")
  79. if(CMAKE_COMPILER_IS_GNUCC)
  80. message(STATUS "StoRM - Using Compiler Configuration: GCC")
  81. # Set standard flags for GCC
  82. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops")
  83. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic -DBOOST_RESULT_OF_USE_TR1")
  84. # -Werror is atm removed as this gave some problems with existing code
  85. # May be re-set later
  86. # (Thomas Heinemann, 2012-12-21)
  87. # Turn on popcnt instruction if desired (yes by default)
  88. if (STORM_USE_POPCNT)
  89. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")
  90. endif(STORM_USE_POPCNT)
  91. # Set the no-strict-aliasing target for GCC
  92. set_source_files_properties(${CONVERSIONHELPER_TARGET} PROPERTIES COMPILE_FLAGS " -fno-strict-aliasing ")
  93. elseif(MSVC)
  94. message(STATUS "StoRM - Using Compiler Configuration: MSVC")
  95. # required for GMM to compile, ugly error directive in their code
  96. add_definitions(/D_SCL_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS)
  97. # required as the PRCTL Parser bloats object files (COFF) beyond their maximum size (see http://msdn.microsoft.com/en-us/library/8578y171(v=vs.110).aspx)
  98. add_definitions(/bigobj)
  99. # required by GTest and PrismGrammar::createIntegerVariable
  100. add_definitions(/D_VARIADIC_MAX=10)
  101. # Windows.h breaks GMM in gmm_except.h because of its macro definition for min and max
  102. add_definitions(/DNOMINMAX)
  103. # since nobody cares at the moment
  104. add_definitions(/wd4250)
  105. if(ENABLE_Z3)
  106. set(Z3_LIB_NAME "libz3")
  107. endif()
  108. # MSVC does not do strict-aliasing, so no option needed
  109. else(CLANG)
  110. message(STATUS "StoRM - Using Compiler Configuration: Clang (LLVM)")
  111. # As CLANG is not set as a variable, we need to set it in case we have not matched another compiler.
  112. set (CLANG ON)
  113. # Set standard flags for clang
  114. set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops -O3")
  115. if(UNIX AND NOT APPLE AND NOT USE_LIBCXX)
  116. set(CLANG_STDLIB libstdc++)
  117. message(STATUS "StoRM - Linking against libstdc++")
  118. else()
  119. set(CLANG_STDLIB libc++)
  120. message(STATUS "StoRM - Linking against libc++")
  121. # Disable Cotire
  122. set(STORM_USE_COTIRE OFF)
  123. # Set up some Xcode specific settings
  124. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
  125. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
  126. endif()
  127. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=${CLANG_STDLIB} -Wall -pedantic -Wno-unused-variable -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -ftemplate-depth=1024")
  128. set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
  129. # Turn on popcnt instruction if desired (yes by default)
  130. if (STORM_USE_POPCNT)
  131. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")
  132. endif(STORM_USE_POPCNT)
  133. # Set the no-strict-aliasing target for Clang
  134. set_source_files_properties(${CONVERSIONHELPER_TARGET} PROPERTIES COMPILE_FLAGS " -fno-strict-aliasing ")
  135. endif()
  136. #############################################################
  137. ##
  138. ## CMake-generated Config File for StoRM
  139. ##
  140. #############################################################
  141. #
  142. # Make a version file containing the current version from git.
  143. #
  144. include(GetGitRevisionDescription)
  145. git_describe_checkout(STORM_GIT_VERSION_STRING)
  146. message(STATUS "STORM_GIT_VERSION_STRING: ${STORM_GIT_VERSION_STRING}")
  147. # Parse the git Tag into variables
  148. string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" STORM_CPP_VERSION_MAJOR "${STORM_GIT_VERSION_STRING}")
  149. string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" STORM_CPP_VERSION_MINOR "${STORM_GIT_VERSION_STRING}")
  150. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" STORM_CPP_VERSION_PATCH "${STORM_GIT_VERSION_STRING}")
  151. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+)\\-.*" "\\1" STORM_CPP_VERSION_COMMITS_AHEAD "${STORM_GIT_VERSION_STRING}")
  152. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-([a-z0-9]+).*" "\\1" STORM_CPP_VERSION_HASH "${STORM_GIT_VERSION_STRING}")
  153. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-[a-z0-9]+\\-(.*)" "\\1" STORM_CPP_VERSION_APPENDIX "${STORM_GIT_VERSION_STRING}")
  154. if ("${STORM_CPP_VERSION_APPENDIX}" MATCHES "^.*dirty.*$")
  155. set(STORM_CPP_VERSION_DIRTY 1)
  156. else()
  157. set(STORM_CPP_VERSION_DIRTY 0)
  158. endif()
  159. message(STATUS "StoRM - Version information: ${STORM_CPP_VERSION_MAJOR}.${STORM_CPP_VERSION_MINOR}.${STORM_CPP_VERSION_PATCH} (${STORM_CPP_VERSION_COMMITS_AHEAD} commits ahead of Tag) build from ${STORM_CPP_VERSION_HASH} (Dirty: ${STORM_CPP_VERSION_DIRTY})")
  160. # Base path for test files
  161. set(STORM_CPP_TESTS_BASE_PATH "${PROJECT_SOURCE_DIR}/test")
  162. # Gurobi Defines
  163. if (ENABLE_GUROBI)
  164. set(STORM_CPP_GUROBI_DEF "define")
  165. else()
  166. set(STORM_CPP_GUROBI_DEF "undef")
  167. endif()
  168. # glpk defines
  169. set(STORM_CPP_GLPK_DEF "define")
  170. # CUDA Defines
  171. if (STORM_USE_CUDAFORSTORM)
  172. set(STORM_CPP_CUDAFORSTORM_DEF "define")
  173. else()
  174. set(STORM_CPP_CUDAFORSTORM_DEF "undef")
  175. endif()
  176. # Z3 Defines
  177. if (ENABLE_Z3)
  178. set(STORM_CPP_Z3_DEF "define")
  179. else()
  180. set(STORM_CPP_Z3_DEF "undef")
  181. endif()
  182. # Intel TBB Defines
  183. if (TBB_FOUND AND STORM_USE_INTELTBB)
  184. set(STORM_CPP_INTELTBB_DEF "define")
  185. else()
  186. set(STORM_CPP_INTELTBB_DEF "undef")
  187. endif()
  188. # Configure a header file to pass some of the CMake settings to the source code
  189. configure_file (
  190. "${PROJECT_SOURCE_DIR}/storm-config.h.in"
  191. "${PROJECT_BINARY_DIR}/include/storm-config.h"
  192. )
  193. # Configure a header file to pass the storm version to the source code
  194. configure_file (
  195. "${PROJECT_SOURCE_DIR}/storm-version.h.in"
  196. "${PROJECT_BINARY_DIR}/include/storm-version.h"
  197. )
  198. # Add the binary dir include directory for storm-config.h
  199. include_directories("${PROJECT_BINARY_DIR}/include")
  200. #############################################################
  201. ##
  202. ## Source file aggregation and clustering
  203. ##
  204. #############################################################
  205. file(GLOB_RECURSE STORM_HEADERS ${PROJECT_SOURCE_DIR}/src/*.h)
  206. file(GLOB_RECURSE STORM_SOURCES_WITHOUT_MAIN ${PROJECT_SOURCE_DIR}/src/*/*.cpp)
  207. file(GLOB_RECURSE STORM_MAIN_FILE ${PROJECT_SOURCE_DIR}/src/storm.cpp)
  208. set(STORM_SOURCES "${STORM_SOURCES_WITHOUT_MAIN};${STORM_MAIN_FILE}")
  209. file(GLOB_RECURSE STORM_ADAPTERS_FILES ${PROJECT_SOURCE_DIR}/src/adapters/*.h ${PROJECT_SOURCE_DIR}/src/adapters/*.cpp)
  210. file(GLOB_RECURSE STORM_EXCEPTIONS_FILES ${PROJECT_SOURCE_DIR}/src/exceptions/*.h ${PROJECT_SOURCE_DIR}/src/exceptions/*.cpp)
  211. file(GLOB STORM_FORMULA_FILES ${PROJECT_SOURCE_DIR}/src/formula/*.h ${PROJECT_SOURCE_DIR}/src/formula/*.cpp)
  212. file(GLOB_RECURSE STORM_FORMULA_ABSTRACT_FILES ${PROJECT_SOURCE_DIR}/src/formula/abstract/*.h ${PROJECT_SOURCE_DIR}/src/formula/abstract/*.cpp)
  213. file(GLOB_RECURSE STORM_FORMULA_CSL_FILES ${PROJECT_SOURCE_DIR}/src/formula/Csl/*.h ${PROJECT_SOURCE_DIR}/src/formula/Csl/*.cpp)
  214. file(GLOB_RECURSE STORM_FORMULA_LTL_FILES ${PROJECT_SOURCE_DIR}/src/formula/Ltl/*.h ${PROJECT_SOURCE_DIR}/src/formula/Ltl/*.cpp)
  215. file(GLOB_RECURSE STORM_FORMULA_PRCTL_FILES ${PROJECT_SOURCE_DIR}/src/formula/Prctl/*.h ${PROJECT_SOURCE_DIR}/src/formula/Prctl/*.cpp)
  216. file(GLOB_RECURSE STORM_MODELCHECKER_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/*.cpp)
  217. file(GLOB_RECURSE STORM_COUNTEREXAMPLES_FILES ${PROJECT_SOURCE_DIR}/src/counterexamples/*.h ${PROJECT_SOURCE_DIR}/src/counterexamples/*.cpp)
  218. file(GLOB_RECURSE STORM_MODELS_FILES ${PROJECT_SOURCE_DIR}/src/models/*.h ${PROJECT_SOURCE_DIR}/src/models/*.cpp)
  219. file(GLOB STORM_PARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/*.h ${PROJECT_SOURCE_DIR}/src/parser/*.cpp)
  220. file(GLOB_RECURSE STORM_PARSER_PRISMPARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.h ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.cpp)
  221. file(GLOB_RECURSE STORM_SETTINGS_FILES ${PROJECT_SOURCE_DIR}/src/settings/*.h ${PROJECT_SOURCE_DIR}/src/settings/*.cpp)
  222. file(GLOB_RECURSE STORM_SOLVER_FILES ${PROJECT_SOURCE_DIR}/src/solver/*.h ${PROJECT_SOURCE_DIR}/src/solver/*.cpp)
  223. file(GLOB STORM_STORAGE_FILES ${PROJECT_SOURCE_DIR}/src/storage/*.h ${PROJECT_SOURCE_DIR}/src/storage/*.cpp)
  224. file(GLOB_RECURSE STORM_STORAGE_DD_FILES ${PROJECT_SOURCE_DIR}/src/storage/dd/*.h ${PROJECT_SOURCE_DIR}/src/storage/dd/*.cpp)
  225. file(GLOB_RECURSE STORM_STORAGE_EXPRESSIONS_FILES ${PROJECT_SOURCE_DIR}/src/storage/expressions/*.h ${PROJECT_SOURCE_DIR}/src/storage/expressions/*.cpp)
  226. file(GLOB_RECURSE STORM_STORAGE_PRISM_FILES ${PROJECT_SOURCE_DIR}/src/storage/prism/*.h ${PROJECT_SOURCE_DIR}/src/storage/prism/*.cpp)
  227. file(GLOB_RECURSE STORM_UTILITY_FILES ${PROJECT_SOURCE_DIR}/src/utility/*.h ${PROJECT_SOURCE_DIR}/src/utility/*.cpp)
  228. # Test Sources
  229. # Note that the tests also need the source files, except for the main file
  230. file(GLOB_RECURSE STORM_FUNCTIONAL_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/functional/*.h ${STORM_CPP_TESTS_BASE_PATH}/functional/*.cpp)
  231. file(GLOB_RECURSE STORM_PERFORMANCE_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/performance/*.h ${STORM_CPP_TESTS_BASE_PATH}/performance/*.cpp)
  232. # Additional include files like the storm-config.h
  233. file(GLOB_RECURSE STORM_BUILD_HEADERS ${PROJECT_BINARY_DIR}/include/*.h)
  234. # Group the headers and sources
  235. source_group(main FILES ${STORM_MAIN_FILE})
  236. source_group(adapters FILES ${STORM_ADAPTERS_FILES})
  237. source_group(exceptions FILES ${STORM_EXCEPTIONS_FILES})
  238. source_group(formula FILES ${STORM_FORMULA_FILES})
  239. source_group(formula\\abstract FILES ${STORM_FORMULA_ABSTRACT_FILES})
  240. source_group(formula\\csl FILES ${STORM_FORMULA_CSL_FILES})
  241. source_group(formula\\ltl FILES ${STORM_FORMULA_LTL_FILES})
  242. source_group(formula\\prctl FILES ${STORM_FORMULA_PRCTL_FILES})
  243. source_group(generated FILES ${STORM_BUILD_HEADERS})
  244. source_group(modelchecker FILES ${STORM_MODELCHECKER_FILES})
  245. source_group(counterexamples FILES ${STORM_COUNTEREXAMPLES_FILES})
  246. source_group(models FILES ${STORM_MODELS_FILES})
  247. source_group(parser FILES ${STORM_PARSER_FILES})
  248. source_group(parser\\prismparser FILES ${STORM_PARSER_PRISMPARSER_FILES})
  249. source_group(settings FILES ${STORM_SETTINGS_FILES})
  250. source_group(solver FILES ${STORM_SOLVER_FILES})
  251. source_group(storage FILES ${STORM_STORAGE_FILES})
  252. source_group(storage\\dd FILES ${STORM_STORAGE_DD_FILES})
  253. source_group(storage\\expressions FILES ${STORM_STORAGE_EXPRESSIONS_FILES})
  254. source_group(storage\\prism FILES ${STORM_STORAGE_PRISM_FILES})
  255. source_group(utility FILES ${STORM_UTILITY_FILES})
  256. source_group(functional-test FILES ${STORM_FUNCTIONAL_TEST_FILES})
  257. source_group(performance-test FILES ${STORM_PERFORMANCE_TEST_FILES})
  258. # Add custom additional include or link directories
  259. if (ADDITIONAL_INCLUDE_DIRS)
  260. message(STATUS "StoRM - Using additional include directories ${ADDITIONAL_INCLUDE_DIRS}")
  261. include_directories(${ADDITIONAL_INCLUDE_DIRS})
  262. endif(ADDITIONAL_INCLUDE_DIRS)
  263. if (ADDITIONAL_LINK_DIRS)
  264. message(STATUS "StoRM - Using additional link directories ${ADDITIONAL_LINK_DIRS}")
  265. link_directories(${ADDITIONAL_LINK_DIRS})
  266. endif(ADDITIONAL_LINK_DIRS)
  267. #############################################################
  268. ##
  269. ## Pre executable-creation link_directories setup
  270. ##
  271. #############################################################
  272. if (ENABLE_GUROBI)
  273. link_directories("${GUROBI_ROOT}/lib")
  274. endif()
  275. if (ENABLE_Z3)
  276. link_directories("${Z3_ROOT}/bin")
  277. endif()
  278. if (STORM_USE_CUDAFORSTORM)
  279. link_directories("${PROJECT_BINARY_DIR}/cudaForStorm/lib")
  280. endif()
  281. if ((NOT Boost_LIBRARY_DIRS) OR ("${Boost_LIBRARY_DIRS}" STREQUAL ""))
  282. set(Boost_LIBRARY_DIRS "${Boost_INCLUDE_DIRS}/stage/lib")
  283. endif ()
  284. link_directories(${Boost_LIBRARY_DIRS})
  285. if (TBB_FOUND AND STORM_USE_INTELTBB)
  286. link_directories(${TBB_LIBRARY_DIRS})
  287. endif()
  288. ###############################################################################
  289. ## #
  290. ## Executable Creation #
  291. ## #
  292. ## All link_directories() calls MUST be made before this point #
  293. ## #
  294. ###############################################################################
  295. add_executable(storm ${STORM_SOURCES} ${STORM_HEADERS} ${STORM_BUILD_HEADERS})
  296. add_executable(storm-functional-tests ${STORM_FUNCTIONAL_TEST_FILES} ${STORM_SOURCES_WITHOUT_MAIN} ${STORM_HEADERS} ${STORM_BUILD_HEADERS})
  297. add_executable(storm-performance-tests ${STORM_PERFORMANCE_TEST_FILES} ${STORM_SOURCES_WITHOUT_MAIN} ${STORM_HEADERS} ${STORM_BUILD_HEADERS})
  298. #############################################################
  299. ##
  300. ## Boost
  301. ##
  302. #############################################################
  303. include_directories(${Boost_INCLUDE_DIRS})
  304. target_link_libraries(storm ${Boost_LIBRARIES})
  305. target_link_libraries(storm-functional-tests ${Boost_LIBRARIES})
  306. target_link_libraries(storm-performance-tests ${Boost_LIBRARIES})
  307. #message(STATUS "BOOST_INCLUDE_DIRS is ${Boost_INCLUDE_DIRS}")
  308. #message(STATUS "BOOST_LIBRARY_DIRS is ${Boost_LIBRARY_DIRS}")
  309. #############################################################
  310. ##
  311. ## CUDA For Storm
  312. ##
  313. #############################################################
  314. if (STORM_USE_CUDAFORSTORM)
  315. message (STATUS "StoRM - Linking with CudaForStorm")
  316. include_directories("${PROJECT_BINARY_DIR}/cudaForStorm/include")
  317. include_directories("${PROJECT_SOURCE_DIR}/resources/cudaForStorm")
  318. target_link_libraries(storm cudaForStorm)
  319. target_link_libraries(storm-functional-tests cudaForStorm)
  320. target_link_libraries(storm-performance-tests cudaForStorm)
  321. endif(STORM_USE_CUDAFORSTORM)
  322. #############################################################
  323. ##
  324. ## CUDD
  325. ##
  326. #############################################################
  327. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0")
  328. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/cudd")
  329. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/epd")
  330. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/mtr")
  331. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/nanotrav")
  332. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/obj")
  333. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/st")
  334. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/util")
  335. target_link_libraries(storm cudd)
  336. target_link_libraries(storm-functional-tests cudd)
  337. target_link_libraries(storm-performance-tests cudd)
  338. #############################################################
  339. ##
  340. ## LTL2DSTAR
  341. ##
  342. #############################################################
  343. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1")
  344. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1/src")
  345. target_link_libraries(storm ltl2dstar)
  346. target_link_libraries(storm-functional-tests ltl2dstar)
  347. target_link_libraries(storm-performance-tests ltl2dstar)
  348. #############################################################
  349. ##
  350. ## Gurobi (optional)
  351. ##
  352. #############################################################
  353. if (ENABLE_GUROBI)
  354. message (STATUS "StoRM - Linking with Gurobi")
  355. include_directories("${GUROBI_ROOT}/include")
  356. target_link_libraries(storm "gurobi56")
  357. target_link_libraries(storm-functional-tests "gurobi56")
  358. target_link_libraries(storm-performance-tests "gurobi56")
  359. endif(ENABLE_GUROBI)
  360. #############################################################
  361. ##
  362. ## glpk
  363. ##
  364. #############################################################
  365. message (STATUS "StoRM - Linking with glpk")
  366. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/glpk-4.53")
  367. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/glpk-4.53/src")
  368. target_link_libraries(storm "glpk")
  369. target_link_libraries(storm-functional-tests "glpk")
  370. target_link_libraries(storm-performance-tests "glpk")
  371. #############################################################
  372. ##
  373. ## Z3 (optional)
  374. ##
  375. #############################################################
  376. if (ENABLE_Z3)
  377. message (STATUS "StoRM - Linking with Z3")
  378. include_directories("${Z3_ROOT}/include")
  379. target_link_libraries(storm ${Z3_LIB_NAME})
  380. target_link_libraries(storm-functional-tests ${Z3_LIB_NAME})
  381. target_link_libraries(storm-performance-tests ${Z3_LIB_NAME})
  382. endif(ENABLE_Z3)
  383. #############################################################
  384. ##
  385. ## Google Test gtest
  386. ##
  387. #############################################################
  388. set(gtest_force_shared_crt ON)
  389. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.7.0")
  390. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.7.0/include")
  391. enable_testing()
  392. target_link_libraries(storm-functional-tests gtest)
  393. target_link_libraries(storm-performance-tests gtest)
  394. add_test(NAME storm-functional-tests COMMAND storm-functional-tests)
  395. add_test(NAME storm-performance-tests COMMAND storm-performance-tests)
  396. #############################################################
  397. ##
  398. ## Log4CPlus
  399. ##
  400. #############################################################
  401. set(BUILD_SHARED_LIBS OFF CACHE BOOL "If TRUE, log4cplus is built as a shared library, otherwise as a static library")
  402. set(LOG4CPLUS_BUILD_LOGGINGSERVER OFF)
  403. set(LOG4CPLUS_BUILD_TESTING OFF)
  404. set(LOG4CPLUS_USE_UNICODE OFF)
  405. set(LOG4CPLUS_DEFINE_INSTALL_TARGET OFF)
  406. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1")
  407. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include")
  408. include_directories("${PROJECT_BINARY_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include") # This adds the defines.hxx file
  409. target_link_libraries(storm log4cplusS)
  410. target_link_libraries(storm-functional-tests log4cplusS)
  411. target_link_libraries(storm-performance-tests log4cplusS)
  412. if (UNIX AND NOT APPLE)
  413. target_link_libraries(storm rt)
  414. if (STORM_USE_COTIRE)
  415. target_link_libraries(storm_unity rt)
  416. endif(STORM_USE_COTIRE)
  417. target_link_libraries(storm-functional-tests rt)
  418. target_link_libraries(storm-performance-tests rt)
  419. endif(UNIX AND NOT APPLE)
  420. #############################################################
  421. ##
  422. ## Intel Threading Building Blocks (optional)
  423. ##
  424. #############################################################
  425. if (TBB_FOUND)
  426. message(STATUS "StoRM - Found Intel TBB with interface version ${TBB_INTERFACE_VERSION}.")
  427. if (STORM_USE_INTELTBB)
  428. message(STATUS "StoRM - Linking with Intel TBB in ${TBB_LIBRARY_DIRS}.")
  429. include_directories(${TBB_INCLUDE_DIRS})
  430. target_link_libraries(storm tbb tbbmalloc)
  431. target_link_libraries(storm-functional-tests tbb tbbmalloc)
  432. target_link_libraries(storm-performance-tests tbb tbbmalloc)
  433. endif(STORM_USE_INTELTBB)
  434. endif(TBB_FOUND)
  435. #############################################################
  436. ##
  437. ## Threads
  438. ##
  439. #############################################################
  440. include_directories(${THREADS_INCLUDE_DIRS})
  441. target_link_libraries(storm ${CMAKE_THREAD_LIBS_INIT})
  442. if (STORM_USE_COTIRE)
  443. target_link_libraries(storm_unity ${CMAKE_THREAD_LIBS_INIT})
  444. endif(STORM_USE_COTIRE)
  445. target_link_libraries(storm-functional-tests ${CMAKE_THREAD_LIBS_INIT})
  446. target_link_libraries(storm-performance-tests ${CMAKE_THREAD_LIBS_INIT})
  447. if (MSVC)
  448. # Add the DebugHelper DLL
  449. set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} Dbghelp.lib")
  450. target_link_libraries(storm "Dbghelp.lib")
  451. target_link_libraries(storm-functional-tests "Dbghelp.lib")
  452. target_link_libraries(storm-performance-tests "Dbghelp.lib")
  453. endif(MSVC)
  454. # Print Cotire Usage Status
  455. message (STATUS "StoRM - Using Cotire: ${STORM_USE_COTIRE}")
  456. if (STORM_USE_COTIRE)
  457. # Include Cotire for PCH Generation
  458. set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/resources/cmake")
  459. include(cotire)
  460. cotire(storm)
  461. target_link_libraries(storm_unity ${Boost_LIBRARIES})
  462. #cotire(storm-functional-tests)
  463. #cotire(storm-performance-tests)
  464. endif()
  465. # Link against libc++abi if requested. May be needed to build on Linux systems using clang.
  466. if (LINK_LIBCXXABI)
  467. message (STATUS "StoRM - Linking against libc++abi.")
  468. target_link_libraries(storm "c++abi")
  469. target_link_libraries(storm-functional-tests "c++abi")
  470. target_link_libraries(storm-performance-tests "c++abi")
  471. endif(LINK_LIBCXXABI)
  472. # Add a target to generate API documentation with Doxygen
  473. if(DOXYGEN_FOUND)
  474. set(CMAKE_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc")
  475. string(REGEX REPLACE ";" " " CMAKE_DOXYGEN_INPUT_LIST "${PROJECT_SOURCE_DIR}/src")
  476. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" @ONLY)
  477. add_custom_target(doc ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" COMMENT "Generating API documentation with Doxygen" VERBATIM)
  478. endif(DOXYGEN_FOUND)
  479. add_custom_target(memcheck valgrind --leak-check=full --show-reachable=yes ${PROJECT_BINARY_DIR}/storm -v --fix-deadlocks ${PROJECT_SOURCE_DIR}/examples/dtmc/crowds/crowds5_5.tra examples/dtmc/crowds/crowds5_5.lab DEPENDS storm)
  480. add_custom_target(memcheck-functional-tests valgrind --leak-check=full --show-reachable=yes ${PROJECT_BINARY_DIR}/storm-functional-tests -v --fix-deadlocks DEPENDS storm-functional-tests)
  481. add_custom_target(memcheck-performance-tests valgrind --leak-check=full --show-reachable=yes ${PROJECT_BINARY_DIR}/storm-performance-tests -v --fix-deadlocks DEPENDS storm-performance-tests)
  482. set(CPPLINT_ARGS --filter=-whitespace/tab,-whitespace/line_length,-legal/copyright,-readability/streams)
  483. add_custom_target(style python cpplint.py ${CPPLINT_ARGS} `find ./src/ -iname "*.h" -or -iname "*.cpp" `)
  484. INSTALL(TARGETS storm storm-functional-tests storm-performance-tests
  485. RUNTIME DESTINATION bin
  486. LIBRARY DESTINATION lib
  487. ARCHIVE DESTINATION lib
  488. )
  489. include(StormCPackConfig.cmake)