mirror of
https://github.com/nlohmann/json.git
synced 2026-09-03 06:57:15 +00:00
Clean up and document project files (#4560)
This commit is contained in:
@@ -1,5 +1,24 @@
|
||||
# Package Managers
|
||||
|
||||
<center>
|
||||
{: style="height:1em"} [**Homebrew**](#homebrew) `nlohmann-json`  
|
||||
{: style="height:1em"} [**Meson**](#meson) `nlohmann_json`  
|
||||
{: style="height:1em"} [**Bazel**](#bazel) `nlohmann_json`<br>
|
||||
{: style="height:1em"} [**Conan**](#conan) `nlohmann_json`  
|
||||
{: style="height:1em"} [**Spack**](#spack) `nlohmann-json`  
|
||||
[**Hunter**](#hunter) `nlohmann_json`<br>
|
||||
{: style="height:1em"} [**vcpkg**](#vcpkg) `nlohmann-json`  
|
||||
[**cget**](#cget) `nlohmann/json`  
|
||||
{: style="height:1em"} [**Swift Package Manager**](#swift-package-manager) `nlohmann/json`<br>
|
||||
{: style="height:1em"} [**NuGet**](#nuget) `nlohmann.json`  
|
||||
{: style="height:1em"} [**Conda**](#conda) `nlohmann_json`  
|
||||
{: style="height:1em"} [**MacPorts**](#macports) `nlohmann-json`<br>
|
||||
{: style="height:1em"} [**CPM.cmake**](#cpmcmake) `gh:nlohmann/json`
|
||||
{: style="height:1em"} [**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)
|
||||
|
||||
- [](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)
|
||||
|
||||
- [](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)
|
||||
|
||||
- [](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)
|
||||
|
||||
- [](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)
|
||||
|
||||
- 
|
||||
- :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.
|
||||
|
||||
[](https://repology.org/project/nlohmann-json/versions)
|
||||
[](https://repology.org/project/nlohmann-json/versions)
|
||||
[](https://repology.org/project/nlohmann-json/versions)
|
||||
[](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/)
|
||||
|
||||
- [](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: [](https://repology.org/project/nlohmann-json/versions)
|
||||
|
||||
??? example "Package version overview"
|
||||
|
||||
[](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).
|
||||
|
||||

|
||||
|
||||
!!! 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.
|
||||
|
||||
Reference in New Issue
Block a user