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.

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