-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Bring Meson build definition more in line with CMake #4452
base: develop
Are you sure you want to change the base?
Conversation
138d391
to
641e353
Compare
5b5adfe
to
b65e362
Compare
Is meson_options.txt really needed? If so, can it be moved into a subdirectory? |
Meson options must be specified in a |
This pull request has been marked as stale because it has had no activity for 30 days. While we won’t close it automatically, we encourage you to update or comment if it is still relevant. Keeping pull requests active and up-to-date helps us review and merge changes more efficiently. Thank you for your contributions! |
I know that the meson_options.txt seems to be a blocker here, if I opened a new PR with the patches up until meson_options.txt is added, would that allow those changes to move faster? |
How is this related to #3885? |
It's not at all. I can comment there. |
Please do - I don't know Meson and will not be able to solve any of these issues. |
This PR improves the meson build significantly. All the headers are now being installed. It doesn’t address the .cmake files (but that is a seperate issue.) it would be good to see this merged.
|
b65e362
to
7f44940
Compare
for better readability Signed-off-by: Dylan Baker <[email protected]>
Without a version set meson will give no developer warnings, including deprecations. 0.64 was selected as it's quite old, it's the newest version supported by muon (a pure C Meson implementation), and there's nothing complicated going on here. Signed-off-by: Dylan Baker <[email protected]>
This simplifies the use of json as a subproject. Signed-off-by: Dylan Baker <[email protected]>
This makes a single call to install the entire directory, and doesn't need an update if any new headers are added. It also will simplify bringing the Meson and CMake builds into allignment on how they handle the multi-header vs single-header setups. Signed-off-by: Dylan Baker <[email protected]>
Matching the CMake as closely as possible, as Meson doesn't have C++11 feature checks like CMAke does. Signed-off-by: Dylan Baker <[email protected]>
This uses a meson option (set in `meson_options.txt`) to control whether multi-header or single-header setup is wanted. Signed-off-by: Dylan Baker <[email protected]>
Signed-off-by: Dylan Baker <[email protected]>
Signed-off-by: Dylan Baker <[email protected]>
7f44940
to
e40b32d
Compare
I've rebased on the current develop branch to fix conflicts and added my signed-off-by |
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 also document meson.build
and meson_options.txt
in FILES.md
.
'MultipleHeaders', | ||
type: 'boolean', | ||
value: true, | ||
description: 'Use non-amalgomated version of the library', |
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.
description: 'Use non-amalgomated version of the library', | |
description: 'Use non-amalgamated version of the library', |
type: 'boolean', | ||
value: true, | ||
description: 'Enable implicit conversions', | ||
) |
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.
There are more flags, see https://json.nlohmann.me/integration/cmake/#cmake-options for example. Though not are equally interesting, I wonder why here only theres three have been selected.
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.
It's been a while, I remember for sure that the MultipleHeaders
option is essential to get the same behavior out of Meson and CMake, especially when using the Meson definitions in an embedded project. I don't remember why I added the other two.
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.
@nlohmann: I looked more, and I'm pretty sure that the reason that I added those two options in particular is that the related defines are exposed publicly in the pkg-config file. So for Meson and CMake to generate equivalent .pc files we'd need that.
Now that I'm looking at the generated CMake Target, it looks like JSON_DISABLE_ENUM_SERIALIZATION, JSON_DIAGNOSTICS, JSON_DIAGNOSTIC_POSITIONS, and JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON are exposed in CMake, so maybe we should update the pkg-config CMake generates to expose those as well?
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.
Sounds plausible, but I would not know how :)
Update the Meson build definition to use Meson best practices, and bring into alignment with the CMake build files.
Particularly, This changes the meson build to only expose a single target, like the CMake does, controlled by an option with the same name. It additionally exposes the
GlobalUDLs
andImplicitConversions
options, which have behavioral implementations a consumer may wish to control. I have not exposed other options as they don't seem to be important for behavior.The options names do not have the
JSON_
prefix, and Meson already has (sub)project option namespaces, so addingJSON_
would worse (-Dnlohmann_json:ImplicitConversions
vs-Dnlohmann_json:JSON_ImplicitConversions
).Pull request checklist
Read the Contribution Guidelines for detailed information.
include/nlohmann
directory, runmake amalgamate
to create the single-header filessingle_include/nlohmann/json.hpp
andsingle_include/nlohmann/json_fwd.hpp
. The whole process is described here.