Commit Graph

62 Commits

Author SHA1 Message Date
Julien Schueller
bad1100a03 Bump minimum cmake version (#323)
Avoids the annoying warning messages such as:

```
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.
```
and allows to get rid of the policy definition
2026-01-09 14:02:30 +01:00
Neal Gompa (ニール・ゴンパ)
ebb7aeb3ae cmake: Use GNUInstallDirs for install paths and install pc file (#317)
This ensures that the correct include and library directories are used
regardless of operating system target by leveraging the built-in
GNUInstallDirs logic for determining the right directory paths.

This also fixes the path for the CMake config module files to use
the right location for header-only libraries.

A pc(5) file for pkgconfig is now also created and installed.
2025-11-09 11:55:32 +01:00
pantor
5b4d92c473 bump to v.3.5.0 2025-10-18 06:43:15 -07:00
Berscheid
edab682601 Enable clang tidy in CI (#314)
* add clang tidy check

* test

* check

* check

* test

* check

* test

* header filter

* fix header filter

* check

* check

* check

* recheck

* re-check

* undo removing ci
2025-10-18 06:33:11 -07:00
Vladislav Navrocky
384a6bef3f Fix: Remove circular dependencies in headers (#295)
* Remove circular dependencies in headers

* Fix unit test includes and test data directory location
2025-02-11 09:03:42 +01:00
pantor
fddbfce5a3 fix benchmark includes, resolves #286 2024-10-05 10:03:29 +02:00
pantor
8695d7525f include building benchmark in test option 2024-10-05 10:01:11 +02:00
pantor
ee8999c127 fix test include directory, resolves #276 2024-10-05 09:46:42 +02:00
Matheus Werny
92994bec0a clang-tidy applied and CMake installation of the single header added (#287)
* Fixed headers and linter marks applied

Headers were wrong.
Applied some linter suggestions. There are still many left.

* CMake adjusted for single header

CMake can now install the single header.
Removed an unneeded header.

---------

Co-authored-by: Berscheid <1885260+pantor@users.noreply.github.com>
2024-10-05 09:36:11 +02:00
Bren
fe58260752 Set CMake policy 0077 for easy inclusion from other CMake prjs (#262)
Co-authored-by: Bren de Hartog <bren.github@dehartog.name>
2023-09-03 16:11:47 +02:00
Martin Hierholzer
9e92a7c0fa fix: cmake does not find embedded json (#266) 2023-04-06 09:16:29 +02:00
pantor
b2276440be bump to v3.4.0 2023-01-29 13:10:03 +01:00
pantor
59933e5e6f update dependencies 2022-06-20 10:39:56 +02:00
Alexander Kraus
4566a20f9a Fixed exports for submodule builds with external nlohmann json parser. (#237) 2022-05-17 08:21:29 +02:00
pantor
d38c07ec5b clang 5 minimum 2021-11-10 12:35:03 +01:00
pantor
a067a8b06e make all tests C++17 2021-11-10 12:28:06 +01:00
pantor
098de66b4e inja_test C++17 2021-11-10 12:24:24 +01:00
pantor
173c1f5f7d fix C++17 2021-11-10 12:17:26 +01:00
pantor
9cf7db8a06 add warnings for benchmark, fix for inja_throw 2021-06-17 20:03:40 +02:00
pantor
8d65633b6a add warnings for clang and fix them 2021-06-17 19:48:28 +02:00
pantor
389c1d64f0 short circuit evaluation 2021-05-17 19:57:33 +02:00
Matus Novak
a57b745e5b Do not install nlohmann json if it is not embedded (#177) 2020-11-25 12:12:54 +01:00
pantor
94d1f76357 update install path of nlohmann/json 2020-08-04 22:50:39 +02:00
pantor
889da4da4f add set statements 2020-08-03 21:29:05 +02:00
pantor
5938bc2301 add tests for gcc 4.8, bump to 3.0 2020-07-15 18:34:47 +02:00
pantor
6eb71dd3ea Rewarite core with an AST for statements and RPN for expressions (#149)
* test

* improve ast

* add if statement

* shunting-yard start

* renderer as node visitor

* improve ast

* improve ast further

* first functions

* improve ast v3

* improve ast v4

* fix parser error location

* nested ifs

* fix comma, activate more tests

* fix line statements

* fix some more tests

* fix callbacks without arguments

* add json literal array and object

* use switch in expression

* fix default function

* fix loop data

* improved tests and benchmark

* fix minus numbers

* improve all

* fix warnings, optimizations

* fix callbacks argument order

* dont move loop parent

* a few more test

* fix clang-3

* fix pointers

* clean

* update single include
2020-07-13 15:20:04 +02:00
pantor
cc5cc2875f update single include file 2020-04-19 16:15:51 +02:00
sabelka
7ce19f9b61 Parser error position (#134)
* add function to get position of current token

* new exception parser_error with error location

* parser throws parser_error with error location

* update single include

* get error position in text

* bump to 2.3

* subclass exceptions

* update single include from every directory

* center badges in readme

* github ci windows, mac

* use default compiler

* check ci

* fix ci

* test ci

* fix ci

* fix ci

* test ci

* badges to github action

* add check for single include

* fix check

* check (should fail)

* fix all ci

* add artifact in single include ci

* update to newest nlohmann/json

* move unit tests to doctest

* move to json v3.6.1

* add function to get position of current token

* new exception parser_error with error location

* parser throws parser_error with error location

* update single include

* get error position in text

* bump to 2.3

* subclass exceptions

Co-authored-by: pantor <lars.berscheid@online.de>
2020-03-21 14:56:21 +01:00
Chuan Ji
cb0b852e23 Add CMake flag to control Inja's unit tests. (#135)
Currently Inja's CMake config will build unit tests as long as `BUILD_TESTING` is enabled. As a result, when including Inja in another CMake project, it is not possible to build the latter's unit tests without also enabling Inja's own unit tests.

It's common for libraries to include a separate option for controlling its own unit test targets, in addition to observing the global `BUILD_TESTING` option. For instance, nlohmann/json has a `JSON_BuildTests` option: 973c52dd4a/CMakeLists.txt (L18)

Also see https://cliutils.gitlab.io/modern-cmake/chapters/testing.html .

This commit adds a `INJA_BUILD_TESTS` flag to address this.
2020-03-14 18:55:51 +01:00
pantor
652e378dd9 Merge branch 'master' of https://github.com/pantor/inja 2019-12-27 11:37:01 +01:00
pantor
aad2cc4358 to v2.2 2019-12-27 11:36:57 +01:00
Krzysztof Bieleń
c36cbac39d Fix Visual Studio Debug builds (#125) 2019-12-03 22:23:00 +01:00
Krzysztof Bieleń
77062f52c7 Fix Travis build (Debug -> Release) (#124) 2019-11-13 18:06:37 +01:00
Tom
419c93c840 Throw exception if a file cannot be opened, fix travis-ci builds (#117)
* throw exception if a file cannot be opened

* Add a new function in utils.hpp: open_file_or_throw: This function
  returns an opened std::ifstream or throws by calling `inja_throw`.
* Use this function in Parser::load_file which previously returned an
  empty string if the file couldn't be opened.
* Use this function in Environment::load_json which previously threw
  a `nlohmann::detail::parse_error` if the file couldn't be opened.
* In Parser::parse_statement: When including files through `include`,
  do not attempt to (re-)parse templates from files that were already
  included. Additionally, this prevents inja from attempting to load
  in-memory templates by their name from disk.
* Add tests that check if an exception is thrown when attempting to
  open files that do not exist.

* cmake: enable C++11

* cmake: require C++11 when depending on single_inja

* code style
2019-09-08 15:05:01 +02:00
JD
dfc87ef7a4 update the version of nlohmann/json in requirements.txt (#107)
* update the version of json in requirements.txt

* removed C++ 17 requirement
2019-05-31 19:01:50 +02:00
pantor
bf071019b9 if target nlohmann_json already exists in cmake, use that library 2019-04-07 13:59:23 +02:00
Paul Fultz II
4c0ee3a46c Improve support for installing with cget (#88)
* Improve support for installing with cget

* add specific version, clean cmake

* fix version to "v2.1.0"
2019-02-16 12:39:59 +01:00
Mark Hollomon
89652ca321 Add meson target to update single include (#86)
- You can now update the single include file in a meson build by using
the target 'amalg'.
- The meson build also now builds the single include test suite.
- cmake build updated to use the new script to update the single
include.
2019-01-28 19:29:21 +01:00
Guillaume Racicot
11d07f5eff Added install target and cmake package exports (#83) 2019-01-26 21:15:25 +01:00
pantor
5d99c2b703 ignore most warnings in appveyor 2019-01-21 19:01:23 +01:00
pantor
699c207c8c Inja v2 (#67)
* inja2

* header only

* reduce dependencies

* code cleaning

* c++17

* use stdc++

* code cleaning

* infrastructure

* header only

* add infrastructure

* fix tests

* use minimum clang 6

* code cleaning, polyfill for c++11

* fix some file tests

* fix readme

* update appveyor

* fix polyfill and ci

* fix polyfill

* fix ci?

* test msvc __cplusplus

* add doxygen

* activate all tests

* code cleaning

* add coveralls, set default to dot notation

* add html test

* add doxygen comments

* test single_include file

* change build folder in appveyor

* correct make arguments in appveyor

* fix appveyor arguments
2018-12-23 16:13:15 +01:00
pantor
d90f93fda0 optional benchmark 2018-12-14 19:31:40 +01:00
pantor
595076ebec split dev files and amalgamate into a single header 2018-12-14 18:03:45 +01:00
pantor
d6cfbd0f07 undo cmake version 2018-08-29 19:40:50 +02:00
pantor
a496ec9585 update to json 3.2 and catch 2.3, clean cmake 2018-08-29 19:31:37 +02:00
pantor
e38df0931f Fix line statements 2018-03-19 12:20:12 +01:00
pantor
bd4c56bf67 set inja release version to 1.0.0 2018-02-23 12:51:52 +01:00
pantor
ded361c2a2 fix gcc bugs 2017-12-02 11:29:11 +01:00
lbersch
ba60c91e4d Merge branch 'hunter' into master 2017-11-16 12:57:56 +01:00
Jorrit Wronski
a5f7f9d0f8 Added a message for MSCV < 2015 2017-11-16 00:01:20 +01:00