Loading CMakeLists.txt 0 → 100644 +14 −0 Original line number Diff line number Diff line cmake_minimum_required(VERSION 3.1) project(nlohmann_json LANGUAGES CXX) add_library(nlohmann_json INTERFACE) add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json) target_include_directories(nlohmann_json INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include ) if (${CMAKE_VERSION} VERSION_LESS "3.8.0") target_compile_features(nlohmann_json INTERFACE cxx_range_for) else() target_compile_features(nlohmann_json INTERFACE cxx_std_11) endif() LICENSE.MIT 0 → 100644 +21 −0 Original line number Diff line number Diff line MIT License Copyright (c) 2013-2017 Niels Lohmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. README.md 0 → 100644 +41 −0 Original line number Diff line number Diff line # Release-tracking repository for nlohmann/json This repository is based on: [astoeckel/json](https://github.com/astoeckel/json) The goal is to provide a lightweight repository tracking every releases of [nlohmann/json](https://github.com/nlohmann/json). This repository is compatible with cmake [FetchContent](https://cmake.org/cmake/help/v3.11/module/FetchContent.html). You can depends on nlohmann/json using: **Example**: ~~~cmake include(FetchContent) FetchContent_Declare(json GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohman_json GIT_TAG no-tag-yet) FetchContent_GetProperties(json) if(NOT json_POPULATED) FetchContent_Populate(json) add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL) endif() target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json) ~~~ You can replace always replace the URL by the official repository: https://github.com/nlohmann/json The only difference is the download size. It will several orders of magnitude larger. This repository is fully autonomous. It updates itself every week using github actions. See: - [#2073](https://github.com/nlohmann/json/issues/2073), - [#732](https://github.com/nlohmann/json/issues/732), - [#620](https://github.com/nlohmann/json/issues/620), - [#556](https://github.com/nlohmann/json/issues/556), - [#482](https://github.com/nlohmann/json/issues/482), - [#96](https://github.com/nlohmann/json/issues/96) meson.build 0 → 100644 +7 −0 Original line number Diff line number Diff line project('nlohmann_json', 'cpp') nlohmann_json_inc = include_directories('include') nlohmann_json_dep = declare_dependency( include_directories : nlohmann_json_inc ) update.py 0 → 100755 +64 −0 Original line number Diff line number Diff line #!/usr/bin/env python3 import sys, os import json import subprocess import urllib.request import hashlib # Go to the directory this script is stored in os.chdir(os.path.dirname(os.path.realpath(__file__))) # Download release data releases = json.loads(str(urllib.request.urlopen('https://api.github.com/repos/nlohmann/json/releases').read(), 'utf-8')) # Fetch all releases and the corresponding URL release_url_map = [] for release in releases: for asset in release['assets']: if asset['name'] == 'json.hpp': release_url_map.append((release['tag_name'], asset['browser_download_url'], release['body'])) # List all git tags process = subprocess.Popen(['git', 'tag'], stdout=subprocess.PIPE) tags, _ = process.communicate() tags = set(filter(None, str(tags, 'utf-8').split("\n"))) print("Releases already contained in this repository are " + str(tags)) # Go over the release_url_map in reverse order; if a release is not yet a Git # tag, download the file, commit and add a tag did_update = False for tag, url, body in release_url_map[::-1]: if not tag in tags: print("Downloading release " + tag + " from " + url) os.makedirs('./include', mode=0o777, exist_ok=True) os.makedirs('./include/nlohmann', mode=0o777, exist_ok=True) data = urllib.request.urlopen(url).read(); with open('./include/nlohmann/json.hpp', 'wb') as f: f.write(data) # Try to download the json_fwd.hpp header -- only exists since release # v3.1.0 has_json_fwd = False try: json_fwd_url = 'https://github.com/nlohmann/json/raw/{}/include/nlohmann/json_fwd.hpp'.format(tag); print("Trying to download " + json_fwd_url) data = urllib.request.urlopen(json_fwd_url).read(); with open('./include/nlohmann/json_fwd.hpp', 'wb') as f: f.write(data) has_json_fwd = True except: pass subprocess.call(['git', 'add', './include/nlohmann/json.hpp']) if has_json_fwd: subprocess.call(['git', 'add', './include/nlohmann/json_fwd.hpp']) subprocess.call(['git', 'commit', '-m', 'Upstream release ' + tag]) subprocess.call(['git', 'tag', '-a', tag, '-m', body]) did_update = True # Push the updated Git repository if did_update: subprocess.call(['git', 'push', '--tags']) subprocess.call(['git', 'push']) Loading
CMakeLists.txt 0 → 100644 +14 −0 Original line number Diff line number Diff line cmake_minimum_required(VERSION 3.1) project(nlohmann_json LANGUAGES CXX) add_library(nlohmann_json INTERFACE) add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json) target_include_directories(nlohmann_json INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include ) if (${CMAKE_VERSION} VERSION_LESS "3.8.0") target_compile_features(nlohmann_json INTERFACE cxx_range_for) else() target_compile_features(nlohmann_json INTERFACE cxx_std_11) endif()
LICENSE.MIT 0 → 100644 +21 −0 Original line number Diff line number Diff line MIT License Copyright (c) 2013-2017 Niels Lohmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
README.md 0 → 100644 +41 −0 Original line number Diff line number Diff line # Release-tracking repository for nlohmann/json This repository is based on: [astoeckel/json](https://github.com/astoeckel/json) The goal is to provide a lightweight repository tracking every releases of [nlohmann/json](https://github.com/nlohmann/json). This repository is compatible with cmake [FetchContent](https://cmake.org/cmake/help/v3.11/module/FetchContent.html). You can depends on nlohmann/json using: **Example**: ~~~cmake include(FetchContent) FetchContent_Declare(json GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohman_json GIT_TAG no-tag-yet) FetchContent_GetProperties(json) if(NOT json_POPULATED) FetchContent_Populate(json) add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL) endif() target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json) ~~~ You can replace always replace the URL by the official repository: https://github.com/nlohmann/json The only difference is the download size. It will several orders of magnitude larger. This repository is fully autonomous. It updates itself every week using github actions. See: - [#2073](https://github.com/nlohmann/json/issues/2073), - [#732](https://github.com/nlohmann/json/issues/732), - [#620](https://github.com/nlohmann/json/issues/620), - [#556](https://github.com/nlohmann/json/issues/556), - [#482](https://github.com/nlohmann/json/issues/482), - [#96](https://github.com/nlohmann/json/issues/96)
meson.build 0 → 100644 +7 −0 Original line number Diff line number Diff line project('nlohmann_json', 'cpp') nlohmann_json_inc = include_directories('include') nlohmann_json_dep = declare_dependency( include_directories : nlohmann_json_inc )
update.py 0 → 100755 +64 −0 Original line number Diff line number Diff line #!/usr/bin/env python3 import sys, os import json import subprocess import urllib.request import hashlib # Go to the directory this script is stored in os.chdir(os.path.dirname(os.path.realpath(__file__))) # Download release data releases = json.loads(str(urllib.request.urlopen('https://api.github.com/repos/nlohmann/json/releases').read(), 'utf-8')) # Fetch all releases and the corresponding URL release_url_map = [] for release in releases: for asset in release['assets']: if asset['name'] == 'json.hpp': release_url_map.append((release['tag_name'], asset['browser_download_url'], release['body'])) # List all git tags process = subprocess.Popen(['git', 'tag'], stdout=subprocess.PIPE) tags, _ = process.communicate() tags = set(filter(None, str(tags, 'utf-8').split("\n"))) print("Releases already contained in this repository are " + str(tags)) # Go over the release_url_map in reverse order; if a release is not yet a Git # tag, download the file, commit and add a tag did_update = False for tag, url, body in release_url_map[::-1]: if not tag in tags: print("Downloading release " + tag + " from " + url) os.makedirs('./include', mode=0o777, exist_ok=True) os.makedirs('./include/nlohmann', mode=0o777, exist_ok=True) data = urllib.request.urlopen(url).read(); with open('./include/nlohmann/json.hpp', 'wb') as f: f.write(data) # Try to download the json_fwd.hpp header -- only exists since release # v3.1.0 has_json_fwd = False try: json_fwd_url = 'https://github.com/nlohmann/json/raw/{}/include/nlohmann/json_fwd.hpp'.format(tag); print("Trying to download " + json_fwd_url) data = urllib.request.urlopen(json_fwd_url).read(); with open('./include/nlohmann/json_fwd.hpp', 'wb') as f: f.write(data) has_json_fwd = True except: pass subprocess.call(['git', 'add', './include/nlohmann/json.hpp']) if has_json_fwd: subprocess.call(['git', 'add', './include/nlohmann/json_fwd.hpp']) subprocess.call(['git', 'commit', '-m', 'Upstream release ' + tag]) subprocess.call(['git', 'tag', '-a', tag, '-m', body]) did_update = True # Push the updated Git repository if did_update: subprocess.call(['git', 'push', '--tags']) subprocess.call(['git', 'push'])