Added CMake and TravisCI

This commit is contained in:
pantor
2017-08-14 08:12:39 +02:00
parent bd46aa2e99
commit 8fe73eabc8
6 changed files with 80 additions and 0 deletions

7
.gitignore vendored
View File

@@ -30,3 +30,10 @@
*.exe
*.out
*.app
# Build Folders
build
dist
# Coveralls repo token
.coveralls.yml

20
.travis.yml Normal file
View File

@@ -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'

38
CMakeLists.txt Normal file
View File

@@ -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}
)

View File

@@ -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)

13
test/CMakeLists.txt Normal file
View File

@@ -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}
)

Binary file not shown.