Skip to content
This repository has been archived by the owner on Aug 23, 2021. It is now read-only.

Latest commit

 

History

History
62 lines (44 loc) · 1.87 KB

README.md

File metadata and controls

62 lines (44 loc) · 1.87 KB

JSON for Modern C++ (Homebrew formula)

Deprecation Notice

This formula is now deprecated as nlohmann-json is now part of Homebrew Core. Use brew install nlohmann-json to install.

If you have used this repository's formula before, use

brew uninstall nlohmann_json
brew untap nlohmann/json
brew install nlohmann-json

Archived README

Build Status GitHub license

This Homebrew formula installs the header-only JSON for Modern C++ library to your system.

TL;DR: Just execute brew tap nlohmann/json and brew install nlohmann_json.

Usage

To use the JSON library, add

#include <json.hpp>

to your code and add

-I/usr/local/homebrew/Cellar/nlohmann_json/1.1.0/include

to your compiler flags.

Tests

With brew test nlohmann_json you can check if the formula is working properly. Note the formula needs to be installed before it can be tested.

Update formula

export VERSION=3.7.2
export URL=https://github.com/nlohmann/json/archive/v$VERSION.tar.gz
wget $URL
export SHA=$(shasum -a 256 v$VERSION.tar.gz | awk '{ print $1 }')
rm v$VERSION.tar.gz
echo "class NlohmannJson < Formula" > nlohmann_json.rb.tmp
echo "  desc \"JSON for Modern C++\"" >> nlohmann_json.rb.tmp
echo "  homepage \"https://github.com/nlohmann/json\"" >> nlohmann_json.rb.tmp
echo "  url \"$URL\"" >> nlohmann_json.rb.tmp
echo "  sha256 \"$SHA\"" >> nlohmann_json.rb.tmp
tail -n+6 nlohmann_json.rb >> nlohmann_json.rb.tmp
mv nlohmann_json.rb.tmp nlohmann_json.rb
git add nlohmann_json.rb
git commit -m "v$VERSION"
git push