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

Feature/add gcov target #31

Closed

Conversation

ClausKlein
Copy link
Contributor

@ClausKlein ClausKlein commented Nov 24, 2024

Adds test coverage report feature.
Can be invoked with cmake process_coverage, the coverage report is generated in build/coverage/coverage.html.
Needs client to install gcovr.

NOTE: This is second of a series of PR based on #14

see too bemanproject/optional#82

Copy link
Member

@wusatosi wusatosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for splitting this change out as a separate PR.

Can you please keep the domain of a PR restricted to add gcov target.
No need to rush here.

Please include a description of the coverage feature in the PR, instead of:

Added VERIFY_INTERFACE_HEADER_SETS too.
(and fixed compiler errors found with this check)

NOTE: This is first of a series of PR based on https://github.com/bemanproject/inplace_vector/pull/14

Change to, e.g.

Adds test coverage report feature. 
Can be invoked with `cmake process_coverage`, the coverage report is generated in `build/coverage/coverage.html`.
Needs client to install `gcovr`.

Note: This is first of a series of PR based on #14 .

Request change:

  • remove unrelated CL to adding gcov target
  • Include a short description of this cmake target in README
  • Add license header for cmake/gcovr.cfg.in.

Comment on lines -6 to +8
cmake_minimum_required(VERSION 3.23)
set(CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE)

cmake_minimum_required(VERSION 3.25...3.31)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude changes unrelated to adding gcov target

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

CMakeLists.txt Outdated
Comment on lines 46 to 62
target_sources(
beman.inplace_vector
PUBLIC
FILE_SET inplace_vector_public_headers
TYPE HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/inplace_vector/inplace_vector.hpp"
)
set_target_properties(
beman.inplace_vector
PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON
)
target_compile_features(
beman.inplace_vector
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
"$<$<COMPILE_FEATURES:cxx_std_23>:cxx_std_23>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_std_23>>:cxx_std_20>"
)

set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config)
set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude changes unrelated to adding gcov target

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude

Comment on lines +18 to +20
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not allowed!")
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude changes unrelated to adding gcov target...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not done. Please exclude.

Comment on lines -47 to +68
DESTINATION
${CMAKE_INSTALL_LIBDIR}
)

# Install the header files to the appropriate destination
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}
FILES_MATCHING
PATTERN
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/inplace_vector/inplace_vector.hpp"
FILE_SET inplace_vector_public_headers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude changes unrelated to adding gcov target

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude

configure_file(cmake/gcovr.cfg.in gcovr.cfg @ONLY)

add_custom_target(
process_coverage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test this in CI? Its fine if this doesn't have like a nice reporting interface, but can you add a CI target to ensure this cmake target doesn't fail?

Also can you update README regarding this target?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a CI job to test this.

@ClausKlein ClausKlein marked this pull request as draft November 25, 2024 08:24
@ClausKlein ClausKlein force-pushed the feature/add_gcov_target branch 2 times, most recently from aab71ef to 043fd7b Compare November 27, 2024 06:42
ClausKlein and others added 3 commits December 6, 2024 07:56
Use FILE_SET HEADERS for simplify installation

Set VERIFY_INTERFACE_HEADER_SETS property

Prevent use of include(CTest)

Prepare CPack to easy distribution

Add all_verify_interface_header_sets to CI builds

Prevent in-source builds

Ignore cmake configure trash
Co-authored-by: David Sankel <camior@gmail.com>
@ClausKlein ClausKlein marked this pull request as ready for review December 6, 2024 07:59
Copy link
Member

@wusatosi wusatosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase and address previous concerns.

Edit: please stop falsely marking conversations as resolved

Comment on lines +18 to +20
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not allowed!")
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not done. Please exclude.

CMakeLists.txt Outdated
beman.inplace_vector
PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON
)
target_compile_features(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude unrelated changes

CMakeLists.txt Outdated
Comment on lines 46 to 62
target_sources(
beman.inplace_vector
PUBLIC
FILE_SET inplace_vector_public_headers
TYPE HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/inplace_vector/inplace_vector.hpp"
)
set_target_properties(
beman.inplace_vector
PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON
)
target_compile_features(
beman.inplace_vector
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
"$<$<COMPILE_FEATURES:cxx_std_23>:cxx_std_23>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_std_23>>:cxx_std_20>"
)

set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config)
set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude

Comment on lines -47 to +68
DESTINATION
${CMAKE_INSTALL_LIBDIR}
)

# Install the header files to the appropriate destination
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}
FILES_MATCHING
PATTERN
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/inplace_vector/inplace_vector.hpp"
FILE_SET inplace_vector_public_headers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude

configure_file(cmake/gcovr.cfg.in gcovr.cfg @ONLY)

add_custom_target(
process_coverage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a CI job to test this.

cobertura = @CMAKE_BINARY_DIR@/coverage/cobertura.xml
sonarqube = @CMAKE_BINARY_DIR@/coverage/sonarqube.xml
html-details = @CMAKE_BINARY_DIR@/coverage/coverage.html
# XXX gcov-executable = @GCOV_EXECUTABLE@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this comment for

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is based on an other beman project, but this use presets ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I am asking what is this line of comment for

@ClausKlein ClausKlein force-pushed the feature/add_gcov_target branch from 043fd7b to 50f1556 Compare December 6, 2024 08:18
@ClausKlein ClausKlein marked this pull request as draft December 6, 2024 08:23
@ClausKlein ClausKlein requested a review from wusatosi December 6, 2024 10:23
@ClausKlein
Copy link
Contributor Author

This waste my time

@ClausKlein ClausKlein closed this Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants