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.

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