Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

Commit

Permalink
add v3.1.0 support
Browse files Browse the repository at this point in the history
* multi-header installation is now the default
* Install inside include/nlohmann
* Add sha256 verification
  • Loading branch information
theodelrieu committed Feb 5, 2018
1 parent 82800a4 commit 983f85c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
22 changes: 8 additions & 14 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
from conans import ConanFile, tools
from conans.tools import download
import os


class JsonForModernCppConan(ConanFile):
name = "jsonformoderncpp"
version = "3.1.0"
homepage = "https://github.com/nlohmann/json"
description = "JSON for Modern C++ parser and generator from https://github.com/nlohmann/json"
license = "MIT"
url = "https://github.com/vthiery/conan-jsonformoderncpp"
repo_url = "https://github.com/nlohmann/json"
author = "Vincent Thiery (vjmthiery@gmail.com)"

def source(self):
download("https://github.com/nlohmann/json/releases/download/v%s/json.hpp" % self.version, "json.hpp")
tools.download("%s/blob/v%s/LICENSE.MIT" % (self.repo_url, self.version), "LICENSE.MIT")

def build(self):
# as there is no LICENSE file, lets extract and generate it.
# It is useful for package consumers, so they can collect all license from all dependencies
tmp = tools.load("json.hpp")
license_contents = tmp[2:tmp.find("*/", 1)]
tools.save("LICENSE", license_contents)
expected_hash = "2b7234fca394d1e27b7e017117ed80b7518fafbb4f4c13a7c069624f6f924673"
tools.get("%s/releases/download/v%s/include.zip" % (self.repo_url, self.version), sha256=expected_hash)

def package(self):
self.copy("*.hpp", dst="include")
self.copy("LICENSE")
self.copy("*.hpp")
self.copy("LICENSE.MIT")

def package_info(self):
self.cpp_info.libdirs = []
self.cpp_info.bindirs = []
5 changes: 3 additions & 2 deletions test_package/example.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "json.hpp"
#include <iostream>

#include <nlohmann/json.hpp>

using nlohmann::json;

int main()
Expand All @@ -13,4 +14,4 @@ int main()
{
std::cout << it.key() << " " << it.value() << std::endl;
}
}
}

0 comments on commit 983f85c

Please sign in to comment.