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.

68 lines
2.2 KiB

  1. cmake_minimum_required(VERSION 2.6)
  2. project(sylvan C CXX)
  3. enable_testing()
  4. set(CMAKE_C_FLAGS "-O3 -Wextra -Wall -fno-strict-aliasing -std=gnu11 -fPIC")
  5. set(CMAKE_CXX_FLAGS "-O3 -Wextra -Wall -fno-strict-aliasing -Wno-deprecated-register -std=gnu++11 -fPIC")
  6. option(USE_CARL "Sets whether carl should be included." ON)
  7. option(WITH_COVERAGE "Add generation of test coverage" OFF)
  8. if(WITH_COVERAGE)
  9. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -coverage")
  10. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -coverage")
  11. find_program(GCOV_PATH gcov)
  12. find_program(LCOV_PATH lcov)
  13. find_program(GENHTML_PATH genhtml)
  14. add_custom_target(coverage
  15. # Cleanup lcov
  16. ${LCOV_PATH} --directory . --zerocounters
  17. # Run tests
  18. COMMAND make test
  19. # Capture counters
  20. COMMAND ${LCOV_PATH} --gcov-tool ${GCOV_PATH} --directory . --capture --output-file coverage.info
  21. COMMAND ${LCOV_PATH} --remove coverage.info 'test/*' '/usr/*' 'examples/*' 'src/sylvan_mtbdd*' 'src/lace*' 'src/sylvan_ldd*' 'src/avl.h' 'src/sha2.c' --output-file coverage.info.cleaned
  22. COMMAND ${GENHTML_PATH} -o coverage coverage.info.cleaned
  23. COMMAND ${CMAKE_COMMAND} -E remove coverage.info coverage.info.cleaned
  24. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
  25. )
  26. endif()
  27. if(USE_CARL)
  28. find_package(carl QUIET REQUIRED)
  29. if(carl_FOUND)
  30. add_definitions(-DSYLVAN_HAVE_CARL)
  31. include_directories("${carl_INCLUDE_DIR}")
  32. list(APPEND STORM_LINK_LIBRARIES ${carl_LIBRARIES})
  33. message(STATUS "Sylvan - using CARL.")
  34. else()
  35. message(FATAL_ERROR "Sylvan - CARL was requested but not found")
  36. endif()
  37. else()
  38. message(STATUS "Sylvan - not using CARL.")
  39. endif()
  40. set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
  41. find_package(GMP REQUIRED)
  42. include_directories(${GMP_INCLUDE_DIR})
  43. include_directories("${PROJECT_SOURCE_DIR}/../../../")
  44. include_directories("${PROJECT_BINARY_DIR}/../include")
  45. include_directories(src)
  46. include_directories(src)
  47. add_subdirectory(src)
  48. option(SYLVAN_BUILD_TEST "Build test programs" ON)
  49. if(SYLVAN_BUILD_TEST)
  50. add_subdirectory(test)
  51. endif()
  52. option(SYLVAN_BUILD_EXAMPLES "Build example tools" OFF)
  53. if(SYLVAN_BUILD_EXAMPLES)
  54. add_subdirectory(examples)
  55. endif()