Skip to content

Commit adf9564

Browse files
Initial commit
0 parents commit adf9564

24 files changed

+3501
-0
lines changed

.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
33+
*.x
34+
35+
# Build directory
36+
build/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "external/doctest"]
2+
path = external/doctest
3+
url = https://github.com/onqtam/doctest.git

.travis.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
language: cpp
2+
dist: xenial
3+
notifications:
4+
email: false
5+
6+
# Define builds on mulitple OS/compiler combinations.
7+
# Feel free to add/remove entries from this list.
8+
matrix:
9+
include:
10+
- os: linux
11+
addons:
12+
apt:
13+
sources:
14+
- ubuntu-toolchain-r-test
15+
packages:
16+
- lcov
17+
- g++-7
18+
env:
19+
- MATRIX_EVAL="CXX_COMPILER=g++-7; sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-7 90"
20+
21+
- os: osx
22+
osx_image: xcode10.1
23+
addons:
24+
homebrew:
25+
packages:
26+
- lcov
27+
env:
28+
- MATRIX_EVAL="CXX_COMPILER=clang++"
29+
30+
31+
before_install:
32+
- eval "${MATRIX_EVAL}"
33+
- PARENTDIR=$(pwd)
34+
- mkdir $PARENTDIR/build
35+
36+
install:
37+
- cd $PARENTDIR/build
38+
- cmake $PARENTDIR -DCMAKE_BUILD_TYPE=Coverage -DCMAKE_CXX_COMPILER=$CXX_COMPILER
39+
- make
40+
41+
script:
42+
- make coverage
43+
44+
after_success:
45+
- cd $PARENTDIR/build
46+
- lcov --list coverage_out.info.cleaned # Show test report in travis log.
47+
# Install coverals gem for uploading coverage to coveralls.
48+
- gem install coveralls-lcov
49+
- coveralls-lcov coverage_out.info.cleaned # uploads to coveralls
50+
- bash <(curl -s https://codecov.io/bash) -f coverage_out.info.cleaned || echo "Codecov did not collect coverage reports"

CMakeLists.txt

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# This file specifies how the project should be built, using CMake.
2+
# If you are unfamiliar with CMake, don't worry about all the details.
3+
# The sections you might want to edit are marked as such, and
4+
# the comments should hopefully make most of it clear.
5+
#
6+
# For many purposes, you may not need to change anything about this file.
7+
8+
cmake_minimum_required(VERSION 3.8.2)
9+
10+
# Set project name, version and laguages here. (change as needed)
11+
# Version numbers are available by including "exampleConfig.h" in
12+
# the source. See exampleConfig.h.in for some more details.
13+
project(CPP_BOILERPLATE VERSION 1.2.3.4 LANGUAGES CXX)
14+
15+
16+
# Options: Things you can set via commandline options to cmake (e.g. -DENABLE_LTO=[ON|OFF])
17+
option(ENABLE_WARNINGS_SETTINGS "Allow target_set_warnings to add flags and defines.
18+
Set this to OFF if you want to provide your own warning parameters." ON)
19+
option(ENABLE_LTO "Enable link time optimization" ON)
20+
option(ENABLE_DOCTESTS "Include tests in the library. Setting this to OFF will remove all doctest related code.
21+
Tests in tests/*.cpp will still be enabled." ON)
22+
23+
# Include stuff. No change needed.
24+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
25+
include(ConfigSafeGuards)
26+
include(Colors)
27+
include(CTest)
28+
include(Doctest)
29+
include(Documentation)
30+
include(LTO)
31+
include(Misc)
32+
include(Warnings)
33+
34+
# Check for LTO support.
35+
find_lto(CXX)
36+
37+
# --------------------------------------------------------------------------------
38+
# Locate files (change as needed).
39+
# --------------------------------------------------------------------------------
40+
set(SOURCES # All .cpp files in src/
41+
src/example.cpp
42+
)
43+
set(TESTFILES # All .cpp files in tests/
44+
tests/main.cpp
45+
)
46+
set(LIBRARY_NAME engine) # Default name for the library built from src/*.cpp (change if you wish)
47+
48+
# --------------------------------------------------------------------------------
49+
# Build! (Change as needed)
50+
# --------------------------------------------------------------------------------
51+
# Compile all sources into a library.
52+
add_library(${LIBRARY_NAME} OBJECT ${SOURCES})
53+
54+
# Lib needs its header files, and users of the library must also see these (PUBLIC). (No change needed)
55+
target_include_directories(${LIBRARY_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include)
56+
57+
# There's also (probably) doctests within the library, so we need to see this as well.
58+
target_link_libraries(${LIBRARY_NAME} PUBLIC doctest)
59+
60+
# Set the compile options you want (change as needed).
61+
target_set_warnings(${LIBRARY_NAME} ENABLE ALL AS_ERROR ALL DISABLE Annoying)
62+
# target_compile_options(${LIBRARY_NAME} ... ) # For setting manually.
63+
64+
# Add an executable for the file app/main.cpp.
65+
# If you add more executables, copy these lines accordingly.
66+
add_executable(main app/main.cpp) # Name of exec. and location of file.
67+
target_link_libraries(main PRIVATE ${LIBRARY_NAME}) # Link the executable to library (if it uses it).
68+
target_set_warnings(main ENABLE ALL AS_ERROR ALL DISABLE Annoying) # Set warnings (if needed).
69+
target_enable_lto(main optimized) # enable link-time-optimization if available for non-debug configurations
70+
71+
# Set the properties you require, e.g. what C++ standard to use. Here applied to library and main (change as needed).
72+
set_target_properties(
73+
${LIBRARY_NAME} main
74+
PROPERTIES
75+
CXX_STANDARD 17
76+
CXX_STANDARD_REQUIRED YES
77+
CXX_EXTENSIONS NO
78+
)
79+
80+
# Set up tests (see tests/CMakeLists.txt).
81+
add_subdirectory(tests)

0 commit comments

Comments
 (0)