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.

520 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. #############################################################
  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 ("${Z3_ROOT}" STREQUAL "")
  64. set(ENABLE_Z3 OFF)
  65. else()
  66. set(ENABLE_Z3 ON)
  67. set(Z3_LIB_NAME "z3")
  68. endif()
  69. message(STATUS "StoRM - CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
  70. message(STATUS "StoRM - CMAKE_BUILD_TYPE (ENV): $ENV{CMAKE_BUILD_TYPE}")
  71. #############################################################
  72. ##
  73. ## Compiler specific settings and definitions
  74. ##
  75. #############################################################
  76. # Path to the no-strict-aliasing target
  77. set(CONVERSIONHELPER_TARGET "${PROJECT_SOURCE_DIR}/src/utility/ConversionHelper.cpp")
  78. if(CMAKE_COMPILER_IS_GNUCC)
  79. set(STORM_COMPILED_BY "GCC")
  80. # Set standard flags for GCC
  81. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops")
  82. add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
  83. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic")
  84. # Turn on popcnt instruction if desired (yes by default)
  85. if (STORM_USE_POPCNT)
  86. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")
  87. endif(STORM_USE_POPCNT)
  88. # Set the no-strict-aliasing target for GCC
  89. set_source_files_properties(${CONVERSIONHELPER_TARGET} PROPERTIES COMPILE_FLAGS " -fno-strict-aliasing ")
  90. elseif(MSVC)
  91. set(STORM_COMPILED_BY "MSVC")
  92. # required for GMM to compile, ugly error directive in their code
  93. add_definitions(/D_SCL_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS)
  94. # 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)
  95. add_definitions(/bigobj)
  96. # required by GTest and PrismGrammar::createIntegerVariable
  97. add_definitions(/D_VARIADIC_MAX=10)
  98. # Windows.h breaks GMM in gmm_except.h because of its macro definition for min and max
  99. add_definitions(/DNOMINMAX)
  100. # Boost Defs, required for using boost's transform iterator
  101. add_definitions(/DBOOST_RESULT_OF_USE_DECLTYPE)
  102. # since nobody cares at the moment
  103. add_definitions(/wd4250)
  104. if(ENABLE_Z3)
  105. set(Z3_LIB_NAME "libz3")
  106. endif()
  107. # MSVC does not do strict-aliasing, so no option needed
  108. else(CLANG)
  109. set(STORM_COMPILED_BY "Clang (LLVM)")
  110. # As CLANG is not set as a variable, we need to set it in case we have not matched another compiler.
  111. set (CLANG ON)
  112. # Set standard flags for clang
  113. set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops -O3")
  114. if(UNIX AND NOT APPLE AND NOT USE_LIBCXX)
  115. set(CLANG_STDLIB libstdc++)
  116. message(STATUS "StoRM - Linking against libstdc++")
  117. else()
  118. set(CLANG_STDLIB libc++)
  119. message(STATUS "StoRM - Linking against libc++")
  120. # Disable Cotire
  121. set(STORM_USE_COTIRE OFF)
  122. # Set up some Xcode specific settings
  123. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
  124. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
  125. endif()
  126. add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
  127. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=${CLANG_STDLIB} -Wall -pedantic -Wno-unused-variable -ftemplate-depth=1024")
  128. # Turn on popcnt instruction if desired (yes by default)
  129. if (STORM_USE_POPCNT)
  130. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")
  131. endif(STORM_USE_POPCNT)
  132. # Set the no-strict-aliasing target for Clang
  133. set_source_files_properties(${CONVERSIONHELPER_TARGET} PROPERTIES COMPILE_FLAGS " -fno-strict-aliasing ")
  134. endif()
  135. message(STATUS "StoRM - Using Compiler Configuration: ${STORM_COMPILED_BY}")
  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. # Z3 Defines
  171. if (ENABLE_Z3)
  172. set(STORM_CPP_Z3_DEF "define")
  173. else()
  174. set(STORM_CPP_Z3_DEF "undef")
  175. endif()
  176. # Intel TBB Defines
  177. if (TBB_FOUND AND STORM_USE_INTELTBB)
  178. set(STORM_CPP_INTELTBB_DEF "define")
  179. else()
  180. set(STORM_CPP_INTELTBB_DEF "undef")
  181. endif()
  182. # Configure a header file to pass some of the CMake settings to the source code
  183. configure_file (
  184. "${PROJECT_SOURCE_DIR}/storm-config.h.in"
  185. "${PROJECT_BINARY_DIR}/include/storm-config.h"
  186. )
  187. # Configure a header file to pass the storm version to the source code
  188. configure_file (
  189. "${PROJECT_SOURCE_DIR}/storm-version.cpp.in"
  190. "${PROJECT_SOURCE_DIR}/src/utility/storm-version.cpp"
  191. )
  192. # Add the binary dir include directory for storm-config.h
  193. include_directories("${PROJECT_BINARY_DIR}/include")
  194. #############################################################
  195. ##
  196. ## Source file aggregation and clustering
  197. ##
  198. #############################################################
  199. file(GLOB_RECURSE STORM_HEADERS ${PROJECT_SOURCE_DIR}/src/*.h)
  200. file(GLOB_RECURSE STORM_SOURCES_WITHOUT_MAIN ${PROJECT_SOURCE_DIR}/src/*/*.cpp)
  201. file(GLOB_RECURSE STORM_MAIN_FILE ${PROJECT_SOURCE_DIR}/src/storm.cpp)
  202. set(STORM_SOURCES "${STORM_SOURCES_WITHOUT_MAIN};${STORM_MAIN_FILE}")
  203. file(GLOB_RECURSE STORM_ADAPTERS_FILES ${PROJECT_SOURCE_DIR}/src/adapters/*.h ${PROJECT_SOURCE_DIR}/src/adapters/*.cpp)
  204. file(GLOB_RECURSE STORM_EXCEPTIONS_FILES ${PROJECT_SOURCE_DIR}/src/exceptions/*.h ${PROJECT_SOURCE_DIR}/src/exceptions/*.cpp)
  205. file(GLOB STORM_PROPERTIES_FILES ${PROJECT_SOURCE_DIR}/src/properties/*.h ${PROJECT_SOURCE_DIR}/src/properties/*.cpp)
  206. file(GLOB_RECURSE STORM_PROPERTIES_CSL_FILES ${PROJECT_SOURCE_DIR}/src/properties/csl/*.h ${PROJECT_SOURCE_DIR}/src/properties/csl/*.cpp)
  207. file(GLOB_RECURSE STORM_PROPERTIES_LTL_FILES ${PROJECT_SOURCE_DIR}/src/properties/ltl/*.h ${PROJECT_SOURCE_DIR}/src/properties/ltl/*.cpp)
  208. file(GLOB_RECURSE STORM_PROPERTIES_PRCTL_FILES ${PROJECT_SOURCE_DIR}/src/properties/prctl/*.h ${PROJECT_SOURCE_DIR}/src/properties/prctl/*.cpp)
  209. file(GLOB_RECURSE STORM_PROPERTIES_ACTIONS_FILES ${PROJECT_SOURCE_DIR}/src/properties/actions/*.h ${PROJECT_SOURCE_DIR}/src/properties/actions/*.cpp)
  210. file(GLOB_RECURSE STORM_MODELCHECKER_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/*.cpp)
  211. file(GLOB_RECURSE STORM_COUNTEREXAMPLES_FILES ${PROJECT_SOURCE_DIR}/src/counterexamples/*.h ${PROJECT_SOURCE_DIR}/src/counterexamples/*.cpp)
  212. file(GLOB_RECURSE STORM_MODELS_FILES ${PROJECT_SOURCE_DIR}/src/models/*.h ${PROJECT_SOURCE_DIR}/src/models/*.cpp)
  213. file(GLOB STORM_PARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/*.h ${PROJECT_SOURCE_DIR}/src/parser/*.cpp)
  214. file(GLOB_RECURSE STORM_PARSER_PRISMPARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.h ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.cpp)
  215. file(GLOB STORM_SETTINGS_FILES ${PROJECT_SOURCE_DIR}/src/settings/*.h ${PROJECT_SOURCE_DIR}/src/settings/*.cpp)
  216. file(GLOB STORM_SETTINGS_MODULES_FILES ${PROJECT_SOURCE_DIR}/src/settings/modules/*.h ${PROJECT_SOURCE_DIR}/src/settings/modules/*.cpp)
  217. file(GLOB_RECURSE STORM_SOLVER_FILES ${PROJECT_SOURCE_DIR}/src/solver/*.h ${PROJECT_SOURCE_DIR}/src/solver/*.cpp)
  218. file(GLOB STORM_STORAGE_FILES ${PROJECT_SOURCE_DIR}/src/storage/*.h ${PROJECT_SOURCE_DIR}/src/storage/*.cpp)
  219. file(GLOB_RECURSE STORM_STORAGE_DD_FILES ${PROJECT_SOURCE_DIR}/src/storage/dd/*.h ${PROJECT_SOURCE_DIR}/src/storage/dd/*.cpp)
  220. file(GLOB_RECURSE STORM_STORAGE_EXPRESSIONS_FILES ${PROJECT_SOURCE_DIR}/src/storage/expressions/*.h ${PROJECT_SOURCE_DIR}/src/storage/expressions/*.cpp)
  221. file(GLOB_RECURSE STORM_STORAGE_PRISM_FILES ${PROJECT_SOURCE_DIR}/src/storage/prism/*.h ${PROJECT_SOURCE_DIR}/src/storage/prism/*.cpp)
  222. file(GLOB_RECURSE STORM_STORAGE_SPARSE_FILES ${PROJECT_SOURCE_DIR}/src/storage/sparse/*.h ${PROJECT_SOURCE_DIR}/src/storage/sparse/*.cpp)
  223. file(GLOB_RECURSE STORM_UTILITY_FILES ${PROJECT_SOURCE_DIR}/src/utility/*.h ${PROJECT_SOURCE_DIR}/src/utility/*.cpp)
  224. # Test Sources
  225. # Note that the tests also need the source files, except for the main file
  226. file(GLOB STORM_FUNCTIONAL_TEST_MAIN_FILE ${STORM_CPP_TESTS_BASE_PATH}/functional/storm-functional-tests.cpp)
  227. file(GLOB_RECURSE STORM_FUNCTIONAL_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/functional/*.h ${STORM_CPP_TESTS_BASE_PATH}/functional/*.cpp)
  228. file(GLOB STORM_PERFORMANCE_TEST_MAIN_FILE ${STORM_CPP_TESTS_BASE_PATH}/performance/storm-performance-tests.cpp)
  229. file(GLOB_RECURSE STORM_PERFORMANCE_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/performance/*/*.h ${STORM_CPP_TESTS_BASE_PATH}/performance/*/*.cpp)
  230. # Additional include files like the storm-config.h
  231. file(GLOB_RECURSE STORM_BUILD_HEADERS ${PROJECT_BINARY_DIR}/include/*.h)
  232. # Group the headers and sources
  233. source_group(main FILES ${STORM_MAIN_FILE})
  234. source_group(adapters FILES ${STORM_ADAPTERS_FILES})
  235. source_group(exceptions FILES ${STORM_EXCEPTIONS_FILES})
  236. source_group(properties FILES ${STORM_PROPERTIES_FILES})
  237. source_group(properties\\csl FILES ${STORM_PROPERTIES_CSL_FILES})
  238. source_group(properties\\ltl FILES ${STORM_PROPERTIES_LTL_FILES})
  239. source_group(properties\\prctl FILES ${STORM_PROPERTIES_PRCTL_FILES})
  240. source_group(properties\\actions FILES ${STORM_PROPERTIES_ACTIONS_FILES})
  241. source_group(generated FILES ${STORM_BUILD_HEADERS} ${STORM_BUILD_SOURCES})
  242. source_group(modelchecker FILES ${STORM_MODELCHECKER_FILES})
  243. source_group(counterexamples FILES ${STORM_COUNTEREXAMPLES_FILES})
  244. source_group(models FILES ${STORM_MODELS_FILES})
  245. source_group(parser FILES ${STORM_PARSER_FILES})
  246. source_group(parser\\prismparser FILES ${STORM_PARSER_PRISMPARSER_FILES})
  247. source_group(settings FILES ${STORM_SETTINGS_FILES})
  248. source_group(settings\\modules FILES ${STORM_SETTINGS_MODULES_FILES})
  249. source_group(solver FILES ${STORM_SOLVER_FILES})
  250. source_group(storage FILES ${STORM_STORAGE_FILES})
  251. source_group(storage\\dd FILES ${STORM_STORAGE_DD_FILES})
  252. source_group(storage\\expressions FILES ${STORM_STORAGE_EXPRESSIONS_FILES})
  253. source_group(storage\\prism FILES ${STORM_STORAGE_PRISM_FILES})
  254. source_group(storage\\sparse FILES ${STORM_STORAGE_SPARSE_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 ((NOT Boost_LIBRARY_DIRS) OR ("${Boost_LIBRARY_DIRS}" STREQUAL ""))
  279. set(Boost_LIBRARY_DIRS "${Boost_INCLUDE_DIRS}/stage/lib")
  280. endif ()
  281. link_directories(${Boost_LIBRARY_DIRS})
  282. if (TBB_FOUND AND STORM_USE_INTELTBB)
  283. link_directories(${TBB_LIBRARY_DIRS})
  284. endif()
  285. ###############################################################################
  286. ## #
  287. ## Executable Creation #
  288. ## #
  289. ## All link_directories() calls MUST be made before this point #
  290. ## #
  291. ###############################################################################
  292. add_library(storm ${STORM_SOURCES_WITHOUT_MAIN} ${STORM_HEADERS})
  293. add_executable(storm-main ${STORM_MAIN_FILE})
  294. target_link_libraries(storm-main storm)
  295. set_target_properties(storm-main PROPERTIES OUTPUT_NAME "storm")
  296. add_executable(storm-functional-tests ${STORM_FUNCTIONAL_TEST_MAIN_FILE} ${STORM_FUNCTIONAL_TEST_FILES})
  297. target_link_libraries(storm-functional-tests storm)
  298. add_executable(storm-performance-tests ${STORM_PERFORMANCE_TEST_MAIN_FILE} ${STORM_PERFORMANCE_TEST_FILES})
  299. target_link_libraries(storm-performance-tests storm)
  300. #############################################################
  301. ##
  302. ## Boost
  303. ##
  304. #############################################################
  305. include_directories(${Boost_INCLUDE_DIRS})
  306. target_link_libraries(storm ${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. ## CUDD
  312. ##
  313. #############################################################
  314. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0")
  315. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/cudd")
  316. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/epd")
  317. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/mtr")
  318. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/nanotrav")
  319. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/obj")
  320. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/st")
  321. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/util")
  322. target_link_libraries(storm cudd)
  323. #############################################################
  324. ##
  325. ## LTL2DSTAR
  326. ##
  327. #############################################################
  328. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1")
  329. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1/src")
  330. target_link_libraries(storm ltl2dstar)
  331. #############################################################
  332. ##
  333. ## Gurobi (optional)
  334. ##
  335. #############################################################
  336. if (ENABLE_GUROBI)
  337. message (STATUS "StoRM - Linking with Gurobi")
  338. include_directories("${GUROBI_ROOT}/include")
  339. target_link_libraries(storm "gurobi56")
  340. target_link_libraries(storm-functional-tests "gurobi56")
  341. target_link_libraries(storm-performance-tests "gurobi56")
  342. endif(ENABLE_GUROBI)
  343. #############################################################
  344. ##
  345. ## glpk
  346. ##
  347. #############################################################
  348. message (STATUS "StoRM - Linking with glpk")
  349. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/glpk-4.53")
  350. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/glpk-4.53/src")
  351. target_link_libraries(storm "glpk")
  352. #############################################################
  353. ##
  354. ## Z3 (optional)
  355. ##
  356. #############################################################
  357. if (ENABLE_Z3)
  358. message (STATUS "StoRM - Linking with Z3")
  359. include_directories("${Z3_ROOT}/include")
  360. target_link_libraries(storm ${Z3_LIB_NAME})
  361. endif(ENABLE_Z3)
  362. #############################################################
  363. ##
  364. ## Google Test gtest
  365. ##
  366. #############################################################
  367. set(gtest_force_shared_crt ON)
  368. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.7.0")
  369. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.7.0/include")
  370. enable_testing()
  371. target_link_libraries(storm-functional-tests gtest)
  372. target_link_libraries(storm-performance-tests gtest)
  373. add_test(NAME storm-functional-tests COMMAND storm-functional-tests)
  374. add_test(NAME storm-performance-tests COMMAND storm-performance-tests)
  375. #############################################################
  376. ##
  377. ## Log4CPlus
  378. ##
  379. #############################################################
  380. set(BUILD_SHARED_LIBS OFF CACHE BOOL "If TRUE, log4cplus is built as a shared library, otherwise as a static library")
  381. set(LOG4CPLUS_BUILD_LOGGINGSERVER OFF)
  382. set(LOG4CPLUS_BUILD_TESTING OFF)
  383. set(LOG4CPLUS_USE_UNICODE OFF)
  384. set(LOG4CPLUS_DEFINE_INSTALL_TARGET OFF)
  385. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1")
  386. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include")
  387. include_directories("${PROJECT_BINARY_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include") # This adds the defines.hxx file
  388. target_link_libraries(storm log4cplusS)
  389. target_link_libraries(storm-functional-tests log4cplusS)
  390. target_link_libraries(storm-performance-tests log4cplusS)
  391. if (UNIX AND NOT APPLE)
  392. target_link_libraries(storm rt)
  393. if (STORM_USE_COTIRE)
  394. target_link_libraries(storm_unity rt)
  395. endif(STORM_USE_COTIRE)
  396. endif(UNIX AND NOT APPLE)
  397. #############################################################
  398. ##
  399. ## Intel Threading Building Blocks (optional)
  400. ##
  401. #############################################################
  402. if (TBB_FOUND)
  403. message(STATUS "StoRM - Found Intel TBB with interface version ${TBB_INTERFACE_VERSION}.")
  404. if (STORM_USE_INTELTBB)
  405. message(STATUS "StoRM - Linking with Intel TBB in ${TBB_LIBRARY_DIRS}.")
  406. include_directories(${TBB_INCLUDE_DIRS})
  407. target_link_libraries(storm tbb tbbmalloc)
  408. endif(STORM_USE_INTELTBB)
  409. endif(TBB_FOUND)
  410. #############################################################
  411. ##
  412. ## Threads
  413. ##
  414. #############################################################
  415. include_directories(${THREADS_INCLUDE_DIRS})
  416. target_link_libraries(storm ${CMAKE_THREAD_LIBS_INIT})
  417. if (STORM_USE_COTIRE)
  418. target_link_libraries(storm_unity ${CMAKE_THREAD_LIBS_INIT})
  419. endif(STORM_USE_COTIRE)
  420. if (MSVC)
  421. # Add the DebugHelper DLL
  422. set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} Dbghelp.lib")
  423. target_link_libraries(storm "Dbghelp.lib")
  424. endif(MSVC)
  425. # Print Cotire Usage Status
  426. message (STATUS "StoRM - Using Cotire: ${STORM_USE_COTIRE}")
  427. if (STORM_USE_COTIRE)
  428. # Include Cotire for PCH Generation
  429. set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/resources/cmake")
  430. include(cotire)
  431. cotire(storm)
  432. target_link_libraries(storm_unity ${Boost_LIBRARIES})
  433. #cotire(storm-functional-tests)
  434. #cotire(storm-performance-tests)
  435. endif()
  436. # Link against libc++abi if requested. May be needed to build on Linux systems using clang.
  437. if (LINK_LIBCXXABI)
  438. message (STATUS "StoRM - Linking against libc++abi.")
  439. target_link_libraries(storm "c++abi")
  440. endif(LINK_LIBCXXABI)
  441. # Add a target to generate API documentation with Doxygen
  442. if(DOXYGEN_FOUND)
  443. set(CMAKE_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc")
  444. string(REGEX REPLACE ";" " " CMAKE_DOXYGEN_INPUT_LIST "${PROJECT_SOURCE_DIR}/src")
  445. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" @ONLY)
  446. add_custom_target(doc ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" COMMENT "Generating API documentation with Doxygen" VERBATIM)
  447. endif(DOXYGEN_FOUND)
  448. 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)
  449. 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)
  450. 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)
  451. set(CPPLINT_ARGS --filter=-whitespace/tab,-whitespace/line_length,-legal/copyright,-readability/streams)
  452. add_custom_target(style python cpplint.py ${CPPLINT_ARGS} `find ./src/ -iname "*.h" -or -iname "*.cpp" `)
  453. INSTALL(TARGETS storm-main storm-functional-tests storm-performance-tests
  454. RUNTIME DESTINATION bin
  455. LIBRARY DESTINATION lib
  456. ARCHIVE DESTINATION lib
  457. )
  458. include(StormCPackConfig.cmake)