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.

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