-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
There was a problem hiding this 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
.
cmake_minimum_required(VERSION 3.23) | ||
set(CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE) | ||
|
||
cmake_minimum_required(VERSION 3.25...3.31) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
CMakeLists.txt
Outdated
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}) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please exclude
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) | ||
message(FATAL_ERROR "In-source builds are not allowed!") | ||
endif() |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
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.
aab71ef
to
043fd7b
Compare
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>
There was a problem hiding this 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
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) | ||
message(FATAL_ERROR "In-source builds are not allowed!") | ||
endif() |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
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}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please exclude
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
cmake/gcovr.cfg.in
Outdated
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@ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ...
There was a problem hiding this comment.
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
043fd7b
to
50f1556
Compare
This waste my time |
Adds test coverage report feature.
Can be invoked with
cmake process_coverage
, the coverage report is generated inbuild/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