-
-
Notifications
You must be signed in to change notification settings - Fork 703
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
CMake refactor #1510
CMake refactor #1510
Conversation
- removed logic to find CppUnit (no longer used) - removed "dirs" variable used to pass include directories - removed add_library function (no longer used) - removed make_executable function * only used in 2 places (polybar and polybar-msg) * it was more general than needed, logic is simpler without it - split polybar into static library and executable * this allows linking unit tests to the library
Codecov Report
@@ Coverage Diff @@
## master #1510 +/- ##
==========================================
+ Coverage 5.92% 23.62% +17.7%
==========================================
Files 162 49 -113
Lines 9037 2061 -6976
==========================================
- Hits 535 487 -48
+ Misses 8502 1574 -6928
Continue to review full report at Codecov.
|
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!
I feel like cmake is quite bloated in some places, this is a good step forward.
I just noticed that codecov now reports very high coverage because libpoly
isn't compiled with any of the coverage flags.
How would you tackle this?
I thought about either adding a new build type Coverage
that extends debug flags with those flags. Or adding those flags to libpoly
in tests/CMakeLists.txt
, if that's possible, regardless of build type.
The second one feels a bit weird to me because your executable starts producing coverage files when -DBUILD_TESTS=ON
is used even if that was not really intended. The Coverage
build type would also create those files, but there it's more intentional.
But maybe we just won't get around compiling libpoly
separately for our tests.
Good catch on the coverage. I agree, I think create a separate build type for coverage is the best idea. I don't think there's any way to avoid compiling specially for coverage, since all the source files you want data for need to be compiled with the To enable coverage, I'm thinking I'd add this in the top level CMakeLists (or one of the files included from set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_COVERAGE} --coverage") Then CMake could be invoked as cmake /path/to/polybar -DCMAKE_BUILD_TYPE=Coverage From there, it would be built as normal. Couple of notes on the flag choices:
|
- Added a CMake build type "Coverage" that builds C and C++ code with the "--coverage" flag (recognized by both GCC and Clang) - removed "-Wno-missing-field-initializers" from test flags, since it didn't seem to be needed any more - removed logic from tests/CMakeLists to disable "-Werror" and "-pedantic-errors" since there didn't seem to be any warnings during the build
So looking through the files, it seems like I also had a couple of thoughts on potential changes, but they might alter the default build behavior, so I didn't want to jump right in, considering I don't have much experience with the project's current setup.
In the top level CMakeLists:
|
Oh, also, I wasn't able to figure out how to change the |
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.
You don't have to change it in .codecov.yml
, the coverage is generated in travis. So you can change it in .travis.yml
, specifically, here.
I agree, you can remove that. This shouldn't change the default behaviour since
We could use
The reasoning behind this was that as a dev one might configure with |
I updated travis to use the coverage build. I also enabled building the tests as part of the "all" build.
You can also use I removed cmake /path/to/polybar -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Og"
cmake /path/to/polybar -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG="-Og" |
@patrick96 I fixed the merge conflict (there was a unit test added 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.
Awesome. Everything seems to be in order. Thanks!
You can now add the non-cmake commits from #1505 into a new PR :) |
Great, thanks! Just created a pull request : ) |
Splitting off the CMake changes from the earlier pull request (#1505)