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.

429 lines
21 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. # Set all GTest references to the version in the repository and show it as output
  8. set (GTEST_INCLUDE_DIR resources/3rdparty/gtest-1.6.0/include)
  9. if(MSVC)
  10. set (STORM_LIB_SUFFIX lib)
  11. set (GTEST_LIBRARY_DEBUG ${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.6.0/build/Debug/gtest.${STORM_LIB_SUFFIX})
  12. set (GTEST_MAIN_LIBRARY_DEBUG ${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.6.0/build/Debug/gtest_main.${STORM_LIB_SUFFIX})
  13. set (GTEST_LIBRARY ${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.6.0/build/Release/gtest.${STORM_LIB_SUFFIX})
  14. set (GTEST_MAIN_LIBRARY ${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.6.0/build/Release/gtest_main.${STORM_LIB_SUFFIX})
  15. set (GTEST_LIBRARIES optimized ${GTEST_LIBRARY} debug ${GTEST_LIBRARY_DEBUG})
  16. else()
  17. set (STORM_LIB_SUFFIX a)
  18. set (GTEST_LIBRARY ${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.6.0/libgtest.${STORM_LIB_SUFFIX})
  19. set (GTEST_MAIN_LIBRARY ${PROJECT_SOURCE_DIR}/resources/3rdparty/gtest-1.6.0/libgtest_main.${STORM_LIB_SUFFIX})
  20. set (GTEST_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY}) # as we dont use FindGTest anymore
  21. endif()
  22. message(STATUS "GTEST_INCLUDE_DIR is ${GTEST_INCLUDE_DIR}")
  23. message(STATUS "GTEST_LIBRARY is ${GTEST_LIBRARY}")
  24. message(STATUS "GTEST_MAIN_LIBRARY is ${GTEST_MAIN_LIBRARY}")
  25. # Set all log4cplus references the version in the repository
  26. set (LOG4CPLUS_BASE_DIR ${PROJECT_SOURCE_DIR}/resources/3rdparty/log4cplus-1.1.2-rc2)
  27. set (LOG4CPLUS_INCLUDE_DIR ${LOG4CPLUS_BASE_DIR}/include)
  28. if (MSVC)
  29. set (LOG4CPLUS_LIBRARIES optimized ${LOG4CPLUS_BASE_DIR}/msvc10/x64/bin.Release/log4cplusS.${STORM_LIB_SUFFIX} debug ${LOG4CPLUS_BASE_DIR}/msvc10/x64/bin.Debug/log4cplusSD.${STORM_LIB_SUFFIX})
  30. else()
  31. set (LOG4CPLUS_LIBRARIES ${LOG4CPLUS_BASE_DIR}/src/liblog4cplusS.${STORM_LIB_SUFFIX})
  32. endif()
  33. message(STATUS "LOG4CPLUS_INCLUDE_DIR is ${LOG4CPLUS_INCLUDE_DIR}")
  34. message(STATUS "LOG4CPLUS_LIBRARY is ${LOG4CPLUS_LIBRARIES}")
  35. # Set all Eigen references the version in the repository
  36. set(EIGEN3_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/resources/3rdparty/eigen)
  37. message(STATUS "EIGEN3_INCLUDE_DIR is ${EIGEN3_INCLUDE_DIR}")
  38. # Set all Eigen references the version in the repository
  39. set(GMMXX_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/resources/3rdparty/gmm-4.2/include)
  40. message(STATUS "GMMXX_INCLUDE_DIR is ${GMMXX_INCLUDE_DIR}")
  41. # Set all CUDD references to the version in the repository
  42. set(CUDD_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/include ${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/obj ${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/cudd ${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/mtr ${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/epd)
  43. set(CUDD_LIBRARY_DIRS ${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/cudd ${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/mtr ${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/util ${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/st ${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/epd ${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/obj)
  44. message(STATUS "CUDD_INCLUDE_DIRS is ${CUDD_INCLUDE_DIRS}")
  45. message(STATUS "CUDD_LIBRARY_DIRS is ${CUDD_LIBRARY_DIRS}")
  46. # Set all ltl2dstar references to the version in the repository
  47. set(LTL2DSTAR_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1/src)
  48. if (MSVC)
  49. set(LTL2DSTAR_LIBRARY_DIRS ${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1/win32/Ltl2dStar/x64/Release)
  50. else()
  51. set(LTL2DSTAR_LIBRARY_DIRS ${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1/src)
  52. endif()
  53. message(STATUS "LTL2DSTAR_INCLUDE_DIRS is ${LTL2DSTAR_INCLUDE_DIRS}")
  54. message(STATUS "LTL2DSTAR_LIBRARY_DIRS is ${LTL2DSTAR_LIBRARY_DIRS}")
  55. # Now define all available custom options
  56. option(DEBUG "Sets whether the DEBUG mode is used" ON)
  57. option(USE_POPCNT "Sets whether the popcnt instruction is going to be used." ON)
  58. option(USE_BOOST_STATIC_LIBRARIES "Sets whether the Boost libraries should be linked statically." ON)
  59. option(USE_INTELTBB "Sets whether the Intel TBB Extensions should be used." OFF)
  60. option(STORM_USE_COTIRE "Sets whether Cotire should be used (for building precompiled headers)." OFF)
  61. option(LINK_LIBCXXABI "Sets whether libc++abi should be linked" OFF)
  62. set(ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "Additional directories added to the include directories.")
  63. set(ADDITIONAL_LINK_DIRS "" CACHE STRING "Additional directories added to the link directories.")
  64. set(CUSTOM_BOOST_ROOT "" CACHE STRING "A custom path to the Boost root directory.")
  65. # If the DEBUG option was turned on, we will target a debug version and a release version otherwise
  66. if (DEBUG)
  67. set (CMAKE_BUILD_TYPE "DEBUG")
  68. message(STATUS "Building DEBUG version.")
  69. else()
  70. set (CMAKE_BUILD_TYPE "RELEASE")
  71. message(STATUS "Building RELEASE version.")
  72. endif()
  73. message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
  74. message(STATUS "CMAKE_BUILD_TYPE (ENV): $ENV{CMAKE_BUILD_TYPE}")
  75. # Path to the no-strict-aliasing target
  76. set(CONVERSIONHELPER_TARGET "${PROJECT_SOURCE_DIR}/src/utility/ConversionHelper.cpp")
  77. if(CMAKE_COMPILER_IS_GNUCC)
  78. message(STATUS "Using GCC")
  79. # Set standard flags for GCC
  80. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops")
  81. set (CMAKE_CXX_FLAGS "-std=c++0x -Wall -pedantic")
  82. # -Werror is atm removed as this gave some problems with existing code
  83. # May be re-set later
  84. # (Thomas Heinemann, 2012-12-21)
  85. # Turn on popcnt instruction if desired (yes by default)
  86. if (USE_POPCNT)
  87. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")
  88. endif(USE_POPCNT)
  89. # Set the no-strict-aliasing target for GCC
  90. set_source_files_properties(${CONVERSIONHELPER_TARGET} PROPERTIES COMPILE_FLAGS " -fno-strict-aliasing ")
  91. elseif(MSVC)
  92. message(STATUS "Using MSVC")
  93. # required for GMM to compile, ugly error directive in their code
  94. add_definitions(/D_SCL_SECURE_NO_DEPRECATE)
  95. # 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)
  96. add_definitions(/bigobj)
  97. # MSVC does not do strict-aliasing, so no option needed
  98. else(CLANG)
  99. message(STATUS "Using CLANG")
  100. # As CLANG is not set as a variable, we need to set it in case we have not matched another compiler.
  101. set (CLANG ON)
  102. # Set standard flags for clang
  103. set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops -O3")
  104. if(UNIX AND NOT APPLE)
  105. set(CLANG_STDLIB libstdc++)
  106. else()
  107. set(CLANG_STDLIB libc++)
  108. endif()
  109. set (CMAKE_CXX_FLAGS "-std=c++11 -stdlib=${CLANG_STDLIB} -Wall -pedantic -Wno-unused-variable -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE")
  110. set (CMAKE_CXX_FLAGS_DEBUG "-g")
  111. # Turn on popcnt instruction if desired (yes by default)
  112. if (USE_POPCNT)
  113. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")
  114. endif(USE_POPCNT)
  115. # Set the no-strict-aliasing target for Clang
  116. set_source_files_properties(${CONVERSIONHELPER_TARGET} PROPERTIES COMPILE_FLAGS " -fno-strict-aliasing ")
  117. endif()
  118. # Add the binary folder to the search path for include files so that we will find storm-config.h
  119. include_directories("${PROJECT_BINARY_DIR}")
  120. # Base path for test files
  121. set(STORM_CPP_TESTS_BASE_PATH ${PROJECT_SOURCE_DIR}/test)
  122. message(STATUS "STORM_CPP_TESTS_BASE_PATH is ${STORM_CPP_TESTS_BASE_PATH}")
  123. # Main Sources
  124. file(GLOB_RECURSE STORM_HEADERS ${PROJECT_SOURCE_DIR}/src/*.h)
  125. file(GLOB_RECURSE STORM_SOURCES_WITHOUT_MAIN ${PROJECT_SOURCE_DIR}/src/*/*.cpp)
  126. file(GLOB_RECURSE STORM_MAIN_FILE ${PROJECT_SOURCE_DIR}/src/storm.cpp)
  127. set(STORM_SOURCES "${STORM_SOURCES_WITHOUT_MAIN};${STORM_MAIN_FILE}")
  128. file(GLOB_RECURSE STORM_ADAPTERS_FILES ${PROJECT_SOURCE_DIR}/src/adapters/*.h ${PROJECT_SOURCE_DIR}/src/adapters/*.cpp)
  129. file(GLOB_RECURSE STORM_EXCEPTIONS_FILES ${PROJECT_SOURCE_DIR}/src/exceptions/*.h ${PROJECT_SOURCE_DIR}/src/exceptions/*.cpp)
  130. file(GLOB STORM_FORMULA_FILES ${PROJECT_SOURCE_DIR}/src/formula/*.h ${PROJECT_SOURCE_DIR}/src/formula/*.cpp)
  131. file(GLOB_RECURSE STORM_FORMULA_ABSTRACT_FILES ${PROJECT_SOURCE_DIR}/src/formula/abstract/*.h ${PROJECT_SOURCE_DIR}/src/formula/abstract/*.cpp)
  132. file(GLOB_RECURSE STORM_FORMULA_CSL_FILES ${PROJECT_SOURCE_DIR}/src/formula/Csl/*.h ${PROJECT_SOURCE_DIR}/src/formula/Csl/*.cpp)
  133. file(GLOB_RECURSE STORM_FORMULA_LTL_FILES ${PROJECT_SOURCE_DIR}/src/formula/Ltl/*.h ${PROJECT_SOURCE_DIR}/src/formula/Ltl/*.cpp)
  134. file(GLOB_RECURSE STORM_FORMULA_PRCTL_FILES ${PROJECT_SOURCE_DIR}/src/formula/Prctl/*.h ${PROJECT_SOURCE_DIR}/src/formula/Prctl/*.cpp)
  135. file(GLOB_RECURSE STORM_MODELCHECKER_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/*.cpp)
  136. file(GLOB_RECURSE STORM_MODELS_FILES ${PROJECT_SOURCE_DIR}/src/models/*.h ${PROJECT_SOURCE_DIR}/src/models/*.cpp)
  137. file(GLOB STORM_PARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/*.h ${PROJECT_SOURCE_DIR}/src/parser/*.cpp)
  138. file(GLOB_RECURSE STORM_PARSER_PRISMPARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.h ${PROJECT_SOURCE_DIR}/src/parser/prismparser/*.cpp)
  139. file(GLOB_RECURSE STORM_SETTINGS_FILES ${PROJECT_SOURCE_DIR}/src/settings/*.h ${PROJECT_SOURCE_DIR}/src/settings/*.cpp)
  140. file(GLOB_RECURSE STORM_SOLVER_FILES ${PROJECT_SOURCE_DIR}/src/solver/*.h ${PROJECT_SOURCE_DIR}/src/solver/*.cpp)
  141. file(GLOB_RECURSE STORM_STORAGE_FILES ${PROJECT_SOURCE_DIR}/src/storage/*.h ${PROJECT_SOURCE_DIR}/src/storage/*.cpp)
  142. file(GLOB_RECURSE STORM_UTILITY_FILES ${PROJECT_SOURCE_DIR}/src/utility/*.h ${PROJECT_SOURCE_DIR}/src/utility/*.cpp)
  143. file(GLOB STORM_IR_FILES ${PROJECT_SOURCE_DIR}/src/ir/*.h ${PROJECT_SOURCE_DIR}/src/ir/*.cpp)
  144. file(GLOB_RECURSE STORM_IR_EXPRESSIONS_FILES ${PROJECT_SOURCE_DIR}/src/ir/expressions/*.h ${PROJECT_SOURCE_DIR}/src/ir/expressions/*.cpp)
  145. # Test Sources
  146. # Note that the tests also need the source files, except for the main file
  147. file(GLOB_RECURSE STORM_FUNCTIONAL_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/functional/*.h ${STORM_CPP_TESTS_BASE_PATH}/functional/*.cpp)
  148. file(GLOB_RECURSE STORM_PERFORMANCE_TEST_FILES ${STORM_CPP_TESTS_BASE_PATH}/performance/*.h ${STORM_CPP_TESTS_BASE_PATH}/performance/*.cpp)
  149. # Group the headers and sources
  150. source_group(main FILES ${STORM_MAIN_FILE})
  151. source_group(adapters FILES ${STORM_ADAPTERS_FILES})
  152. source_group(exceptions FILES ${STORM_EXCEPTIONS_FILES})
  153. source_group(formula FILES ${STORM_FORMULA_FILES})
  154. source_group(formula\\abstract FILES ${STORM_FORMULA_ABSTRACT_FILES})
  155. source_group(formula\\csl FILES ${STORM_FORMULA_CSL_FILES})
  156. source_group(formula\\ltl FILES ${STORM_FORMULA_LTL_FILES})
  157. source_group(formula\\prctl FILES ${STORM_FORMULA_PRCTL_FILES})
  158. source_group(modelchecker FILES ${STORM_MODELCHECKER_FILES})
  159. source_group(models FILES ${STORM_MODELS_FILES})
  160. source_group(parser FILES ${STORM_PARSER_FILES})
  161. source_group(parser\\prismparser FILES ${STORM_PARSER_PRISMPARSER_FILES})
  162. source_group(settings FILES ${STORM_SETTINGS_FILES})
  163. source_group(solver FILES ${STORM_SOLVER_FILES})
  164. source_group(storage FILES ${STORM_STORAGE_FILES})
  165. source_group(utility FILES ${STORM_UTILITY_FILES})
  166. source_group(ir FILES ${STORM_IR_FILES})
  167. source_group(ir\\expressions FILES ${STORM_IR_EXPRESSIONS_FILES})
  168. source_group(functional-test FILES ${STORM_FUNCTIONAL_TEST_FILES})
  169. source_group(performance-test FILES ${STORM_PERFORMANCE_TEST_FILES})
  170. # Add base folder for better inclusion paths
  171. include_directories("${PROJECT_SOURCE_DIR}")
  172. include_directories("${PROJECT_SOURCE_DIR}/src")
  173. # Preset pathes for Intel TBB to internal copy in /resources/3rdParty/tbb41_20130314_mergedWindowsLinuxMacOSX
  174. set(TBB_INSTALL_DIR "${PROJECT_SOURCE_DIR}/resources/3rdparty/tbb41_20130314_merged-win-lin-mac/")
  175. if(MSVC)
  176. set(ENV{TBB_ARCH_PLATFORM} "intel64/vc11")
  177. elseif(CMAKE_COMPILER_IS_GNUCC)
  178. set(ENV{TBB_ARCH_PLATFORM} "intel64/gcc4.4")
  179. else(CLANG)
  180. set(ENV{TBB_ARCH_PLATFORM} "intel64/clang3.2")
  181. endif()
  182. # Add the resources/cmake folder to Module Search Path for FindTBB.cmake
  183. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/resources/cmake/")
  184. # Set required external packages
  185. find_package(Threads REQUIRED)
  186. find_package(Doxygen REQUIRED)
  187. set(Boost_USE_STATIC_LIBS ON)
  188. set(Boost_USE_MULTITHREADED ON)
  189. set(Boost_USE_STATIC_RUNTIME OFF)
  190. # If a custom boost root directory was specified, we set the corresponding hint for the script to find it.
  191. if(CUSTOM_BOOST_ROOT)
  192. set(BOOST_ROOT "${CUSTOM_BOOST_ROOT}")
  193. endif(CUSTOM_BOOST_ROOT)
  194. find_package(Boost REQUIRED COMPONENTS program_options)
  195. find_package(TBB)
  196. if(Boost_FOUND)
  197. if ((NOT Boost_LIBRARY_DIRS) OR ("${Boost_LIBRARY_DIRS}" STREQUAL ""))
  198. set(Boost_LIBRARY_DIRS "${Boost_INCLUDE_DIRS}/stage/lib")
  199. endif ()
  200. message(STATUS "BOOST_INCLUDE_DIRS is ${Boost_INCLUDE_DIRS}")
  201. message(STATUS "BOOST_LIBRARY_DIRS is ${Boost_LIBRARY_DIRS}")
  202. include_directories(${Boost_INCLUDE_DIRS})
  203. link_directories(${Boost_LIBRARY_DIRS})
  204. endif(Boost_FOUND)
  205. # Intels Thread Building Blocks
  206. if (TBB_FOUND)
  207. message(STATUS "Found TBB with Interface Version ${TBB_INTERFACE_VERSION}")
  208. if(USE_INTELTBB)
  209. add_definitions(-DGMM_USE_TBB)
  210. endif()
  211. include_directories(${TBB_INCLUDE_DIRS})
  212. link_directories(${TBB_LIBRARY_DIRS})
  213. endif(TBB_FOUND)
  214. # Add Eigen to the included directories
  215. include_directories(${EIGEN3_INCLUDE_DIR})
  216. # Add GMMXX to the included directories
  217. include_directories(${GMMXX_INCLUDE_DIR})
  218. # Add custom additional include or link directories
  219. if (ADDITIONAL_INCLUDE_DIRS)
  220. message(STATUS "Using additional include directories ${ADDITIONAL_INCLUDE_DIRS}")
  221. include_directories(${ADDITIONAL_INCLUDE_DIRS})
  222. endif(ADDITIONAL_INCLUDE_DIRS)
  223. if (ADDITIONAL_LINK_DIRS)
  224. message(STATUS "Using additional link directories ${ADDITIONAL_LINK_DIRS}")
  225. link_directories(${ADDITIONAL_LINK_DIRS})
  226. endif(ADDITIONAL_LINK_DIRS)
  227. if (CUDD_INCLUDE_DIRS)
  228. include_directories(${CUDD_INCLUDE_DIRS})
  229. endif(CUDD_INCLUDE_DIRS)
  230. if (CUDD_LIBRARY_DIRS)
  231. link_directories(${CUDD_LIBRARY_DIRS})
  232. endif(CUDD_LIBRARY_DIRS)
  233. if (LTL2DSTAR_INCLUDE_DIRS)
  234. include_directories(${LTL2DSTAR_INCLUDE_DIRS})
  235. endif(LTL2DSTAR_INCLUDE_DIRS)
  236. if (LTL2DSTAR_LIBRARY_DIRS)
  237. link_directories(${LTL2DSTAR_LIBRARY_DIRS})
  238. endif(LTL2DSTAR_LIBRARY_DIRS)
  239. # Add the executables
  240. # Must be created *after* Boost was added because of LINK_DIRECTORIES
  241. add_executable(storm ${STORM_SOURCES} ${STORM_HEADERS})
  242. add_executable(storm-functional-tests ${STORM_FUNCTIONAL_TEST_FILES} ${STORM_SOURCES_WITHOUT_MAIN} ${STORM_HEADERS})
  243. add_executable(storm-performance-tests ${STORM_PERFORMANCE_TEST_FILES} ${STORM_SOURCES_WITHOUT_MAIN} ${STORM_HEADERS})
  244. # Add target link deps for Boost program options
  245. target_link_libraries(storm ${Boost_LIBRARIES})
  246. target_link_libraries(storm-functional-tests ${Boost_LIBRARIES})
  247. target_link_libraries(storm-performance-tests ${Boost_LIBRARIES})
  248. if (MSVC)
  249. # Add the DebugHelper DLL
  250. set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} Dbghelp.lib")
  251. target_link_libraries(storm "Dbghelp.lib")
  252. target_link_libraries(storm-functional-tests "Dbghelp.lib")
  253. target_link_libraries(storm-performance-tests "Dbghelp.lib")
  254. endif(MSVC)
  255. if (USE_INTELTBB)
  256. target_link_libraries(storm tbb tbbmalloc)
  257. target_link_libraries(storm-functional-tests tbb tbbmalloc)
  258. target_link_libraries(storm-performance-tests tbb tbbmalloc)
  259. endif(USE_INTELTBB)
  260. if (APPLE)
  261. set(STORM_USE_COTIRE OFF)
  262. # Set up some Xcode specific settings
  263. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
  264. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
  265. endif(APPLE)
  266. # Print Cotire Usage Status
  267. message (STATUS "Using Cotire: ${STORM_USE_COTIRE}")
  268. if (STORM_USE_COTIRE)
  269. # Include Cotire for PCH Generation
  270. set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/resources/cmake")
  271. include(cotire)
  272. cotire(storm)
  273. target_link_libraries(storm_unity ${Boost_LIBRARIES})
  274. #cotire(storm-functional-tests)
  275. #cotire(storm-performance-tests)
  276. endif()
  277. # Link against libc++abi if requested. May be needed to build on Linux systems using clang.
  278. if (LINK_LIBCXXABI)
  279. message (STATUS "Linking against libc++abi.")
  280. target_link_libraries(storm "c++abi")
  281. target_link_libraries(storm-functional-tests "c++abi")
  282. target_link_libraries(storm-performance-tests "c++abi")
  283. endif(LINK_LIBCXXABI)
  284. # Add a target to generate API documentation with Doxygen
  285. if(DOXYGEN_FOUND)
  286. set(CMAKE_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc")
  287. string(REGEX REPLACE ";" " " CMAKE_DOXYGEN_INPUT_LIST "${PROJECT_SOURCE_DIR}/src")
  288. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
  289. add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile COMMENT "Generating API documentation with Doxygen" VERBATIM)
  290. endif(DOXYGEN_FOUND)
  291. if (GTEST_INCLUDE_DIR)
  292. # For make-based builds, defines make target named test.
  293. # For Visual Studio builds, defines Visual Studio project named RUN_TESTS.
  294. enable_testing()
  295. include_directories(${GTEST_INCLUDE_DIR})
  296. target_link_libraries(storm-functional-tests ${GTEST_LIBRARIES})
  297. target_link_libraries(storm-performance-tests ${GTEST_LIBRARIES})
  298. add_test(NAME storm-functional-tests COMMAND storm-functional-tests)
  299. add_test(NAME storm-performance-tests COMMAND storm-performance-tests)
  300. if(MSVC) # VS2012 doesn't support correctly the tuples yet
  301. add_definitions( /D _VARIADIC_MAX=10 )
  302. endif()
  303. endif(GTEST_INCLUDE_DIR)
  304. if (LOG4CPLUS_INCLUDE_DIR)
  305. include_directories(${LOG4CPLUS_INCLUDE_DIR})
  306. target_link_libraries(storm ${LOG4CPLUS_LIBRARIES})
  307. if (STORM_USE_COTIRE)
  308. target_link_libraries(storm_unity ${LOG4CPLUS_LIBRARIES})
  309. endif(STORM_USE_COTIRE)
  310. target_link_libraries(storm-functional-tests ${LOG4CPLUS_LIBRARIES})
  311. target_link_libraries(storm-performance-tests ${LOG4CPLUS_LIBRARIES})
  312. # On Linux, we have to link against librt
  313. if (UNIX AND NOT APPLE)
  314. target_link_libraries(storm rt)
  315. if (STORM_USE_COTIRE)
  316. target_link_libraries(storm_unity rt)
  317. endif(STORM_USE_COTIRE)
  318. target_link_libraries(storm-functional-tests rt)
  319. target_link_libraries(storm-performance-tests rt)
  320. endif(UNIX AND NOT APPLE)
  321. endif(LOG4CPLUS_INCLUDE_DIR)
  322. if (CUDD_LIBRARY_DIRS)
  323. if (MSVC)
  324. set(cuddMsvcLibs "optimized" "${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/CUDD_Win32/x64/Release/CUDD_Win32.lib" "debug" "${PROJECT_SOURCE_DIR}/resources/3rdparty/cudd-2.5.0/CUDD_Win32/x64/Debug/CUDD_Win32.lib")
  325. target_link_libraries(storm ${cuddMsvcLibs})
  326. target_link_libraries(storm-functional-tests ${cuddMsvcLibs})
  327. target_link_libraries(storm-performance-tests ${cuddMsvcLibs})
  328. else ()
  329. target_link_libraries(storm "-lobj -lcudd -lmtr -lst -lutil -lepd")
  330. target_link_libraries(storm-functional-tests "-lobj -lcudd -lmtr -lst -lutil -lepd")
  331. target_link_libraries(storm-performance-tests "-lobj -lcudd -lmtr -lst -lutil -lepd")
  332. endif ()
  333. endif(CUDD_LIBRARY_DIRS)
  334. if (LTL2DSTAR_LIBRARY_DIRS)
  335. if (MSVC)
  336. set(ltl2dstarMsvcLibs "optimized" "${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1/win32/Ltl2dStar/x64/Release/Ltl2dStar.lib" "debug" "${PROJECT_SOURCE_DIR}/resources/3rdparty/ltl2dstar-0.5.1/win32/Ltl2dStar/x64/Debug/Ltl2dStar.lib")
  337. target_link_libraries(storm ${ltl2dstarMsvcLibs})
  338. target_link_libraries(storm-functional-tests ${ltl2dstarMsvcLibs})
  339. target_link_libraries(storm-performance-tests ${ltl2dstarMsvcLibs})
  340. else ()
  341. target_link_libraries(storm "-lltl2dstar")
  342. target_link_libraries(storm-functional-tests "-lltl2dstar")
  343. target_link_libraries(storm-performance-tests "-lltl2dstar")
  344. endif ()
  345. endif (LTL2DSTAR_LIBRARY_DIRS)
  346. if (THREADS_FOUND)
  347. include_directories(${THREADS_INCLUDE_DIRS})
  348. target_link_libraries(storm ${CMAKE_THREAD_LIBS_INIT})
  349. if (STORM_USE_COTIRE)
  350. target_link_libraries(storm_unity ${CMAKE_THREAD_LIBS_INIT})
  351. endif(STORM_USE_COTIRE)
  352. target_link_libraries(storm-functional-tests ${CMAKE_THREAD_LIBS_INIT})
  353. target_link_libraries(storm-performance-tests ${CMAKE_THREAD_LIBS_INIT})
  354. endif(THREADS_FOUND)
  355. # Configure a header file to pass some of the CMake settings to the source code
  356. configure_file (
  357. "${PROJECT_SOURCE_DIR}/storm-config.h.in"
  358. "${PROJECT_BINARY_DIR}/storm-config.h"
  359. )
  360. 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)
  361. 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)
  362. 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)
  363. set (CPPLINT_ARGS --filter=-whitespace/tab,-whitespace/line_length,-legal/copyright,-readability/streams)
  364. add_custom_target(style python cpplint.py ${CPPLINT_ARGS} `find ./src/ -iname "*.h" -or -iname "*.cpp"`)