-
-
Notifications
You must be signed in to change notification settings - Fork 194
feat: Add C++ modules support and update nlohmann::json #1530
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
base: dev
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for dpp-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
e91eaa8 to
121eb9b
Compare
Mishura4
left a comment
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.
Thanks for the PR! Good stuff. Just gonna prefer the approach with including dpp.h in the module for maintainability, as discussed in https://discord.com/channels/825407338755653642/825411104208977952/1454456223952011427
braindigitalis
left a comment
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.
some module related unit tests would be good. not repeating a thousand lines of code in dpp.cppm is an absolute must, as @Mishura4 also said.
|
I've looked at the |
|
I think that in this case you might want to make a new .cpp under the unittests folder which imports dpp instead of #including it. it can have some test functions that are exported and called via standard approaches from the main unittest file. |
1909f3f to
7f6fb23
Compare
|
I think this should fix the errors we're encountering. It's with the build system configuration |
|
you cant just do -DDPP_MODULES=ON for the entire CI matrix. Some CI's use older g++ (which we support) and some use C++17. |
|
Then is it possible to disable the modules unit tests for C++17 CI tests? |
|
@braindigitalis I think the modules CI should just be in a totally separate CI. It requires Ninja, as CMake can't build modules with Makefiles. |
|
unit tests only run in one g++, which is g++-12. This is the one which is packaged. we cant and dont run unit tests on them all, as the unit tests connect to discord and we cant do this concurrently. |
|
Updated Title to match code standards |
|
Perhaps it would be better to do module tests on a later compiler version, like Clang 21 (which there already is a test for), which is known to support modules? |
Yeah we can add it to the CI workflow to allow some to do it, lets get this PR sorted for now as we're getting close to everything working 😄 |
|
Decided to replace the hard-coded checks with a lambda instead, which should hopefully be accepted by Codacy. If you'd prefer not to let me know, but I do think this is the best way to ensure we can still check the conditions in the unit tests. |
|
Still seems annoyed about the role check, probably worth just removing it for now and we can address it in a new PR :) |
|
OK, I just broke the checks into two lambdas, and if it still doesn't pass I'll just comment it out for a later PR. Looks like it passes now. |
99a32b6 to
b982ef9
Compare
Jaskowicz1
left a comment
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.
Should be the last bits 😅
be5ed56 to
9220ab9
Compare
|
Hmm, this problem with the standard library has to do with symbols having internal linkage. They fixed most of this in GCC 15, because that's when they shipped module std. Let me try it with Ubuntu 25.10 and GCC 15 |
9d0c210 to
cc1e8db
Compare
|
Since you're having issues with g++-14 (which makes no sense because I can build g++-14 modules fine locally), just use a clang version that's supported (pretty sure clang15 has modules, but use clang18). Make sure you set the CXX for the env on both builds and then the apt install too 🫡 |
|
I have no idea why this current error is happening seeing as it never happened on my end, though I built mine in Clang 21. |
|
Seems it's a clang18 issue 🙃 , change to clang20 |
This pull request adds support for C++20 modules.
In order to accomplish this, some constants were changed to using external linkage. I have also updated nlohmann/json to version 3.12.0, as the older version declares some symbols as internal.
Code change checklist