From 2909c26a553f532dd8fcf723af0859d48bae1c63 Mon Sep 17 00:00:00 2001 From: Benzakhar Manashirov Date: Wed, 27 Jun 2018 11:39:04 -0400 Subject: [PATCH 1/5] cocoapods integration --- cocoapods/NJSHeaderOnly.mm | 7 ++ cocoapods/NSJHeaderOnlyObjc.m | 5 ++ nlohmann_json.podspec | 117 ++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 cocoapods/NJSHeaderOnly.mm create mode 100644 cocoapods/NSJHeaderOnlyObjc.m create mode 100644 nlohmann_json.podspec diff --git a/cocoapods/NJSHeaderOnly.mm b/cocoapods/NJSHeaderOnly.mm new file mode 100644 index 000000000..b92186050 --- /dev/null +++ b/cocoapods/NJSHeaderOnly.mm @@ -0,0 +1,7 @@ +// We need this file to please cocoapods as cocoapods +// doesn't support pure C++ libraries. We need mm so +// cocoapods enables Objective-C++ + +int NJSHeaderOnly() { + return 42; +} \ No newline at end of file diff --git a/cocoapods/NSJHeaderOnlyObjc.m b/cocoapods/NSJHeaderOnlyObjc.m new file mode 100644 index 000000000..391624f06 --- /dev/null +++ b/cocoapods/NSJHeaderOnlyObjc.m @@ -0,0 +1,5 @@ +// cocoapods is weird we also need this. + +int NSJHeaderOnlyObjc() { + return 42; +} \ No newline at end of file diff --git a/nlohmann_json.podspec b/nlohmann_json.podspec new file mode 100644 index 000000000..b56586a23 --- /dev/null +++ b/nlohmann_json.podspec @@ -0,0 +1,117 @@ +# +# Be sure to run `pod spec lint nlohmann_json.podspec' to ensure this is a +# valid spec and to remove all comments including this before submitting the spec. +# +# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html +# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ +# + +Pod::Spec.new do |s| + + # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # These will help people to find your library, and whilst it + # can feel like a chore to fill in it's definitely to your advantage. The + # summary should be tweet-length, and the description more in depth. + # + + s.name = "nlohmann_json" + s.version = "3.1.2" + s.summary = "JSON reader & writer for C++ optimized for ease of use and modern C++14" + + # This description is used to generate tags and improve search results. + # * Think: What does it do? Why did you write it? What is the focus? + # * Try to keep it short, snappy and to the point. + # * Write the description between the DESC delimiters below. + # * Finally, don't worry about the indent, CocoaPods strips it! + s.description = <<-DESC + JSON library for c++, it can read & write, uses C++14 features to have + modern syntax. + DESC + + s.homepage = "https://github.com/nlohmann/json" + # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" + + + # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # Licensing your code is important. See http://choosealicense.com for more info. + # CocoaPods will detect a license file if there is a named LICENSE* + # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. + # + + #s.license = "MIT (example)" + license_text = File.read("LICENSE.MIT") + # cocoapods checks extension and expects it to be a txt. so instead + # we read the file and pass it in as text. + s.license = { :type => "MIT", :text => license_text } + + + # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # Specify the authors of the library, with email addresses. Email addresses + # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also + # accepts just a name if you'd rather not provide an email address. + # + # Specify a social_media_url where others can refer to, for example a twitter + # profile URL. + # + + + s.authors = { + "Niels Lohmann" => "nosend@respectmyprivacy.com" + } + # s.social_media_url = "http://twitter.com/todo" + + # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # If this Pod runs only on iOS or OS X, then specify the platform and + # the deployment target. You can optionally include the target after the platform. + # + + # s.platform = :ios + s.platform = :ios, "8.0" + + # When using multiple platforms + # s.ios.deployment_target = "5.0" + # s.osx.deployment_target = "10.7" + # s.watchos.deployment_target = "2.0" + # s.tvos.deployment_target = "9.0" + + + # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # Specify the location from where the source should be retrieved. + # Supports git, hg, bzr, svn and HTTP. + # + + s.source = { :git => "https://github.com/nlohmann/json.git", :tag => "v#{s.version}" } + + + # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # CocoaPods is smart about how it includes source code. For source files + # giving a folder will include any swift, h, m, mm, c & cpp files. + # For header files it will include any header in the folder. + # Not including the public_header_files will make all headers public. + # + + s.source_files = "cocoapods/**/*.{h,m,mm}", "single_include/**/*.hpp" + s.exclude_files = "Classes/Exclude" + + s.public_header_files = "single_include/nlohmann/json.hpp" + + + # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # A list of resources included with the Pod. These are copied into the + # target bundle with a build phase script. Anything else will be cleaned. + # You can preserve files from being cleaned, please don't preserve + # non-essential files like tests, examples and documentation. + # + + # s.resource = "icon.png" + # s.resources = "Resources/*.png" + + # s.preserve_paths = "FilesToSave", "MoreFilesToSave" +end From 230a5feab2822064c95bd59e96def49dafc40fd3 Mon Sep 17 00:00:00 2001 From: Benzakhar Manashirov Date: Wed, 27 Jun 2018 13:29:39 -0400 Subject: [PATCH 2/5] dummy files not needed pod spec lint is passing without them --- cocoapods/NJSHeaderOnly.mm | 7 ------- cocoapods/NSJHeaderOnlyObjc.m | 5 ----- nlohmann_json.podspec | 4 +--- 3 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 cocoapods/NJSHeaderOnly.mm delete mode 100644 cocoapods/NSJHeaderOnlyObjc.m diff --git a/cocoapods/NJSHeaderOnly.mm b/cocoapods/NJSHeaderOnly.mm deleted file mode 100644 index b92186050..000000000 --- a/cocoapods/NJSHeaderOnly.mm +++ /dev/null @@ -1,7 +0,0 @@ -// We need this file to please cocoapods as cocoapods -// doesn't support pure C++ libraries. We need mm so -// cocoapods enables Objective-C++ - -int NJSHeaderOnly() { - return 42; -} \ No newline at end of file diff --git a/cocoapods/NSJHeaderOnlyObjc.m b/cocoapods/NSJHeaderOnlyObjc.m deleted file mode 100644 index 391624f06..000000000 --- a/cocoapods/NSJHeaderOnlyObjc.m +++ /dev/null @@ -1,5 +0,0 @@ -// cocoapods is weird we also need this. - -int NSJHeaderOnlyObjc() { - return 42; -} \ No newline at end of file diff --git a/nlohmann_json.podspec b/nlohmann_json.podspec index b56586a23..f0a347540 100644 --- a/nlohmann_json.podspec +++ b/nlohmann_json.podspec @@ -96,9 +96,7 @@ Pod::Spec.new do |s| # Not including the public_header_files will make all headers public. # - s.source_files = "cocoapods/**/*.{h,m,mm}", "single_include/**/*.hpp" - s.exclude_files = "Classes/Exclude" - + s.source_files = "single_include/**/*.hpp" s.public_header_files = "single_include/nlohmann/json.hpp" From 05557cb3be5dfb08246ae11090e11c20e27dd5e4 Mon Sep 17 00:00:00 2001 From: Benzakhar Manashirov Date: Wed, 27 Jun 2018 13:42:39 -0400 Subject: [PATCH 3/5] removed uneccessary comments in nlohmann_json.podspec --- nlohmann_json.podspec | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/nlohmann_json.podspec b/nlohmann_json.podspec index f0a347540..79f81ff9d 100644 --- a/nlohmann_json.podspec +++ b/nlohmann_json.podspec @@ -9,28 +9,19 @@ Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - # - # These will help people to find your library, and whilst it - # can feel like a chore to fill in it's definitely to your advantage. The - # summary should be tweet-length, and the description more in depth. - # - s.name = "nlohmann_json" s.version = "3.1.2" s.summary = "JSON reader & writer for C++ optimized for ease of use and modern C++14" - # This description is used to generate tags and improve search results. - # * Think: What does it do? Why did you write it? What is the focus? - # * Try to keep it short, snappy and to the point. - # * Write the description between the DESC delimiters below. - # * Finally, don't worry about the indent, CocoaPods strips it! + + # CocoaPods strips indentation for description s.description = <<-DESC JSON library for c++, it can read & write, uses C++14 features to have modern syntax. DESC s.homepage = "https://github.com/nlohmann/json" - # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" + s.screenshots = "https://raw.githubusercontent.com/nlohmann/json/master/doc/json.gif" # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # @@ -40,7 +31,6 @@ Pod::Spec.new do |s| # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. # - #s.license = "MIT (example)" license_text = File.read("LICENSE.MIT") # cocoapods checks extension and expects it to be a txt. so instead # we read the file and pass it in as text. @@ -61,7 +51,6 @@ Pod::Spec.new do |s| s.authors = { "Niels Lohmann" => "nosend@respectmyprivacy.com" } - # s.social_media_url = "http://twitter.com/todo" # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # @@ -69,11 +58,10 @@ Pod::Spec.new do |s| # the deployment target. You can optionally include the target after the platform. # - # s.platform = :ios s.platform = :ios, "8.0" # When using multiple platforms - # s.ios.deployment_target = "5.0" + # s.ios.deployment_target = "8.0" # s.osx.deployment_target = "10.7" # s.watchos.deployment_target = "2.0" # s.tvos.deployment_target = "9.0" @@ -98,18 +86,4 @@ Pod::Spec.new do |s| s.source_files = "single_include/**/*.hpp" s.public_header_files = "single_include/nlohmann/json.hpp" - - - # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - # - # A list of resources included with the Pod. These are copied into the - # target bundle with a build phase script. Anything else will be cleaned. - # You can preserve files from being cleaned, please don't preserve - # non-essential files like tests, examples and documentation. - # - - # s.resource = "icon.png" - # s.resources = "Resources/*.png" - - # s.preserve_paths = "FilesToSave", "MoreFilesToSave" end From 5a2349f06ad3ad14e5e0ce6188683f6292065364 Mon Sep 17 00:00:00 2001 From: Benzakhar Manashirov Date: Wed, 27 Jun 2018 14:11:53 -0400 Subject: [PATCH 4/5] added integration note for cocoapods in README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 95a58235c..439d54262 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,8 @@ If you are using [vcpkg](https://github.com/Microsoft/vcpkg/) on your project fo If you are using [cget](http://cget.readthedocs.io/en/latest/), you can install the latest development version with `cget install nlohmann/json`. A specific version can be installed with `cget install nlohmann/json@v3.1.0`. Also, the multiple header version can be installed by adding the `-DJSON_MultipleHeaders=ON` flag (i.e., `cget install nlohmann/json -DJSON_MultipleHeaders=ON`). +If you are using [cocoapods](https://cocoapods.org/), add `pod "nlohmann_json", '~>3.1.2'` to your podfile. + ## Examples Beside the examples below, you may want to check the [documentation](https://nlohmann.github.io/json/) where each function contains a separate code example (e.g., check out [`emplace()`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a5338e282d1d02bed389d852dd670d98d.html#a5338e282d1d02bed389d852dd670d98d)). All [example files](https://github.com/nlohmann/json/tree/develop/doc/examples) can be compiled and executed on their own (e.g., file [emplace.cpp](https://github.com/nlohmann/json/blob/develop/doc/examples/emplace.cpp)). From 0f71e7acfefadf6ce7d4164d2d241da9ff4e5b09 Mon Sep 17 00:00:00 2001 From: Benzakhar Manashirov Date: Thu, 28 Jun 2018 10:25:12 -0400 Subject: [PATCH 5/5] updated podspec description & other parameters, and removed guide comments --- nlohmann_json.podspec | 68 ++++++++++--------------------------------- 1 file changed, 15 insertions(+), 53 deletions(-) diff --git a/nlohmann_json.podspec b/nlohmann_json.podspec index 79f81ff9d..49f9fe041 100644 --- a/nlohmann_json.podspec +++ b/nlohmann_json.podspec @@ -1,89 +1,51 @@ -# -# Be sure to run `pod spec lint nlohmann_json.podspec' to ensure this is a -# valid spec and to remove all comments including this before submitting the spec. -# -# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html -# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ -# +# upgrades how to: +# 1. update s.version +# 2. run `pod spec lint nlohmann_json.podspec` +# 3. register a session with cocoapods +# 4. run `pod trunk push ./` +# see cocoapods documentation http://docs.cocoapods.org/specification.html for +# more details. Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # s.name = "nlohmann_json" s.version = "3.1.2" - s.summary = "JSON reader & writer for C++ optimized for ease of use and modern C++14" + s.summary = "JSON for Modern C++" # CocoaPods strips indentation for description s.description = <<-DESC - JSON library for c++, it can read & write, uses C++14 features to have - modern syntax. + JSON library for modern c++, it can read & write JSON. If you know how to + use std::vector or std::map, you are already set. DESC s.homepage = "https://github.com/nlohmann/json" s.screenshots = "https://raw.githubusercontent.com/nlohmann/json/master/doc/json.gif" - # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - # - # Licensing your code is important. See http://choosealicense.com for more info. - # CocoaPods will detect a license file if there is a named LICENSE* - # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. - # - license_text = File.read("LICENSE.MIT") # cocoapods checks extension and expects it to be a txt. so instead # we read the file and pass it in as text. s.license = { :type => "MIT", :text => license_text } - # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - # - # Specify the authors of the library, with email addresses. Email addresses - # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also - # accepts just a name if you'd rather not provide an email address. - # - # Specify a social_media_url where others can refer to, for example a twitter - # profile URL. - # - - - s.authors = { - "Niels Lohmann" => "nosend@respectmyprivacy.com" + s.authors = { + "Niels Lohmann" => "mail@nlohmann.me" } - # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - # - # If this Pod runs only on iOS or OS X, then specify the platform and - # the deployment target. You can optionally include the target after the platform. - # - s.platform = :ios, "8.0" - # When using multiple platforms + # When using multiple platforms. I haven't tested integration with other + # platforms. Theoretically it should just work without problem. # s.ios.deployment_target = "8.0" # s.osx.deployment_target = "10.7" # s.watchos.deployment_target = "2.0" # s.tvos.deployment_target = "9.0" - # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - # - # Specify the location from where the source should be retrieved. - # Supports git, hg, bzr, svn and HTTP. - # - s.source = { :git => "https://github.com/nlohmann/json.git", :tag => "v#{s.version}" } - - # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - # - # CocoaPods is smart about how it includes source code. For source files - # giving a folder will include any swift, h, m, mm, c & cpp files. - # For header files it will include any header in the folder. - # Not including the public_header_files will make all headers public. - # - - s.source_files = "single_include/**/*.hpp" + s.source_files = "single_include/**/*.hpp" s.public_header_files = "single_include/nlohmann/json.hpp" end