Added targets for building codecov
This commit is contained in:
parent
0941d82122
commit
16ae365b93
3 changed files with 75 additions and 7 deletions
1
Makefile
1
Makefile
|
|
@ -69,6 +69,7 @@ mk_cmake:
|
|||
-DKOMPUTE_OPT_BUILD_SINGLE_HEADER=1 \
|
||||
-DKOMPUTE_OPT_ENABLE_SPDLOG=1 \
|
||||
-DSPDLOG_INSTALL=1 \
|
||||
-DKOMPUTE_OPT_CODE_COVERAGE=1 \
|
||||
-G "Unix Makefiles"
|
||||
|
||||
mk_build_all:
|
||||
|
|
|
|||
|
|
@ -21,8 +21,14 @@ set(DOXYFILE_IN
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
|
||||
set(DOXYFILE_OUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||
set(CODECOV_INDEX_FILE
|
||||
${DOXYGEN_OUTPUT_DIR/html/codecov/index.html})
|
||||
set(SPHINX_SOURCE
|
||||
${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(SPHINX_BUILD
|
||||
${CMAKE_CURRENT_BINARY_DIR}/sphinx)
|
||||
set(CODECOV_DOCS_DIR
|
||||
${SPHINX_BUILD}/codecov/)
|
||||
set(CODECOV_DOCS_INDEX_FILE
|
||||
${CODECOV_DOCS_DIR}/index.html})
|
||||
|
||||
# Perform replacement with cmake vars inside Doxifine.in
|
||||
configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY)
|
||||
|
|
@ -35,14 +41,25 @@ add_custom_command(
|
|||
COMMENT "Generating docs"
|
||||
)
|
||||
|
||||
if(KP_OPT_DOCS_GEN_CODECOV)
|
||||
if(KOMPUTE_OPT_CODE_COVERAGE)
|
||||
add_custom_target(gendoxygen ALL
|
||||
DEPENDS ${DOXYGEN_INDEX_FILE} ${DOXYGEN_OUTPUT_DIR})
|
||||
DEPENDS ${DOXYGEN_INDEX_FILE} ${CODECOV_DOCS_INDEX_FILE})
|
||||
else()
|
||||
add_custom_target(gendoxygen ALL
|
||||
DEPENDS ${DOXYGEN_INDEX_FILE})
|
||||
endif()
|
||||
|
||||
#####################################################
|
||||
########### CODECOV DOCS ###############
|
||||
#####################################################
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CODECOV_DOCS_INDEX_FILE}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-E copy_directory
|
||||
${CODECOV_DIR_HTML}
|
||||
${CODECOV_DOCS_DIR}
|
||||
DEPENDS codecov_genhtml)
|
||||
|
||||
#####################################################
|
||||
########### Sphinx ###############
|
||||
|
|
@ -50,9 +67,6 @@ endif()
|
|||
|
||||
find_package(Sphinx REQUIRED)
|
||||
|
||||
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/sphinx)
|
||||
|
||||
add_custom_target(gensphinx ALL
|
||||
COMMAND
|
||||
${SPHINX_EXECUTABLE} -b html
|
||||
|
|
|
|||
|
|
@ -35,4 +35,57 @@ target_link_libraries(test_kompute PRIVATE kompute)
|
|||
|
||||
add_test(NAME test_kompute COMMAND test_kompute)
|
||||
|
||||
#####################################################
|
||||
#################### CODECOV #######################
|
||||
#####################################################
|
||||
|
||||
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()
|
||||
|
||||
add_custom_target(codecov_run_tests
|
||||
COMMAND make -C ${PROJECT_SOURCE_DIR} mk_run_tests
|
||||
DEPENDS test_kompute)
|
||||
|
||||
add_custom_target(codecov_copy_files
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-E copy_directory
|
||||
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/test_kompute.dir/
|
||||
${CODECOV_DIR}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-E copy_directory
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../src/CMakeFiles/kompute.dir/
|
||||
${CODECOV_DIR}
|
||||
DEPENDS test_kompute 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
|
||||
COMMAND lcov
|
||||
--capture
|
||||
-o ${CODECOV_FILENAME_LCOV_INFO_FULL}
|
||||
-d .
|
||||
COMMAND lcov
|
||||
--extract
|
||||
${CODECOV_FILENAME_LCOV_INFO_FULL}
|
||||
-o ${CODECOV_FILENAME_LCOV_INFO}
|
||||
-d .
|
||||
"*/src/*" "*/test/*"
|
||||
WORKING_DIRECTORY ${CODECOV_DIR}
|
||||
DEPENDS codecov_gcov)
|
||||
|
||||
add_custom_target(codecov_genhtml
|
||||
COMMAND genhtml
|
||||
${CODECOV_FILENAME_LCOV_INFO}
|
||||
--output-directory ${CODECOV_DIR_HTML}
|
||||
WORKING_DIRECTORY ${CODECOV_DIR}
|
||||
DEPENDS codecov_lcov)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue