include nlohmann/json in inja directly

This commit is contained in:
pantor
2018-05-15 20:23:09 +02:00
parent 0029a130ab
commit 71cfb21e61
10 changed files with 8 additions and 13 deletions

View File

@@ -22,11 +22,11 @@ inja::render("Hello {{ name }}!", data); // Returns "Hello world!"
## Integration
Inja is a headers only library, which can be downloaded from the [releases](https://github.com/pantor/inja/releases) or directly from the `src/` folder. Inja uses json by nlohmann as its single dependency, so make sure that it is included before inja. json can be found [here](https://github.com/nlohmann/json/releases).
Inja is a headers only library, which can be downloaded from the [releases](https://github.com/pantor/inja/releases) or directly from the `src/` folder. Inja uses `nlohmann/json.hpp` as its single dependency, so make sure it can be included from `inja.hpp`. json can be downloaded [here](https://github.com/nlohmann/json/releases). Then integration is as easy as:
```c++
#include "json.hpp"
#include "inja.hpp"
#include <inja.hpp>
#include <nlohmann/json.hpp>
// For convenience
using namespace inja;

View File

@@ -33,16 +33,12 @@ SOFTWARE.
#define PANTOR_INJA_VERSION_PATCH 1
#ifndef NLOHMANN_JSON_HPP
static_assert(false, "nlohmann/json not found.");
#endif
#include <algorithm>
#include <fstream>
#include <iostream>
#include <locale>
#include <map>
#include <nlohmann/json.hpp>
#include <regex>
#include <string>
#include <sstream>

View File

@@ -4,8 +4,7 @@ unit_test = executable(
'src/unit-files.cpp',
'src/unit-renderer.cpp',
'src/unit-string-helper.cpp',
dependencies: inja_dep,
include_directories: include_directories('thirdparty')
dependencies: inja_dep
)
test('Inja unit test', unit_test)

View File

@@ -1,6 +1,6 @@
#include "catch/catch.hpp"
#include "nlohmann/json.hpp"
#include "inja.hpp"
#include "nlohmann/json.hpp"
using json = nlohmann::json;

View File

@@ -1,6 +1,6 @@
#include "catch/catch.hpp"
#include "nlohmann/json.hpp"
#include "inja.hpp"
#include "nlohmann/json.hpp"

View File

@@ -1,6 +1,6 @@
#include "catch/catch.hpp"
#include "nlohmann/json.hpp"
#include "inja.hpp"
#include "nlohmann/json.hpp"