Clean up and document project files (#4560)

This commit is contained in:
Niels Lohmann
2025-01-17 06:53:35 +01:00
committed by GitHub
parent ad2ee18539
commit 26cfec34be
519 changed files with 3301 additions and 1332 deletions
+171 -24
View File
@@ -1,5 +1,24 @@
# Package Managers
<center>
![Homebrew](../images/package_managers/homebrew.svg){: style="height:1em"}&nbsp;[**Homebrew**](#homebrew) `nlohmann-json` &emsp;
![Meson](../images/package_managers/meson.svg){: style="height:1em"}&nbsp;[**Meson**](#meson) `nlohmann_json` &emsp;
![Bazel](../images/package_managers/bazel.svg){: style="height:1em"}&nbsp;[**Bazel**](#bazel) `nlohmann_json`<br>
![Conan](../images/package_managers/conan.svg){: style="height:1em"}&nbsp;[**Conan**](#conan) `nlohmann_json` &emsp;
![Spack](../images/package_managers/spack.svg){: style="height:1em"}&nbsp;[**Spack**](#spack) `nlohmann-json` &emsp;
[**Hunter**](#hunter) `nlohmann_json`<br>
![vcpkg](../images/package_managers/vcpkg.png){: style="height:1em"}&nbsp;[**vcpkg**](#vcpkg) `nlohmann-json` &emsp;
[**cget**](#cget) `nlohmann/json` &emsp;
![Swift Package Manager](../images/package_managers/swift.svg){: style="height:1em"}&nbsp;[**Swift Package Manager**](#swift-package-manager) `nlohmann/json`<br>
![Nuget](../images/package_managers/nuget.svg){: style="height:1em"}&nbsp;[**NuGet**](#nuget) `nlohmann.json` &emsp;
![Conda](../images/package_managers/conda.svg){: style="height:1em"}&nbsp;[**Conda**](#conda) `nlohmann_json` &emsp;
![MacPorts](../images/package_managers/macports.svg){: style="height:1em"}&nbsp;[**MacPorts**](#macports) `nlohmann-json`<br>
![cpm.cmake](../images/package_managers/CPM.png){: style="height:1em"}&nbsp;[**CPM.cmake**](#cpmcmake) `gh:nlohmann/json`
![xmake](../images/package_managers/xmake.svg){: style="height:1em"}&nbsp;[**xmake**](#xmake) `nlohmann_json`
</center>
## Running example
Throughout this page, we will describe how to compile the example file `example.cpp` below.
```cpp
@@ -18,6 +37,7 @@ When executed, this program should create output similar to
formula: [**`nlohmann-json`**](https://formulae.brew.sh/formula/nlohmann-json)
- [![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/nlohmann-json.svg)](https://repology.org/project/nlohmann-json/versions)
- :octicons-tag-24: Availalbe versions: current version and development version (with `--HEAD` parameter)
- :octicons-rocket-24: The formula is updated with every release.
- :octicons-person-24: Maintainer: Niels Lohmann
@@ -92,8 +112,7 @@ The header can be used directly in your code or via CMake.
If you are using the [Meson Build System](http://mesonbuild.com), add this source tree as a [meson subproject](https://mesonbuild.com/Subprojects.html#using-a-subproject). You may also use the
`include.zip` published in this project's [Releases](https://github.com/nlohmann/json/releases) to reduce the size of the vendored source tree. Alternatively,
you can get a wrap file by downloading it from [Meson WrapDB](https://mesonbuild.com/Wrapdb-projects.html), or simply
use
you can get a wrap file by downloading it from [Meson WrapDB](https://mesonbuild.com/Wrapdb-projects.html), or use
```shell
meson wrap install nlohmann_json
@@ -102,7 +121,7 @@ meson wrap install nlohmann_json
Please see the Meson project for any issues regarding the packaging.
The provided `meson.build` can also be used as an alternative to CMake for installing `nlohmann_json` system-wide in
which case a pkg-config file is installed. To use it, simply have your build system require the `nlohmann_json`
which case a pkg-config file is installed. To use it, have your build system require the `nlohmann_json`
pkg-config dependency. In Meson, it is preferred to use the
[`dependency()`](https://mesonbuild.com/Reference-manual.html#dependency) object with a subproject fallback, rather than
using the subproject directly.
@@ -175,6 +194,7 @@ repository can be referenced within a `MODULE.bazel` by rules such as `archive_o
recipe: [**`nlohmann_json`**](https://conan.io/center/recipes/nlohmann_json)
- [![ConanCenter package](https://repology.org/badge/version-for-repo/conancenter/nlohmann-json.svg)](https://repology.org/project/nlohmann-json/versions)
- :octicons-tag-24: Availalbe versions: current version and older versions (see
[Conan Center](https://conan.io/center/recipes/nlohmann_json))
- :octicons-rocket-24: The package is update automatically via
@@ -220,6 +240,7 @@ requires, where `x.y.z` is the release version you want to use.
package: [**`nlohmann-json`**](https://packages.spack.io/package.html?name=nlohmann-json)
- [![Spack package](https://repology.org/badge/version-for-repo/spack/nlohmann-json.svg)](https://repology.org/project/nlohmann-json/versions)
- :octicons-tag-24: Availalbe versions: current version and older versions (see
[Spack package](https://packages.spack.io/package.html?name=nlohmann-json))
- :octicons-rocket-24: The package is updated with every release.
@@ -314,21 +335,13 @@ Please see the Hunter project for any issues regarding the packaging.
cmake --build build
```
## Buckaroo
If you are using [Buckaroo](https://buckaroo.pm), you can install this library's module with `buckaroo add github.com/buckaroo-pm/nlohmann-json`. There is a demo repo [here](https://github.com/njlr/buckaroo-nholmann-json-example).
!!! warning
The module is outdated as the respective [repository](https://github.com/buckaroo-pm/nlohmann-json) has not been
updated in years.
## vcpkg
!!! abstract "Summary"
package: [**`nlohmann-json`**](https://github.com/Microsoft/vcpkg/tree/master/ports/nlohmann-json)
- [![Vcpkg package](https://repology.org/badge/version-for-repo/vcpkg/nlohmann-json.svg)](https://repology.org/project/nlohmann-json/versions)
- :octicons-tag-24: Availalbe versions: current version
- :octicons-rocket-24: The package is updated with every release.
- :octicons-file-24: File issues at the [vcpkg issue tracker](https://github.com/microsoft/vcpkg/issues)
@@ -419,9 +432,16 @@ installed by adding the `-DJSON_MultipleHeaders=ON` flag (i.e., `cget install nl
cmake --build build
```
## CocoaPods
## Swift Package Manager
If you are using [CocoaPods](https://cocoapods.org), you can use the library by adding pod `"nlohmann_json", '~>3.1.2'` to your podfile (see [an example](https://bitbucket.org/benman/nlohmann_json-cocoapod/src/master/)). Please file issues [here](https://bitbucket.org/benman/nlohmann_json-cocoapod/issues?status=new&status=open).
!!! abstract "Summary"
package: **`nlohmann/json`**
- :octicons-tag-24: Availalbe versions: current version and older versions
- :octicons-rocket-24: The package is updated with every release.
- :octicons-file-24: File issues at the [library issue tracker](https://github.com/nlohmann/json/issues)
- :octicons-question-24: [Xcode documentation](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app)
## NuGet
@@ -457,8 +477,8 @@ dotnet add package nlohmann.json
recommends adding “native” and “nativepackage” tags to C++ NuGet packages to distinguish them, but even adding
“native” to search query would still show many .NET-only packages in the list.
Nevertheless, after finding the package you want, just click on “Install” button and accept confirmation dialogs.
After the package is successfully added to the projects, you should be able to just build and execute the project
Nevertheless, after finding the package you want, click on “Install” button and accept confirmation dialogs.
After the package is successfully added to the projects, you should be able to build and execute the project
without the need for making any more changes to build settings.
!!! note
@@ -558,11 +578,58 @@ more information.
## Conda
If you are using [conda](https://conda.io/), you can use the package [nlohmann_json](https://github.com/conda-forge/nlohmann_json-feedstock) from [conda-forge](https://conda-forge.org) executing `conda install -c conda-forge nlohmann_json`. Please file issues [here](https://github.com/conda-forge/nlohmann_json-feedstock/issues).
!!! abstract "Summary"
package: [**`nlohmann_json`**](https://anaconda.org/conda-forge/nlohmann_json)
- ![](https://img.shields.io/conda/v/conda-forge/nlohmann_json)
- :octicons-tag-24: Availalbe versions: current and previous versions
- :octicons-rocket-24: The package is updated with every release.
- :octicons-file-24: File issues at the [feedstock's issue tracker](https://github.com/conda-forge/nlohmann_json-feedstock/issues)
- :octicons-question-24: [Conda documentation](https://docs.conda.io/projects/conda/en/stable/user-guide/getting-started.html)
If you are using [conda](https://conda.io/), you can use the package
[nlohmann_json](https://anaconda.org/conda-forge/nlohmann_json) from [conda-forge](https://conda-forge.org) executing
```shell
conda install -c conda-forge nlohmann_json
```
??? example
1. Create the following file:
```cpp title="example.cpp"
--8<-- "integration/conda/example.cpp"
```
2. Create and activate an anvironment "json`:
```shell
conda create -n json
conda activate json
```
3. Install the package:
```shell
conda install -c conda-forge nlohmann_json
```
4. Build the code:
```shell
g++ -std=c++11 -I$(conda info --base)/envs/json/include example.cpp -o example
```
## MSYS2
If you are using [MSYS2](http://www.msys2.org/), you can use the [mingw-w64-nlohmann-json](https://packages.msys2.org/base/mingw-w64-nlohmann-json) package, just type `pacman -S mingw-w64-i686-nlohmann-json` or `pacman -S mingw-w64-x86_64-nlohmann-json` for installation. Please file issues [here](https://github.com/msys2/MINGW-packages/issues/new?title=%5Bnlohmann-json%5D) if you experience problems with the packages.
If you are using [MSYS2](http://www.msys2.org/), you can use the [mingw-w64-nlohmann-json](https://packages.msys2.org/base/mingw-w64-nlohmann-json) package, type `pacman -S mingw-w64-i686-nlohmann-json` or `pacman -S mingw-w64-x86_64-nlohmann-json` for installation. Please file issues [here](https://github.com/msys2/MINGW-packages/issues/new?title=%5Bnlohmann-json%5D) if you experience problems with the packages.
[![MSYS2 clang64 package](https://repology.org/badge/version-for-repo/msys2_clang64/nlohmann-json.svg)](https://repology.org/project/nlohmann-json/versions)
[![MSYS2 clangarm64 package](https://repology.org/badge/version-for-repo/msys2_clangarm64/nlohmann-json.svg)](https://repology.org/project/nlohmann-json/versions)
[![MSYS2 mingw package](https://repology.org/badge/version-for-repo/msys2_mingw/nlohmann-json.svg)](https://repology.org/project/nlohmann-json/versions)
[![MSYS2 ucrt64 package](https://repology.org/badge/version-for-repo/msys2_ucrt64/nlohmann-json.svg)](https://repology.org/project/nlohmann-json/versions)
:material-update: The [package](https://packages.msys2.org/base/mingw-w64-nlohmann-json) is updated automatically.
@@ -572,6 +639,7 @@ If you are using [MSYS2](http://www.msys2.org/), you can use the [mingw-w64-nloh
port: [**`nlohmann-json`**](https://ports.macports.org/port/nlohmann-json/)
- [![MacPorts package](https://repology.org/badge/version-for-repo/macports/nlohmann-json.svg)](https://repology.org/project/nlohmann-json/versions)
- :octicons-tag-24: Availalbe versions: current version
- :octicons-rocket-24: The port is updated with every release.
- :octicons-file-24: File issues at the [MacPorts issue tracker](https://trac.macports.org/newticket?port=nlohmann-json)
@@ -632,16 +700,17 @@ to install the [nlohmann-json](https://ports.macports.org/port/nlohmann-json/) p
## build2
If you are using [`build2`](https://build2.org), you can use the [`nlohmann-json`](https://cppget.org/nlohmann-json) package from the public repository <http://cppget.org> or directly from the [package's sources repository](https://github.com/build2-packaging/nlohmann-json). In your project's `manifest` file, just add `depends: nlohmann-json` (probably with some [version constraints](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-add-remove-deps)). If you are not familiar with using dependencies in `build2`, [please read this introduction](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml).
If you are using [`build2`](https://build2.org), you can use the [`nlohmann-json`](https://cppget.org/nlohmann-json)
package from the public repository <http://cppget.org> or directly from the
[package's sources repository](https://github.com/build2-packaging/nlohmann-json). In your project's `manifest` file,
add `depends: nlohmann-json` (probably with some [version constraints](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-add-remove-deps)). If you are not familiar with using dependencies in `build2`, [please read this introduction](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml).
Please file issues [here](https://github.com/build2-packaging/nlohmann-json) if you experience problems with the packages.
:material-update: The [package](https://cppget.org/nlohmann-json) is updated automatically.
## wsjcpp
If you are using [`wsjcpp`](http://wsjcpp.org), you can use the command `wsjcpp install "https://github.com/nlohmann/json:develop"` to get the latest version. Note you can change the branch ":develop" to an existing tag or another branch.
:material-update: wsjcpp reads directly from the [GitHub repository](https://github.com/nlohmann/json) and is always up-to-date.
```shell
bdep new -t exe -l c++
```
## CPM.cmake
@@ -686,3 +755,81 @@ CPMAddPackage("gh:nlohmann/json@3.11.3")
cmake -S . -B build
cmake --build build
```
## xmake
!!! abstract "Summary"
package: [**`nlohmann_json`**](https://github.com/xmake-io/xmake-repo/blob/master/packages/n/nlohmann_json/xmake.lua)
- :octicons-tag-24: Availalbe versions: current and previous versions
- :octicons-rocket-24: The package is updated with every release.
- :octicons-file-24: File issues at the [xmake issue tracker](https://github.com/xmake-io/xmake-repo/issues)
- :octicons-question-24: [xmake website](https://xmake.io/#/)
??? example
1. Create the following files:
```cpp title="example.cpp"
--8<-- "integration/xmake/example.cpp"
```
```lua title="xmake.lua"
--8<-- "integration/xmake/xmake.lua"
```
2. Build
```shell
xmake
```
3. Run
```shell
xmake run
```
* * *
## Other package managers
The library is also contained in many other package repositories: [![Packaging status](https://repology.org/badge/tiny-repos/nlohmann-json.svg)](https://repology.org/project/nlohmann-json/versions)
??? example "Package version overview"
[![Packaging status](https://repology.org/badge/vertical-allrepos/nlohmann-json.svg)](https://repology.org/project/nlohmann-json/versions)
* * *
## Buckaroo
If you are using [Buckaroo](https://buckaroo.pm), you can install this library's module with `buckaroo add github.com/buckaroo-pm/nlohmann-json`. There is a demo repo [here](https://github.com/njlr/buckaroo-nholmann-json-example).
!!! warning
The module is outdated as the respective [repository](https://github.com/buckaroo-pm/nlohmann-json) has not been
updated in years.
## CocoaPods
If you are using [CocoaPods](https://cocoapods.org), you can use the library by adding pod `"nlohmann_json", '~>3.1.2'`
to your podfile (see [an example](https://bitbucket.org/benman/nlohmann_json-cocoapod/src/master/)). Please file issues
[here](https://bitbucket.org/benman/nlohmann_json-cocoapod/issues?status=new&status=open).
![](https://img.shields.io/cocoapods/v/nlohmann_json)
!!! warning
The module is outdated as the respective [pod](https://cocoapods.org/pods/nlohmann_json) has not been updated in years.
## wsjcpp
If you are using [`wsjcpp`](http://wsjcpp.org), you can use the command `wsjcpp install "https://github.com/nlohmann/json:develop"`
to get the latest version. Note you can change the branch `:develop` to an existing tag or another branch.
!!! warning
The package manager is outdated as the respective [repository](https://github.com/wsjcpp/wsjcpp) has not been updated in years.