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