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.

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