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.

61 lines
2.0 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. add_definitions(-DSYLVAN_HAVE_CARL)
  29. include_directories("${carl_INCLUDE_DIR}")
  30. message(STATUS "Sylvan - using CARL.")
  31. else()
  32. message(STATUS "Sylvan - not using CARL.")
  33. endif()
  34. set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
  35. find_package(GMP REQUIRED)
  36. include_directories(${GMP_INCLUDE_DIR})
  37. include_directories("${PROJECT_SOURCE_DIR}/../../../src")
  38. include_directories("${PROJECT_BINARY_DIR}/../../../include")
  39. include_directories(src)
  40. add_subdirectory(src)
  41. option(SYLVAN_BUILD_TEST "Build test programs" ON)
  42. if(SYLVAN_BUILD_TEST)
  43. add_subdirectory(test)
  44. endif()
  45. option(SYLVAN_BUILD_EXAMPLES "Build example tools" OFF)
  46. if(SYLVAN_BUILD_EXAMPLES)
  47. add_subdirectory(examples)
  48. endif()