mirror of
https://github.com/nlohmann/json.git
synced 2026-10-08 15:37:13 +00:00
Install CMake package config files with Meson, and add Meson options (#5587)
* Install CMake package config files with Meson, and add Meson options Squashed onto develop from: - Install CMake package config files with Meson - meson: Indent code inside an if block - meson: set a minimum Meson version - meson: use `override_dependency()` to set dependencies - meson: use `install_subdir` for headers - meson: set the C++ standard to C++11 - meson: handle single header and multiheader the same way CMake does - meson: add support for the GlobalUDLs option - meson: add support for the ImplictConversions option - Add meson information to FILES.md - Complete the Meson options and match CMake's compile definitions - Add the JSON_* definitions to the CMake pkg-config file - Document the Meson options and check them in CI - Fix the Meson CMake target for includedir or datadir outside the prefix - Avoid //include in Meson-generated CMake target for prefix / - Add DisableTupleReferenceConversion to Meson and the CMake pkg-config file - Check in CI that Meson and pkg-config offer the CMake options - Remove accidentally committed Python bytecode Co-authored-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Add the StrictBinaryUTF8 and DeleteDeprecatedFunctions Meson options JSON_StrictBinaryUTF8 (#5741) and JSON_DeleteDeprecatedFunctions (#5755) arrived with develop but were missing from the Meson build and the pkg-config file, so check_build_options failed. Both Meson options default to false and add JSON_STRICT_BINARY_UTF8=1 and JSON_DELETE_DEPRECATED_FUNCTIONS=1 to the dependency, the pkg-config file, and the generated CMake target; CMake's pkg-config file now carries both definitions too. The ci_meson_install job sets and checks them in its non-default install. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Niels Lohmann <mail@nlohmann.me> Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
This commit is contained in:
1 parent
a5f5d3059b
commit
ed8ba0201f
11 files changed
+505
-19
No files matched your search
@@ -249,9 +249,31 @@ make BUILD.bazel
|
||||
|
||||
The "Check amalgamation" workflow fails if the file is out of date.
|
||||
|
||||
### `meson.build`
|
||||
### `meson.build` and `meson_options.txt`
|
||||
|
||||
The build definition for the [Meson](https://mesonbuild.com) build system.
|
||||
Meson build definitions suitable for use as a subproject ("wrap" in Meson terminology).
|
||||
|
||||
Projects wishing to use the wrap can execute:
|
||||
```sh
|
||||
meson wrap install nlohmann_json
|
||||
```
|
||||
|
||||
Which allows Meson to build from source when a system provided dependency isn't available.
|
||||
|
||||
To build directly:
|
||||
```sh
|
||||
meson setup builddir
|
||||
ninja -C builddir
|
||||
```
|
||||
|
||||
`meson_options.txt` defines the options, which mirror the CMake options that change the library's target (for example,
|
||||
`-DDiagnostics=true`). Meson requires this file next to `meson.build`, so it is also part of `include.zip`. `make check_build_options`
|
||||
([`tools/check_build_options`](tools/check_build_options/README.md)) checks in CI that both files and the pkg-config files
|
||||
stay in sync with the CMake options.
|
||||
|
||||
When installing, `meson.build` installs the headers, a pkg-config file, and the CMake package config files, so that
|
||||
`find_package(nlohmann_json)` works. As Meson cannot generate `nlohmann_jsonTargets.cmake` itself, it is created from
|
||||
the template `cmake/nlohmann_jsonTargets.cmake.in`, which is only used by Meson.
|
||||
|
||||
### `Package.swift`
|
||||
|
||||
|
||||
Reference in new issue
Block a user