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.

50 lines
1.7 KiB

  1. cmake_minimum_required(VERSION 2.6)
  2. project(sylvan C CXX)
  3. enable_testing()
  4. set(CMAKE_C_FLAGS "-O3 -Wextra -Wall -Werror -fno-strict-aliasing -std=gnu11 -fPIC")
  5. set(CMAKE_CXX_FLAGS "-O3 -Wextra -Wall -Werror -fno-strict-aliasing -Wno-deprecated-register -std=gnu++11 -fPIC")
  6. option(WITH_COVERAGE "Add generation of test coverage" OFF)
  7. if(WITH_COVERAGE)
  8. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -coverage")
  9. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -coverage")
  10. find_program(GCOV_PATH gcov)
  11. find_program(LCOV_PATH lcov)
  12. find_program(GENHTML_PATH genhtml)
  13. add_custom_target(coverage
  14. # Cleanup lcov
  15. ${LCOV_PATH} --directory . --zerocounters
  16. # Run tests
  17. COMMAND make test
  18. # Capture counters
  19. COMMAND ${LCOV_PATH} --gcov-tool ${GCOV_PATH} --directory . --capture --output-file coverage.info
  20. 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
  21. COMMAND ${GENHTML_PATH} -o coverage coverage.info.cleaned
  22. COMMAND ${CMAKE_COMMAND} -E remove coverage.info coverage.info.cleaned
  23. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
  24. )
  25. endif()
  26. set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
  27. find_package(GMP REQUIRED)
  28. include_directories(${GMP_INCLUDE_DIR})
  29. include_directories(src)
  30. include_directories(src)
  31. add_subdirectory(src)
  32. option(SYLVAN_BUILD_TEST "Build test programs" ON)
  33. if(SYLVAN_BUILD_TEST)
  34. add_subdirectory(test)
  35. endif()
  36. option(SYLVAN_BUILD_EXAMPLES "Build example tools" OFF)
  37. if(SYLVAN_BUILD_EXAMPLES)
  38. add_subdirectory(examples)
  39. endif()