Merge pull request #48 from pantor/include-json-in-inja

This commit is contained in:
pantor
2018-05-15 21:55:14 +02:00
committed by GitHub
11 changed files with 14 additions and 20 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

@@ -1,9 +1,7 @@
project('inja', 'cpp', default_options : ['cpp_std=c++11'])
inja_inc = include_directories('src')
inja_dep = declare_dependency(
include_directories : inja_inc
include_directories : include_directories('src')
)
subdir('test')

View File

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

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"