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.

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