Skip to content
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

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

dcbaker
Copy link

@dcbaker dcbaker commented Sep 9, 2024

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 and ImplicitConversions 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 adding JSON_ would worse (-Dnlohmann_json:ImplicitConversions vs -Dnlohmann_json:JSON_ImplicitConversions).

Pull request checklist

Read the Contribution Guidelines for detailed information.

  • Changes are described in the pull request, or an existing issue is referenced.
  • The test suite compiles and runs without error.
  • Code coverage is 100%. Test cases can be added by editing the test suite.
  • The source code is amalgamated; that is, after making changes to the sources in the include/nlohmann directory, run make amalgamate to create the single-header files single_include/nlohmann/json.hpp and single_include/nlohmann/json_fwd.hpp. The whole process is described here.

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.
This simplifies the use of json as a subproject.
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.
Matching the CMake as closely as possible, as Meson doesn't have C++11
feature checks like CMAke does.
meson.build Outdated Show resolved Hide resolved
@nlohmann
Copy link
Owner

Is meson_options.txt really needed? If so, can it be moved into a subdirectory?

@dcbaker
Copy link
Author

dcbaker commented Sep 13, 2024

Meson options must be specified in a meson_options.txt (or for fairly new versions of Meson in a meson.options file), and that file has to be in the same directory as the root meson.build file. Meson options are read-only from the meson.build files, and are read in before the parsing of the meson.build file starts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants