Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readded missing codecov cmake targets #345

Merged
merged 1 commit into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
46 changes: 46 additions & 0 deletions cmake/code_coverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 3 additions & 1 deletion docs/overview/ci-tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~~~~~~~~
Expand Down
11 changes: 10 additions & 1 deletion scripts/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_FILE:spdlog> $<TARGET_FILE_DIR:kompute_tests>)
add_custom_command(TARGET kompute_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:kp_logger> $<TARGET_FILE_DIR:kompute_tests>)
endif()


Loading