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.

495 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. 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. # 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. # Z3 Defines
  152. if (ENABLE_Z3)
  153. set(STORM_CPP_Z3_DEF "define")
  154. else()
  155. set(STORM_CPP_Z3_DEF "undef")
  156. endif()
  157. # Intel TBB Defines
  158. if (TBB_FOUND AND ENABLE_INTELTBB)
  159. set(STORM_CPP_INTELTBB_DEF "define")
  160. else()
  161. set(STORM_CPP_INTELTBB_DEF "undef")
  162. endif()
  163. # Configure a header file to pass some of the CMake settings to the source code
  164. configure_file (
  165. "${PROJECT_SOURCE_DIR}/storm-config.h.in"
  166. "${PROJECT_BINARY_DIR}/include/storm-config.h"
  167. )
  168. # Add the binary dir include directory for storm-config.h
  169. include_directories("${PROJECT_BINARY_DIR}/include")
  170. #############################################################
  171. ##
  172. ## Source file aggregation and clustering
  173. ##
  174. #############################################################
  175. file(GLOB_RECURSE STORM_HEADERS ${PROJECT_SOURCE_DIR}/src/*.h)
  176. file(GLOB_RECURSE STORM_SOURCES_WITHOUT_MAIN ${PROJECT_SOURCE_DIR}/src/*/*.cpp)
  177. file(GLOB_RECURSE STORM_MAIN_FILE ${PROJECT_SOURCE_DIR}/src/storm.cpp)
  178. set(STORM_SOURCES "${STORM_SOURCES_WITHOUT_MAIN};${STORM_MAIN_FILE}")
  179. file(GLOB_RECURSE STORM_ADAPTERS_FILES ${PROJECT_SOURCE_DIR}/src/adapters/*.h ${PROJECT_SOURCE_DIR}/src/adapters/*.cpp)
  180. file(GLOB_RECURSE STORM_EXCEPTIONS_FILES ${PROJECT_SOURCE_DIR}/src/exceptions/*.h ${PROJECT_SOURCE_DIR}/src/exceptions/*.cpp)
  181. file(GLOB STORM_FORMULA_FILES ${PROJECT_SOURCE_DIR}/src/formula/*.h ${PROJECT_SOURCE_DIR}/src/formula/*.cpp)
  182. file(GLOB_RECURSE STORM_FORMULA_ABSTRACT_FILES ${PROJECT_SOURCE_DIR}/src/formula/abstract/*.h ${PROJECT_SOURCE_DIR}/src/formula/abstract/*.cpp)
  183. file(GLOB_RECURSE STORM_FORMULA_CSL_FILES ${PROJECT_SOURCE_DIR}/src/formula/Csl/*.h ${PROJECT_SOURCE_DIR}/src/formula/Csl/*.cpp)
  184. file(GLOB_RECURSE STORM_FORMULA_LTL_FILES ${PROJECT_SOURCE_DIR}/src/formula/Ltl/*.h ${PROJECT_SOURCE_DIR}/src/formula/Ltl/*.cpp)
  185. file(GLOB_RECURSE STORM_FORMULA_PRCTL_FILES ${PROJECT_SOURCE_DIR}/src/formula/Prctl/*.h ${PROJECT_SOURCE_DIR}/src/formula/Prctl/*.cpp)
  186. file(GLOB_RECURSE STORM_MODELCHECKER_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/*.cpp)
  187. file(GLOB_RECURSE STORM_COUNTEREXAMPLES_FILES ${PROJECT_SOURCE_DIR}/src/counterexamples/*.h ${PROJECT_SOURCE_DIR}/src/counterexamples/*.cpp)
  188. file(GLOB_RECURSE STORM_MODELS_FILES ${PROJECT_SOURCE_DIR}/src/models/*.h ${PROJECT_SOURCE_DIR}/src/models/*.cpp)
  189. file(GLOB STORM_PARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/*.h ${PROJECT_SOURCE_DIR}/src/parser/*.cpp)
  190. file(GLOB_RECURSE STORM_PARSER_PRISMPARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.h ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.cpp)
  191. file(GLOB_RECURSE STORM_SETTINGS_FILES ${PROJECT_SOURCE_DIR}/src/settings/*.h ${PROJECT_SOURCE_DIR}/src/settings/*.cpp)
  192. file(GLOB_RECURSE STORM_SOLVER_FILES ${PROJECT_SOURCE_DIR}/src/solver/*.h ${PROJECT_SOURCE_DIR}/src/solver/*.cpp)
  193. file(GLOB_RECURSE STORM_STORAGE_FILES ${PROJECT_SOURCE_DIR}/src/storage/*.h ${PROJECT_SOURCE_DIR}/src/storage/*.cpp)
  194. file(GLOB_RECURSE STORM_UTILITY_FILES ${PROJECT_SOURCE_DIR}/src/utility/*.h ${PROJECT_SOURCE_DIR}/src/utility/*.cpp)
  195. file(GLOB STORM_IR_FILES ${PROJECT_SOURCE_DIR}/src/ir/*.h ${PROJECT_SOURCE_DIR}/src/ir/*.cpp)
  196. file(GLOB_RECURSE STORM_IR_EXPRESSIONS_FILES ${PROJECT_SOURCE_DIR}/src/ir/expressions/*.h ${PROJECT_SOURCE_DIR}/src/ir/expressions/*.cpp)
  197. # Test Sources
  198. # Note that the tests also need the source files, except for the main file
  199. file(GLOB_RECURSE STORM_FUNCTIONAL_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/functional/*.h ${STORM_CPP_TESTS_BASE_PATH}/functional/*.cpp)
  200. file(GLOB_RECURSE STORM_PERFORMANCE_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/performance/*.h ${STORM_CPP_TESTS_BASE_PATH}/performance/*.cpp)
  201. # Additional include files like the storm-config.h
  202. file(GLOB_RECURSE STORM_BUILD_HEADERS ${PROJECT_BINARY_DIR}/include/*.h)
  203. # Group the headers and sources
  204. source_group(main FILES ${STORM_MAIN_FILE})
  205. source_group(adapters FILES ${STORM_ADAPTERS_FILES})
  206. source_group(exceptions FILES ${STORM_EXCEPTIONS_FILES})
  207. source_group(formula FILES ${STORM_FORMULA_FILES})
  208. source_group(formula\\abstract FILES ${STORM_FORMULA_ABSTRACT_FILES})
  209. source_group(formula\\csl FILES ${STORM_FORMULA_CSL_FILES})
  210. source_group(formula\\ltl FILES ${STORM_FORMULA_LTL_FILES})
  211. source_group(formula\\prctl FILES ${STORM_FORMULA_PRCTL_FILES})
  212. source_group(generated FILES ${STORM_BUILD_HEADERS})
  213. source_group(ir FILES ${STORM_IR_FILES})
  214. source_group(ir\\expressions FILES ${STORM_IR_EXPRESSIONS_FILES})
  215. source_group(modelchecker FILES ${STORM_MODELCHECKER_FILES})
  216. source_group(counterexamples FILES ${STORM_COUNTEREXAMPLES_FILES})
  217. source_group(models FILES ${STORM_MODELS_FILES})
  218. source_group(parser FILES ${STORM_PARSER_FILES})
  219. source_group(parser\\prismparser FILES ${STORM_PARSER_PRISMPARSER_FILES})
  220. source_group(settings FILES ${STORM_SETTINGS_FILES})
  221. source_group(solver FILES ${STORM_SOLVER_FILES})
  222. source_group(storage FILES ${STORM_STORAGE_FILES})
  223. source_group(utility FILES ${STORM_UTILITY_FILES})
  224. source_group(functional-test FILES ${STORM_FUNCTIONAL_TEST_FILES})
  225. source_group(performance-test FILES ${STORM_PERFORMANCE_TEST_FILES})
  226. # Add custom additional include or link directories
  227. if (ADDITIONAL_INCLUDE_DIRS)
  228. message(STATUS "StoRM - Using additional include directories ${ADDITIONAL_INCLUDE_DIRS}")
  229. include_directories(${ADDITIONAL_INCLUDE_DIRS})
  230. endif(ADDITIONAL_INCLUDE_DIRS)
  231. if (ADDITIONAL_LINK_DIRS)
  232. message(STATUS "StoRM - Using additional link directories ${ADDITIONAL_LINK_DIRS}")
  233. link_directories(${ADDITIONAL_LINK_DIRS})
  234. endif(ADDITIONAL_LINK_DIRS)
  235. #############################################################
  236. ##
  237. ## Pre executable-creation link_directories setup
  238. ##
  239. #############################################################
  240. if (ENABLE_GUROBI)
  241. link_directories("${GUROBI_ROOT}/lib")
  242. endif()
  243. if (ENABLE_Z3)
  244. link_directories("${Z3_ROOT}/bin")
  245. endif()
  246. if ((NOT Boost_LIBRARY_DIRS) OR ("${Boost_LIBRARY_DIRS}" STREQUAL ""))
  247. set(Boost_LIBRARY_DIRS "${Boost_INCLUDE_DIRS}/stage/lib")
  248. endif ()
  249. link_directories(${Boost_LIBRARY_DIRS})
  250. if (TBB_FOUND AND ENABLE_INTELTBB)
  251. link_directories(${TBB_LIBRARY_DIRS})
  252. endif()
  253. ###############################################################################
  254. ## #
  255. ## Executable Creation #
  256. ## #
  257. ## All link_directories() calls MUST be made before this point #
  258. ## #
  259. ###############################################################################
  260. add_executable(storm ${STORM_SOURCES} ${STORM_HEADERS} ${STORM_BUILD_HEADERS})
  261. add_executable(storm-functional-tests ${STORM_FUNCTIONAL_TEST_FILES} ${STORM_SOURCES_WITHOUT_MAIN} ${STORM_HEADERS} ${STORM_BUILD_HEADERS})
  262. add_executable(storm-performance-tests ${STORM_PERFORMANCE_TEST_FILES} ${STORM_SOURCES_WITHOUT_MAIN} ${STORM_HEADERS} ${STORM_BUILD_HEADERS})
  263. #############################################################
  264. ##
  265. ## Boost
  266. ##
  267. #############################################################
  268. include_directories(${Boost_INCLUDE_DIRS})
  269. target_link_libraries(storm ${Boost_LIBRARIES})
  270. target_link_libraries(storm-functional-tests ${Boost_LIBRARIES})
  271. target_link_libraries(storm-performance-tests ${Boost_LIBRARIES})
  272. #message(STATUS "BOOST_INCLUDE_DIRS is ${Boost_INCLUDE_DIRS}")
  273. #message(STATUS "BOOST_LIBRARY_DIRS is ${Boost_LIBRARY_DIRS}")
  274. #############################################################
  275. ##
  276. ## CUDD
  277. ##
  278. #############################################################
  279. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0")
  280. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/cudd")
  281. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/epd")
  282. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/mtr")
  283. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/nanotrav")
  284. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/obj")
  285. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/st")
  286. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/src/util")
  287. target_link_libraries(storm cudd)
  288. target_link_libraries(storm-functional-tests cudd)
  289. target_link_libraries(storm-performance-tests cudd)
  290. #############################################################
  291. ##
  292. ## LTL2DSTAR
  293. ##
  294. #############################################################
  295. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1")
  296. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1/src")
  297. target_link_libraries(storm ltl2dstar)
  298. target_link_libraries(storm-functional-tests ltl2dstar)
  299. target_link_libraries(storm-performance-tests ltl2dstar)
  300. #############################################################
  301. ##
  302. ## Gurobi (optional)
  303. ##
  304. #############################################################
  305. if (ENABLE_GUROBI)
  306. message (STATUS "StoRM - Linking with Gurobi")
  307. include_directories("${GUROBI_ROOT}/include")
  308. target_link_libraries(storm "gurobi56")
  309. target_link_libraries(storm-functional-tests "gurobi56")
  310. target_link_libraries(storm-performance-tests "gurobi56")
  311. endif(ENABLE_GUROBI)
  312. #############################################################
  313. ##
  314. ## glpk
  315. ##
  316. #############################################################
  317. message (STATUS "StoRM - Linking with glpk")
  318. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/glpk-4.53")
  319. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/glpk-4.53/src")
  320. target_link_libraries(storm "glpk")
  321. target_link_libraries(storm-functional-tests "glpk")
  322. target_link_libraries(storm-performance-tests "glpk")
  323. #############################################################
  324. ##
  325. ## Z3 (optional)
  326. ##
  327. #############################################################
  328. if (ENABLE_Z3)
  329. message (STATUS "StoRM - Linking with Z3")
  330. include_directories("${Z3_ROOT}/include")
  331. target_link_libraries(storm ${Z3_LIB_NAME})
  332. target_link_libraries(storm-functional-tests ${Z3_LIB_NAME})
  333. target_link_libraries(storm-performance-tests ${Z3_LIB_NAME})
  334. endif(ENABLE_Z3)
  335. #############################################################
  336. ##
  337. ## Google Test gtest
  338. ##
  339. #############################################################
  340. set(gtest_force_shared_crt ON)
  341. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.7.0")
  342. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.7.0/include")
  343. enable_testing()
  344. target_link_libraries(storm-functional-tests gtest)
  345. target_link_libraries(storm-performance-tests gtest)
  346. add_test(NAME storm-functional-tests COMMAND storm-functional-tests)
  347. add_test(NAME storm-performance-tests COMMAND storm-performance-tests)
  348. #############################################################
  349. ##
  350. ## Log4CPlus
  351. ##
  352. #############################################################
  353. set(BUILD_SHARED_LIBS OFF CACHE BOOL "If TRUE, log4cplus is built as a shared library, otherwise as a static library")
  354. set(LOG4CPLUS_BUILD_LOGGINGSERVER OFF)
  355. set(LOG4CPLUS_BUILD_TESTING OFF)
  356. set(LOG4CPLUS_USE_UNICODE OFF)
  357. add_subdirectory("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1")
  358. include_directories("${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include")
  359. include_directories("${PROJECT_BINARY_DIR}/resources/3rdparty/log4cplus-1.1.3-rc1/include") # This adds the defines.hxx file
  360. target_link_libraries(storm log4cplusS)
  361. target_link_libraries(storm-functional-tests log4cplusS)
  362. target_link_libraries(storm-performance-tests log4cplusS)
  363. if (UNIX AND NOT APPLE)
  364. target_link_libraries(storm rt)
  365. if (STORM_USE_COTIRE)
  366. target_link_libraries(storm_unity rt)
  367. endif(STORM_USE_COTIRE)
  368. target_link_libraries(storm-functional-tests rt)
  369. target_link_libraries(storm-performance-tests rt)
  370. endif(UNIX AND NOT APPLE)
  371. #############################################################
  372. ##
  373. ## Intel Threading Building Blocks (optional)
  374. ##
  375. #############################################################
  376. if (TBB_FOUND)
  377. message(STATUS "StoRM - Found Intel TBB with interface version ${TBB_INTERFACE_VERSION}.")
  378. if (ENABLE_INTELTBB)
  379. message(STATUS "StoRM - Linking with Intel TBB in ${TBB_LIBRARY_DIRS}.")
  380. include_directories(${TBB_INCLUDE_DIRS})
  381. target_link_libraries(storm tbb tbbmalloc)
  382. target_link_libraries(storm-functional-tests tbb tbbmalloc)
  383. target_link_libraries(storm-performance-tests tbb tbbmalloc)
  384. endif(ENABLE_INTELTBB)
  385. endif(TBB_FOUND)
  386. #############################################################
  387. ##
  388. ## Threads
  389. ##
  390. #############################################################
  391. include_directories(${THREADS_INCLUDE_DIRS})
  392. target_link_libraries(storm ${CMAKE_THREAD_LIBS_INIT})
  393. if (STORM_USE_COTIRE)
  394. target_link_libraries(storm_unity ${CMAKE_THREAD_LIBS_INIT})
  395. endif(STORM_USE_COTIRE)
  396. target_link_libraries(storm-functional-tests ${CMAKE_THREAD_LIBS_INIT})
  397. target_link_libraries(storm-performance-tests ${CMAKE_THREAD_LIBS_INIT})
  398. if (MSVC)
  399. # Add the DebugHelper DLL
  400. set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} Dbghelp.lib")
  401. target_link_libraries(storm "Dbghelp.lib")
  402. target_link_libraries(storm-functional-tests "Dbghelp.lib")
  403. target_link_libraries(storm-performance-tests "Dbghelp.lib")
  404. endif(MSVC)
  405. # Print Cotire Usage Status
  406. message (STATUS "StoRM - Using Cotire: ${STORM_USE_COTIRE}")
  407. if (STORM_USE_COTIRE)
  408. # Include Cotire for PCH Generation
  409. set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/resources/cmake")
  410. include(cotire)
  411. cotire(storm)
  412. target_link_libraries(storm_unity ${Boost_LIBRARIES})
  413. #cotire(storm-functional-tests)
  414. #cotire(storm-performance-tests)
  415. endif()
  416. # Link against libc++abi if requested. May be needed to build on Linux systems using clang.
  417. if (LINK_LIBCXXABI)
  418. message (STATUS "StoRM - Linking against libc++abi.")
  419. target_link_libraries(storm "c++abi")
  420. target_link_libraries(storm-functional-tests "c++abi")
  421. target_link_libraries(storm-performance-tests "c++abi")
  422. endif(LINK_LIBCXXABI)
  423. # Add a target to generate API documentation with Doxygen
  424. if(DOXYGEN_FOUND)
  425. set(CMAKE_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc")
  426. string(REGEX REPLACE ";" " " CMAKE_DOXYGEN_INPUT_LIST "${PROJECT_SOURCE_DIR}/src")
  427. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" @ONLY)
  428. add_custom_target(doc ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" COMMENT "Generating API documentation with Doxygen" VERBATIM)
  429. endif(DOXYGEN_FOUND)
  430. 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)
  431. 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)
  432. 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)
  433. set(CPPLINT_ARGS --filter=-whitespace/tab,-whitespace/line_length,-legal/copyright,-readability/streams)
  434. add_custom_target(style python cpplint.py ${CPPLINT_ARGS} `find ./src/ -iname "*.h" -or -iname "*.cpp" `)