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.

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