You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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