From 19cc91251ba9c340c2538e044f4f8d761738267c Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Sat, 20 Jan 2024 13:35:01 +0100 Subject: [PATCH] Readded missing codecov cmake targets Signed-off-by: Alejandro Saucedo --- CMakeLists.txt | 16 ++++++------- Makefile | 6 +++-- cmake/code_coverage.cmake | 46 ++++++++++++++++++++++++++++++++++++++ docs/overview/ci-tests.rst | 4 +++- scripts/requirements.txt | 11 ++++++++- test/CMakeLists.txt | 2 ++ 6 files changed, 73 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 591c696f..1fdc2f18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -256,14 +256,6 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror") endif() -if(KOMPUTE_OPT_CODE_COVERAGE) - if(NOT UNIX) - message(FATAL_ERROR "KOMPUTE_OPT_CODE_COVERAGE can only be enabled in unix based systems due to limitation on gcov.") - endif() - - include(cmake/code_coverage.cmake) -endif() - # If glslang is cloned, then SPIRV/GlslangToSpv.h will be used instead of glslang/SPIRV/GlslangToSpv.h # As after installation, SPIRV/ header files will be found in glslang/SPIRV/ , more info in #193 if(KOMPUTE_OPT_REPO_SUBMODULE_BUILD) @@ -283,6 +275,14 @@ if(KOMPUTE_OPT_BUILD_TESTS) add_subdirectory(test) endif() +if(KOMPUTE_OPT_CODE_COVERAGE) + if(NOT UNIX) + message(FATAL_ERROR "KOMPUTE_OPT_CODE_COVERAGE can only be enabled in unix based systems due to limitation on gcov.") + endif() + + include(cmake/code_coverage.cmake) +endif() + if(KOMPUTE_OPT_BUILD_DOCS) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/config" ${CMAKE_MODULE_PATH}) add_subdirectory(docs) diff --git a/Makefile b/Makefile index 62ad68b4..2e222c0d 100644 --- a/Makefile +++ b/Makefile @@ -81,8 +81,10 @@ mk_build_kompute: mk_build_tests: cmake --build build/. --target kompute_tests --parallel -mk_run_docs: mk_build_docs - (cd build/docs/sphinx && python2.7 -m SimpleHTTPServer) +mk_run_docs: mk_build_docs mk_run_docs_only + +mk_run_docs_only: + (cd build/docs/sphinx && python -m http.server) # An alternative would be: ctest -vv --test-dir build/. # But this is not possible since we need to filter specific tests, not complete executables, which is not possible with ctest. diff --git a/cmake/code_coverage.cmake b/cmake/code_coverage.cmake index 7fb6ce26..eae4cb2a 100644 --- a/cmake/code_coverage.cmake +++ b/cmake/code_coverage.cmake @@ -33,3 +33,49 @@ mark_as_advanced(CMAKE_CXX_FLAGS_COVERAGE CMAKE_C_FLAGS_COVERAGE CMAKE_EXE_LINKER_FLAGS_COVERAGE CMAKE_SHARED_LINKER_FLAGS_COVERAGE) + +add_custom_target(codecov_run_tests + COMMAND make -C ${PROJECT_SOURCE_DIR} mk_run_tests + DEPENDS kompute_tests) + +add_custom_target(codecov_copy_files + COMMAND ${CMAKE_COMMAND} + -E copy_directory + ${CMAKE_CURRENT_BINARY_DIR}/test/CMakeFiles/kompute_tests.dir/ + ${CODECOV_DIR} + COMMAND ${CMAKE_COMMAND} + -E copy_directory + ${CMAKE_CURRENT_BINARY_DIR}/src/CMakeFiles/kompute.dir/ + ${CODECOV_DIR} + DEPENDS kompute_tests codecov_run_tests) + +add_custom_target(codecov_gcov + COMMAND gcov + -b -c "*.gcno" + WORKING_DIRECTORY ${CODECOV_DIR} + DEPENDS codecov_copy_files) + +add_custom_target(codecov_lcov_capture + COMMAND lcov + --capture + -o ${CODECOV_FILENAME_LCOV_INFO_FULL} + -d . + WORKING_DIRECTORY ${CODECOV_DIR} + DEPENDS codecov_gcov) + +add_custom_target(codecov_lcov_extract + COMMAND lcov + --extract + ${CODECOV_FILENAME_LCOV_INFO_FULL} + -o ${CODECOV_FILENAME_LCOV_INFO} + -d . + "*/src/*" + WORKING_DIRECTORY ${CODECOV_DIR} + DEPENDS codecov_lcov_capture) + +add_custom_target(codecov_genhtml + COMMAND genhtml + ${CODECOV_FILENAME_LCOV_INFO} + --output-directory ${CODECOV_DIR_HTML} + WORKING_DIRECTORY ${CODECOV_DIR} + DEPENDS codecov_lcov_extract) diff --git a/docs/overview/ci-tests.rst b/docs/overview/ci-tests.rst index cbe0fe23..4f44534b 100644 --- a/docs/overview/ci-tests.rst +++ b/docs/overview/ci-tests.rst @@ -70,7 +70,9 @@ In order to build the documentation you will need the following dependencies: Once this installed: * You can build the documentation using the `gendocsall` cmake target -* You can serve the documentation locally using the `mk_run_docs` command in the Makefile + * This can be done with `make clean_cmake mk_cmake mk_build_docs` +* You can serve the documentation locally using the `mk_run_docs_only` command in the Makefile +>>>>>>> Stashed changes Performing Release ~~~~~~~~~~~~ diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 4da04250..92be9f67 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -7,5 +7,14 @@ quom==1.2.0 Sphinx==3.2.1 sphinx_material==0.0.30 breathe==4.20.0 + +# Dependencies for m2r2 m2r2==0.2.5 -git+git://github.com/pybind/pybind11_mkdoc.git@master +docutils<0.18 +mistune<2 + +# NEeded for backward compat of Sphynx +Jinja2<3.1 + +# Needed for the pybind docstrings +pybind11_mkdoc @ git+https://github.com/pybind/pybind11_mkdoc@master diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0564458c..e2dcab3b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -39,3 +39,5 @@ if(WIN32 AND BUILD_SHARED_LIBS) # Install dlls in the same directory as the exec add_custom_command(TARGET kompute_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ $) add_custom_command(TARGET kompute_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ $) endif() + +