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.

580 lines
25 KiB

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