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
Revamp build process #5
Conversation
This let me more easily build the examples and tests so I could get started looking at the important bits in the core library. The C++ Starter Pack was doing some really weird stuff with CMake that I thought would only serve to confuse future contributors. Hope this helps. I'm eager to dive into the C++. |
Examples are included in the build by default. There's a BUILD_EXAMPLES option which can turn them off. Running tests is as simple as running
Docs aren't greatly changed. You still have to build that custom target. They don't work on my machine either.
Possibly. If you enable workflows for this PR then we can see what broke and I can try to fix it. |
I updated the README to reflect the new simpler way that everything is built. No need to juggle multiple binary directories anymore. |
Hi Chris, First of all thank you for taking the time to contribute! There is certainly a lot of "boilerplate" build code at the moment and some clean up is needed. And I love to hear that you'd like to dive into the C++ code as well. You made me realize there's no CONTRIBUTING.md file yet, I'm creating it now and this will hopefully simplify future contributions. I went through the changes, this is a lot of them! A few notes (and questions):
On a side note, tests would fail for sure at the moment because the automated build process uses other commands. |
Unrelated but 165 stars already?? That's amazing! Also could you approve workflows for this MR so the CI pipeline can do its thing?
That starter project includes a lot of stuff that you might not need so it'd definitely be good to remove all but the bits you understand and can make use of. Much of it is good, but it imposes some weird CMake practices that I disagree with.
Examples can be disabled. If the compile time for the examples is unacceptable then you can disable them but keep building the tests so that you can verify your changes to the core library. Anyone who ingests this project via
I removed a lot of unnecessary stuff from the matplotplusplus build that was blowing up compile times. Also, because the old one-binary-dir-per-example structure meant lots of extra CPMAddPackage calls, it would be harder to maintain those build options across every instance where the package is included. Now it's just built once and as long as you don't delete your binary dir, that package never gets rebuilt. You don't have to build that every single time you want to build a new example.
See the
This isn't required if you're using a version of CMake newer than 2.6. Any newer version will automatically fail to configure the project if that minimum version requirement isn't met. Using a CMake version older than 2.6 is insane these days and it's safe to say no one will try to use that.
If I recall correctly it was empty and unused. I could be mistaken though.
CPM is still being used. I tweaked how we're using it but it's still doing the job of fetching the dependencies. I've briefly used CPM but am not an expert so there might be better ways to use it.
You had enabled On this note, you had these compiler warnings as a usage require of the core library which is a bit heavy-handed. Just because you depend on |
Hi Chris, I approved the CI pipeline, sorry about that. I will get back to you asap! |
@giacomo-b I think I fixed the CI pipeline but you'll have to approve it to run again. For the most part I just had to change the source directory passed to cmake. I did remove the examples.yml workflow since examples are already built by default so we don't need an extra workflow for building them; all the other workflows build the examples. |
@giacomo-b I just pushed some more pipeline fixes but something you'll have to decide is what to do about shadowed variable warnings with MSVC. /W4 includes the equivalent of -Wshadow (which we're not using). Do we go down to /W3 or fix the shadowed variables? |
This was so unexptected! I don't have a lot of free time, but I will definitely keep working on it.
I think the best way to build all the examples at once would be to leave the choice to the user when running That way, This would also allow easier CI testing of all the examples, but would still leave the possibility of running just
Great to know.
I'll double check the original repo asap.
What OS are you using? I am asking this because I tried to build the examples with Linux and Windows, but didn't receive any errors.
This is a very good point. |
Hi Chris, are there several warnings at the moment? |
Environment variables aren't involved. The options are specified when configuring the project like Would you prefer it if examples were off by default?
Configuring the project just takes a few moments. After that you can run All these features are present in CMake without having to get clever about using multiple binary directories. There's little to gain by requiring that users juggle multiple binary directories. Most potential developers probably won't have a solid grasp of how multiple binary directories work and it will make it harder for them to contribute. I'm not even sure how you go about configuring such a multi-binary-dir project with an IDE.
Clang 12 in macOS 10.15.
The CI pipeline reports at least one /W4 warning from MSVC. Eigen's GitLab repo is offline so the CI is pipeline is failing before you can see some of the warnings being produced. |
What I'm trying to achieve: * Better adhere to CMake conventions * Better adhere to CMake best practices * Reduce build times * Allow for building all code in one (and only one) binary dir * Improve readability * Improve maintainability
Codecov Report
@@ Coverage Diff @@
## master #5 +/- ##
==========================================
- Coverage 50.00% 1.85% -48.15%
==========================================
Files 2 12 +10
Lines 16 270 +254
==========================================
- Hits 8 5 -3
- Misses 8 265 +257
Continue to review full report at Codecov.
|
@giacomo-b are you still interested in this PR? |
Hi @ChrisThrasher, sorry for the incredible delay. Yes, I am still interested, although I have been extremely busy with work. |
What I'm trying to achieve: