diff --git a/.gitignore b/.gitignore index 259148f..03cb7bf 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,10 @@ *.exe *.out *.app + +# Build Folders +build +dist + +# Coveralls repo token +.coveralls.yml \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..fa7015e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +######################### +# project configuration # +######################### + +language: cpp + +# dist: trusty + +compiler: + - gcc +before_install: + - pip install --user cpp-coveralls +script: + - mkdir -p build && cd build + - cmake .. && cmake --build . --config Release -- -j4 + - ctest -C Release -V + - cd .. +# - ./configure --enable-gcov && make && make check +#after_success: +# - coveralls --exclude lib --exclude tests --gcov-options '\-lp' \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6aff159 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.1) + +## +## PROJECT +## name and version +## +project(inja) + +## +## OPTIONS +## +option(BUILD_UNIT_TESTS "Build the unit tests" ON) + +## +## CONFIGURATION +## +set(CMAKE_CXX_STANDARD 14) +set(INJA_SOURCE_DIR src/) +set(INJA_HEADER_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dist) + +## +## TESTS +## create and configure the unit test target +## +if(BUILD_UNIT_TESTS) + enable_testing() + # include_directories(${NLOHMANN_JSON_SOURCE_DIR}) + add_subdirectory(test) +endif() + +## +## INSTALL +## install header files, generate and install cmake config files for find_package() +## +install( + DIRECTORY ${INJA_SOURCE_DIR} + DESTINATION ${INJA_HEADER_INSTALL_DIR} +) diff --git a/README.md b/README.md index 7ac3a85..70ed4e5 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,7 @@ A Template Engine for Modern C++ +[![Build Status](https://travis-ci.org/pantor/inja.svg?branch=master)](https://travis-ci.org/pantor/inja) +[![Coverage Status](https://img.shields.io/coveralls/pantor/inja.svg)](https://coveralls.io/r/pantor/inja) [![Github Issues](https://img.shields.io/github/issues/pantor/inja.svg)](http://github.com/pantor/inja/issues) [![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/pantor/inja/master/LICENSE.MIT) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..1c85a5f --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,13 @@ +# Prepare "Catch" library for other executables +set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty) +add_library(Catch INTERFACE) +target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) + +set(UNITTEST_TARGET_NAME "inja_unit") +set(TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/test.cpp) +add_executable(${UNITTEST_TARGET_NAME} ${TEST_SOURCES}) +target_link_libraries(${UNITTEST_TARGET_NAME} Catch) + +add_test(NAME "${UNITTEST_TARGET_NAME}_default" + COMMAND ${UNITTEST_TARGET_NAME} +) \ No newline at end of file diff --git a/test/src/test b/test/src/test deleted file mode 100755 index edd1af8..0000000 Binary files a/test/src/test and /dev/null differ