Tools for testing Jastacry on runtime https://jastacry.org
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.

CMakeLists.txt 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
  2. project (JCmeasure LANGUAGES CXX)
  3. SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
  4. SET(GCC_COVERAGE_LINK_FLAGS "-fprofile-arcs -lgcov")
  5. SET(GCC_WARNING_FLAGS "-Wall -Wextra")
  6. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_WARNING_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
  7. SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
  8. set (CMAKE_CXX_STANDARD 14)
  9. include(ExternalProject)
  10. ExternalProject_Add(spdlog
  11. URL https://github.com/gabime/spdlog/archive/v1.3.1.zip
  12. URL_HASH SHA1=d7f23635474c3df0d5f1fcd1ff7694a49fb1e873
  13. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/spdlog
  14. CONFIGURE_COMMAND ""
  15. BUILD_COMMAND ""
  16. INSTALL_COMMAND ""
  17. )
  18. file(GLOB SOURCES
  19. ./*.h
  20. ./Measure*.cpp
  21. )
  22. add_library(mylib
  23. STATIC
  24. ${SOURCES}
  25. )
  26. add_dependencies(mylib spdlog)
  27. file(GLOB TESTSOURCES
  28. ./*.h
  29. ./test/*_test.cpp
  30. )
  31. add_library(mytestlib
  32. STATIC
  33. ${TESTSOURCES}
  34. )
  35. add_executable(JCmeasure JCmeasure.cpp)
  36. add_dependencies(JCmeasure spdlog)
  37. include_directories(${CMAKE_CURRENT_BINARY_DIR}/spdlog/src/spdlog/include/)
  38. target_link_libraries(JCmeasure
  39. pthread
  40. mylib
  41. )
  42. # Testing from here on
  43. ExternalProject_Add(gtest
  44. URL https://github.com/google/googletest/archive/release-1.8.1.zip
  45. URL_HASH SHA1=7b41ea3682937069e3ce32cb06619fead505795e
  46. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gtest
  47. INSTALL_COMMAND ""
  48. )
  49. ExternalProject_Get_Property(gtest source_dir binary_dir)
  50. ExternalProject_Add(gtap
  51. URL https://github.com/kinow/gtest-tap-listener/archive/0.6.zip
  52. URL_HASH SHA1=37bc91c94732e81790609df8a0076769dbe4dbc0
  53. PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gtap
  54. CONFIGURE_COMMAND ""
  55. BUILD_COMMAND ""
  56. INSTALL_COMMAND ""
  57. )
  58. # Link runTests with what we want to test and the GTest and pthread library
  59. add_executable(runTests ${TESTSOURCES} test/tests.cpp)
  60. add_dependencies(runTests gtest gtap)
  61. include_directories(${CMAKE_CURRENT_BINARY_DIR}/gtest/src/gtest/googletest/include/)
  62. include_directories(${CMAKE_CURRENT_BINARY_DIR}/gtap/src/gtap/src/)
  63. target_link_libraries(runTests ${binary_dir}/googlemock/gtest/libgtest.a)
  64. target_link_libraries(runTests ${binary_dir}/googlemock/gtest/libgtest_main.a)
  65. target_link_libraries(runTests pthread mylib)
  66. enable_testing()
  67. add_test(runTests runTests)
  68. # LCOV tools
  69. SET(COVERAGE_LCOV_EXCLUDES, '8/*')
  70. SET(LCOV_ARGS '--no-external')
  71. SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
  72. include(CodeCoverage)
  73. APPEND_COVERAGE_COMPILER_FLAGS("-O0")
  74. SETUP_TARGET_FOR_COVERAGE_LCOV(
  75. NAME runTests_coverage # New target name
  76. EXECUTABLE runTests ../data
  77. DEPENDENCIES runTests # Dependencies to build first
  78. )
Social stuff:
Mastodon