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.

517 lines
23 KiB

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