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.

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