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.

542 lines
24 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. option(PARAMETRIC_SYSTEMS "Sets whether models with parameters are supported." OFF)
  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. if(${PARAMETRIC_SYSTEMS})
  71. find_package(carl REQUIRED)
  72. set(STORM_HAVE_CARL ON)
  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. message(STATUS "StoRM - Using Compiler Configuration: GCC")
  85. # Set standard flags for GCC
  86. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops")
  87. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic -DBOOST_RESULT_OF_USE_TR1")
  88. # -Werror is atm removed as this gave some problems with existing code
  89. # May be re-set later
  90. # (Thomas Heinemann, 2012-12-21)
  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. message(STATUS "StoRM - Using Compiler Configuration: 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. # 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. message(STATUS "StoRM - Using Compiler Configuration: 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. 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")
  132. set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
  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. #############################################################
  141. ##
  142. ## CMake-generated Config File for StoRM
  143. ##
  144. #############################################################
  145. #
  146. # Make a version file containing the current version from git.
  147. #
  148. include(GetGitRevisionDescription)
  149. git_describe_checkout(STORM_GIT_VERSION_STRING)
  150. message(STATUS "STORM_GIT_VERSION_STRING: ${STORM_GIT_VERSION_STRING}")
  151. # Parse the git Tag into variables
  152. string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" STORM_CPP_VERSION_MAJOR "${STORM_GIT_VERSION_STRING}")
  153. string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" STORM_CPP_VERSION_MINOR "${STORM_GIT_VERSION_STRING}")
  154. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" STORM_CPP_VERSION_PATCH "${STORM_GIT_VERSION_STRING}")
  155. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+)\\-.*" "\\1" STORM_CPP_VERSION_COMMITS_AHEAD "${STORM_GIT_VERSION_STRING}")
  156. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-([a-z0-9]+).*" "\\1" STORM_CPP_VERSION_HASH "${STORM_GIT_VERSION_STRING}")
  157. string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-[a-z0-9]+\\-(.*)" "\\1" STORM_CPP_VERSION_APPENDIX "${STORM_GIT_VERSION_STRING}")
  158. if ("${STORM_CPP_VERSION_APPENDIX}" MATCHES "^.*dirty.*$")
  159. set(STORM_CPP_VERSION_DIRTY 1)
  160. else()
  161. set(STORM_CPP_VERSION_DIRTY 0)
  162. endif()
  163. 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})")
  164. # Base path for test files
  165. set(STORM_CPP_TESTS_BASE_PATH "${PROJECT_SOURCE_DIR}/test")
  166. # Gurobi Defines
  167. if (ENABLE_GUROBI)
  168. set(STORM_CPP_GUROBI_DEF "define")
  169. else()
  170. set(STORM_CPP_GUROBI_DEF "undef")
  171. endif()
  172. # glpk defines
  173. set(STORM_CPP_GLPK_DEF "define")
  174. # Z3 Defines
  175. if (ENABLE_Z3)
  176. set(STORM_CPP_Z3_DEF "define")
  177. else()
  178. set(STORM_CPP_Z3_DEF "undef")
  179. endif()
  180. # Intel TBB Defines
  181. if (TBB_FOUND AND STORM_USE_INTELTBB)
  182. set(STORM_CPP_INTELTBB_DEF "define")
  183. else()
  184. set(STORM_CPP_INTELTBB_DEF "undef")
  185. endif()
  186. # Configure a header file to pass some of the CMake settings to the source code
  187. configure_file (
  188. "${PROJECT_SOURCE_DIR}/storm-config.h.in"
  189. "${PROJECT_BINARY_DIR}/include/storm-config.h"
  190. )
  191. # Configure a header file to pass the storm version to the source code
  192. configure_file (
  193. "${PROJECT_SOURCE_DIR}/storm-version.h.in"
  194. "${PROJECT_BINARY_DIR}/include/storm-version.h"
  195. )
  196. # Add the binary dir include directory for storm-config.h
  197. include_directories("${PROJECT_BINARY_DIR}/include")
  198. #############################################################
  199. ##
  200. ## Source file aggregation and clustering
  201. ##
  202. #############################################################
  203. file(GLOB_RECURSE STORM_HEADERS ${PROJECT_SOURCE_DIR}/src/*.h)
  204. file(GLOB_RECURSE STORM_SOURCES_WITHOUT_MAIN ${PROJECT_SOURCE_DIR}/src/*/*.cpp)
  205. file(GLOB_RECURSE STORM_MAIN_FILE ${PROJECT_SOURCE_DIR}/src/storm.cpp)
  206. file(GLOB_RECURSE STORM_PARAMETRIC_MAIN_FILE ${PROJECT_SOURCE_DIR}/src/stormParametric.cpp)
  207. set(STORM_SOURCES "${STORM_SOURCES_WITHOUT_MAIN};${STORM_MAIN_FILE};${STORM_PARAMETRIC_MAIN_FILE};")
  208. file(GLOB_RECURSE STORM_ADAPTERS_FILES ${PROJECT_SOURCE_DIR}/src/adapters/*.h ${PROJECT_SOURCE_DIR}/src/adapters/*.cpp)
  209. file(GLOB_RECURSE STORM_EXCEPTIONS_FILES ${PROJECT_SOURCE_DIR}/src/exceptions/*.h ${PROJECT_SOURCE_DIR}/src/exceptions/*.cpp)
  210. file(GLOB STORM_PROPERTIES_FILES ${PROJECT_SOURCE_DIR}/src/properties/*.h ${PROJECT_SOURCE_DIR}/src/properties/*.cpp)
  211. file(GLOB_RECURSE STORM_PROPERTIES_CSL_FILES ${PROJECT_SOURCE_DIR}/src/properties/csl/*.h ${PROJECT_SOURCE_DIR}/src/properties/csl/*.cpp)
  212. file(GLOB_RECURSE STORM_PROPERTIES_LTL_FILES ${PROJECT_SOURCE_DIR}/src/properties/ltl/*.h ${PROJECT_SOURCE_DIR}/src/properties/ltl/*.cpp)
  213. file(GLOB_RECURSE STORM_PROPERTIES_PRCTL_FILES ${PROJECT_SOURCE_DIR}/src/properties/prctl/*.h ${PROJECT_SOURCE_DIR}/src/properties/prctl/*.cpp)
  214. file(GLOB_RECURSE STORM_PROPERTIES_ACTIONS_FILES ${PROJECT_SOURCE_DIR}/src/properties/actions/*.h ${PROJECT_SOURCE_DIR}/src/properties/actions/*.cpp)
  215. file(GLOB_RECURSE STORM_MODELCHECKER_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/*.cpp)
  216. file(GLOB_RECURSE STORM_COUNTEREXAMPLES_FILES ${PROJECT_SOURCE_DIR}/src/counterexamples/*.h ${PROJECT_SOURCE_DIR}/src/counterexamples/*.cpp)
  217. file(GLOB_RECURSE STORM_MODELS_FILES ${PROJECT_SOURCE_DIR}/src/models/*.h ${PROJECT_SOURCE_DIR}/src/models/*.cpp)
  218. file(GLOB STORM_PARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/*.h ${PROJECT_SOURCE_DIR}/src/parser/*.cpp)
  219. file(GLOB_RECURSE STORM_PARSER_PRISMPARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.h ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.cpp)
  220. file(GLOB STORM_SETTINGS_FILES ${PROJECT_SOURCE_DIR}/src/settings/*.h ${PROJECT_SOURCE_DIR}/src/settings/*.cpp)
  221. file(GLOB STORM_SETTINGS_MODULES_FILES ${PROJECT_SOURCE_DIR}/src/settings/modules/*.h ${PROJECT_SOURCE_DIR}/src/settings/modules/*.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_STORAGE_SPARSE_FILES ${PROJECT_SOURCE_DIR}/src/storage/sparse/*.h ${PROJECT_SOURCE_DIR}/src/storage/sparse/*.cpp)
  228. file(GLOB_RECURSE STORM_UTILITY_FILES ${PROJECT_SOURCE_DIR}/src/utility/*.h ${PROJECT_SOURCE_DIR}/src/utility/*.cpp)
  229. # Test Sources
  230. # Note that the tests also need the source files, except for the main file
  231. file(GLOB STORM_FUNCTIONAL_TEST_MAIN_FILE ${STORM_CPP_TESTS_BASE_PATH}/functional/storm-functional-tests.cpp)
  232. file(GLOB_RECURSE STORM_FUNCTIONAL_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/functional/*.h ${STORM_CPP_TESTS_BASE_PATH}/functional/*.cpp)
  233. file(GLOB STORM_PERFORMANCE_TEST_MAIN_FILE ${STORM_CPP_TESTS_BASE_PATH}/performance/storm-performance-tests.cpp)
  234. file(GLOB_RECURSE STORM_PERFORMANCE_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/performance/*/*.h ${STORM_CPP_TESTS_BASE_PATH}/performance/*/*.cpp)
  235. # Additional include files like the storm-config.h
  236. file(GLOB_RECURSE STORM_BUILD_HEADERS ${PROJECT_BINARY_DIR}/include/*.h)
  237. # Group the headers and sources
  238. source_group(main FILES ${STORM_MAIN_FILE})
  239. source_group(adapters FILES ${STORM_ADAPTERS_FILES})
  240. source_group(exceptions FILES ${STORM_EXCEPTIONS_FILES})
  241. source_group(properties FILES ${STORM_PROPERTIES_FILES})
  242. source_group(properties\\csl FILES ${STORM_PROPERTIES_CSL_FILES})
  243. source_group(properties\\ltl FILES ${STORM_PROPERTIES_LTL_FILES})
  244. source_group(properties\\prctl FILES ${STORM_PROPERTIES_PRCTL_FILES})
  245. source_group(properties\\actions FILES ${STORM_PROPERTIES_ACTIONS_FILES})
  246. source_group(generated FILES ${STORM_BUILD_HEADERS})
  247. source_group(modelchecker FILES ${STORM_MODELCHECKER_FILES})
  248. source_group(counterexamples FILES ${STORM_COUNTEREXAMPLES_FILES})
  249. source_group(models FILES ${STORM_MODELS_FILES})
  250. source_group(parser FILES ${STORM_PARSER_FILES})
  251. source_group(parser\\prismparser FILES ${STORM_PARSER_PRISMPARSER_FILES})
  252. source_group(settings FILES ${STORM_SETTINGS_FILES})
  253. source_group(settings\\modules FILES ${STORM_SETTINGS_MODULES_FILES})
  254. source_group(solver FILES ${STORM_SOLVER_FILES})
  255. source_group(storage FILES ${STORM_STORAGE_FILES})
  256. source_group(storage\\dd FILES ${STORM_STORAGE_DD_FILES})
  257. source_group(storage\\expressions FILES ${STORM_STORAGE_EXPRESSIONS_FILES})
  258. source_group(storage\\prism FILES ${STORM_STORAGE_PRISM_FILES})
  259. source_group(storage\\sparse FILES ${STORM_STORAGE_SPARSE_FILES})
  260. source_group(utility FILES ${STORM_UTILITY_FILES})
  261. source_group(functional-test FILES ${STORM_FUNCTIONAL_TEST_FILES})
  262. source_group(performance-test FILES ${STORM_PERFORMANCE_TEST_FILES})
  263. # Add custom additional include or link directories
  264. if (ADDITIONAL_INCLUDE_DIRS)
  265. message(STATUS "StoRM - Using additional include directories ${ADDITIONAL_INCLUDE_DIRS}")
  266. include_directories(${ADDITIONAL_INCLUDE_DIRS})
  267. endif(ADDITIONAL_INCLUDE_DIRS)
  268. if (ADDITIONAL_LINK_DIRS)
  269. message(STATUS "StoRM - Using additional link directories ${ADDITIONAL_LINK_DIRS}")
  270. link_directories(${ADDITIONAL_LINK_DIRS})
  271. endif(ADDITIONAL_LINK_DIRS)
  272. #############################################################
  273. ##
  274. ## Pre executable-creation link_directories setup
  275. ##
  276. #############################################################
  277. if (ENABLE_GUROBI)
  278. link_directories("${GUROBI_ROOT}/lib")
  279. endif()
  280. if (ENABLE_Z3)
  281. link_directories("${Z3_ROOT}/bin")
  282. endif()
  283. if ((NOT Boost_LIBRARY_DIRS) OR ("${Boost_LIBRARY_DIRS}" STREQUAL ""))
  284. set(Boost_LIBRARY_DIRS "${Boost_INCLUDE_DIRS}/stage/lib")
  285. endif ()
  286. link_directories(${Boost_LIBRARY_DIRS})
  287. if (TBB_FOUND AND STORM_USE_INTELTBB)
  288. link_directories(${TBB_LIBRARY_DIRS})
  289. endif()
  290. ###############################################################################
  291. ## #
  292. ## Executable Creation #
  293. ## #
  294. ## All link_directories() calls MUST be made before this point #
  295. ## #
  296. ###############################################################################
  297. add_library(storm ${STORM_SOURCES_WITHOUT_MAIN} ${STORM_HEADERS})
  298. add_executable(storm-main ${STORM_MAIN_FILE})
  299. target_link_libraries(storm-main storm)
  300. set_target_properties(storm-main PROPERTIES OUTPUT_NAME "storm")
  301. add_executable(storm-functional-tests ${STORM_FUNCTIONAL_TEST_MAIN_FILE} ${STORM_FUNCTIONAL_TEST_FILES})
  302. target_link_libraries(storm-functional-tests storm)
  303. add_executable(storm-performance-tests ${STORM_PERFORMANCE_TEST_MAIN_FILE} ${STORM_PERFORMANCE_TEST_FILES})
  304. target_link_libraries(storm-performance-tests storm)
  305. #############################################################
  306. ##
  307. ## Boost
  308. ##
  309. #############################################################
  310. include_directories(${Boost_INCLUDE_DIRS})
  311. target_link_libraries(storm ${Boost_LIBRARIES})
  312. #message(STATUS "BOOST_INCLUDE_DIRS is ${Boost_INCLUDE_DIRS}")
  313. #message(STATUS "BOOST_LIBRARY_DIRS is ${Boost_LIBRARY_DIRS}")
  314. #############################################################
  315. ##
  316. ## CUDD
  317. ##
  318. #############################################################
  319. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0")
  320. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/cudd")
  321. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/epd")
  322. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/mtr")
  323. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/nanotrav")
  324. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/obj")
  325. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/st")
  326. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/util")
  327. target_link_libraries(storm cudd)
  328. #############################################################
  329. ##
  330. ## LTL2DSTAR
  331. ##
  332. #############################################################
  333. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1")
  334. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1/src")
  335. target_link_libraries(storm ltl2dstar)
  336. #############################################################
  337. ##
  338. ## Gurobi (optional)
  339. ##
  340. #############################################################
  341. if (ENABLE_GUROBI)
  342. message (STATUS "StoRM - Linking with Gurobi")
  343. include_directories("${GUROBI_ROOT}/include")
  344. target_link_libraries(storm "gurobi56")
  345. target_link_libraries(storm-functional-tests "gurobi56")
  346. target_link_libraries(storm-performance-tests "gurobi56")
  347. endif(ENABLE_GUROBI)
  348. #############################################################
  349. ##
  350. ## glpk
  351. ##
  352. #############################################################
  353. message (STATUS "StoRM - Linking with glpk")
  354. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/glpk-4.53")
  355. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/glpk-4.53/src")
  356. target_link_libraries(storm "glpk")
  357. #############################################################
  358. ##
  359. ## Z3 (optional)
  360. ##
  361. #############################################################
  362. if (ENABLE_Z3)
  363. message (STATUS "StoRM - Linking with Z3")
  364. include_directories("${Z3_ROOT}/include")
  365. target_link_libraries(storm ${Z3_LIB_NAME})
  366. endif(ENABLE_Z3)
  367. #############################################################
  368. ##
  369. ## carl
  370. ##
  371. #############################################################
  372. if(PARAMETRIC_SYSTEMS)
  373. message(STATUS "StoRM - Linking with carl")
  374. include_directories("${carl_INCLUDE_DIR}")
  375. target_link_libraries(storm lib_carl)
  376. target_link_libraries(storm-functional-tests lib_carl)
  377. target_link_libraries(storm-performance-tests lib_carl)
  378. endif()
  379. #############################################################
  380. ##
  381. ## Google Test gtest
  382. ##
  383. #############################################################
  384. set(gtest_force_shared_crt ON)
  385. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.7.0")
  386. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.7.0/include")
  387. enable_testing()
  388. target_link_libraries(storm-functional-tests gtest)
  389. target_link_libraries(storm-performance-tests gtest)
  390. add_test(NAME storm-functional-tests COMMAND storm-functional-tests)
  391. add_test(NAME storm-performance-tests COMMAND storm-performance-tests)
  392. #############################################################
  393. ##
  394. ## Log4CPlus
  395. ##
  396. #############################################################
  397. set(BUILD_SHARED_LIBS OFF CACHE BOOL "If TRUE, log4cplus is built as a shared library, otherwise as a static library")
  398. set(LOG4CPLUS_BUILD_LOGGINGSERVER OFF)
  399. set(LOG4CPLUS_BUILD_TESTING OFF)
  400. set(LOG4CPLUS_USE_UNICODE OFF)
  401. set(LOG4CPLUS_DEFINE_INSTALL_TARGET OFF)
  402. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1")
  403. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include")
  404. include_directories("${PROJECT_BINARY_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include") # This adds the defines.hxx file
  405. target_link_libraries(storm log4cplusS)
  406. target_link_libraries(storm-functional-tests log4cplusS)
  407. target_link_libraries(storm-performance-tests log4cplusS)
  408. if (UNIX AND NOT APPLE)
  409. target_link_libraries(storm rt)
  410. if (STORM_USE_COTIRE)
  411. target_link_libraries(storm_unity rt)
  412. endif(STORM_USE_COTIRE)
  413. endif(UNIX AND NOT APPLE)
  414. #############################################################
  415. ##
  416. ## Intel Threading Building Blocks (optional)
  417. ##
  418. #############################################################
  419. if (TBB_FOUND)
  420. message(STATUS "StoRM - Found Intel TBB with interface version ${TBB_INTERFACE_VERSION}.")
  421. if (STORM_USE_INTELTBB)
  422. message(STATUS "StoRM - Linking with Intel TBB in ${TBB_LIBRARY_DIRS}.")
  423. include_directories(${TBB_INCLUDE_DIRS})
  424. target_link_libraries(storm tbb tbbmalloc)
  425. endif(STORM_USE_INTELTBB)
  426. endif(TBB_FOUND)
  427. #############################################################
  428. ##
  429. ## Threads
  430. ##
  431. #############################################################
  432. include_directories(${THREADS_INCLUDE_DIRS})
  433. target_link_libraries(storm ${CMAKE_THREAD_LIBS_INIT})
  434. if (STORM_USE_COTIRE)
  435. target_link_libraries(storm_unity ${CMAKE_THREAD_LIBS_INIT})
  436. endif(STORM_USE_COTIRE)
  437. if (MSVC)
  438. # Add the DebugHelper DLL
  439. set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} Dbghelp.lib")
  440. target_link_libraries(storm "Dbghelp.lib")
  441. endif(MSVC)
  442. # Print Cotire Usage Status
  443. message (STATUS "StoRM - Using Cotire: ${STORM_USE_COTIRE}")
  444. if (STORM_USE_COTIRE)
  445. # Include Cotire for PCH Generation
  446. set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/resources/cmake")
  447. include(cotire)
  448. cotire(storm)
  449. target_link_libraries(storm_unity ${Boost_LIBRARIES})
  450. #cotire(storm-functional-tests)
  451. #cotire(storm-performance-tests)
  452. endif()
  453. # Link against libc++abi if requested. May be needed to build on Linux systems using clang.
  454. if (LINK_LIBCXXABI)
  455. message (STATUS "StoRM - Linking against libc++abi.")
  456. target_link_libraries(storm "c++abi")
  457. endif(LINK_LIBCXXABI)
  458. # Add a target to generate API documentation with Doxygen
  459. if(DOXYGEN_FOUND)
  460. set(CMAKE_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc")
  461. string(REGEX REPLACE ";" " " CMAKE_DOXYGEN_INPUT_LIST "${PROJECT_SOURCE_DIR}/src")
  462. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" @ONLY)
  463. add_custom_target(doc ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" COMMENT "Generating API documentation with Doxygen" VERBATIM)
  464. endif(DOXYGEN_FOUND)
  465. 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)
  466. 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)
  467. 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)
  468. set(CPPLINT_ARGS --filter=-whitespace/tab,-whitespace/line_length,-legal/copyright,-readability/streams)
  469. add_custom_target(style python cpplint.py ${CPPLINT_ARGS} `find ./src/ -iname "*.h" -or -iname "*.cpp" `)
  470. INSTALL(TARGETS storm-main storm-functional-tests storm-performance-tests
  471. RUNTIME DESTINATION bin
  472. LIBRARY DESTINATION lib
  473. ARCHIVE DESTINATION lib
  474. )
  475. include(StormCPackConfig.cmake)