Skip to content

Commit 60b95d2

Browse files
authored
Merge branch 'master' into patch-1
2 parents 7f92bca + 6e96cfb commit 60b95d2

File tree

10 files changed

+135
-28
lines changed

10 files changed

+135
-28
lines changed

.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Checks: '*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-modernize-use-trailing-return-type,-llvm-*'
3-
WarningsAsErrors: '1'
3+
WarningsAsErrors: '*'
44
HeaderFilterRegex: ''
55
FormatStyle: none
66

.github/workflows/build_cmake.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CMake
2+
3+
on: [push]
4+
5+
env:
6+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
7+
BUILD_TYPE: RelWithDebInfo
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Create Build Environment
21+
# Some projects don't allow in-source building, so create a separate build directory
22+
# We'll use this as our working directory for all subsequent commands
23+
run: cmake -E make_directory ${{runner.workspace}}/build
24+
25+
- name: Install conan
26+
shell: bash
27+
run: |
28+
python3 -m pip install --upgrade pip setuptools
29+
python3 -m pip install conan
30+
source ~/.profile
31+
32+
- name: Configure CMake
33+
# Use a bash shell so we can use the same syntax for environment variable
34+
# access regardless of the host operating system
35+
shell: bash
36+
working-directory: ${{runner.workspace}}/build
37+
# Note the current convention is to use the -S and -B options here to specify source
38+
# and build directories, but this is only available with CMake 3.13 and higher.
39+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
40+
#
41+
# We need to source the profile file to make sure conan is in PATH
42+
run: |
43+
source ~/.profile
44+
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
45+
46+
- name: Build
47+
working-directory: ${{runner.workspace}}/build
48+
shell: bash
49+
# Execute the build. You can specify a specific target with "--target <NAME>"
50+
run: cmake --build . --config $BUILD_TYPE
51+
52+
- name: Test
53+
working-directory: ${{runner.workspace}}/build
54+
shell: bash
55+
# Execute tests defined by the CMake configuration.
56+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
57+
run: ctest -C $BUILD_TYPE

.travis.yml

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,59 @@
1-
dist: bionic
2-
sudo: false
31
language: cpp
42

5-
addons:
6-
apt:
7-
sources:
8-
- ubuntu-toolchain-r-test
9-
packages:
10-
- gcc-snapshot
11-
- doxygen
12-
133
install:
144
- pip install --user conan cmake
155

6+
jobs:
7+
include:
8+
- os: osx
9+
compiler: gcc
10+
osx_image: xcode11.2 # includes gcc-9 by default
11+
env:
12+
# Conan is at: ${HOME}/Library/Python/2.7/bin: we need this in the path
13+
- PATH="${HOME}/Library/Python/2.7/bin:${PATH}"
14+
- GCC_VER="9"
15+
- MATRIX_EVAL="CC=gcc-${GCC_VER} && CXX=g++-${GCC_VER}"
16+
after_script:
17+
- bash <(curl -s https://codecov.io/bash) -x /usr/bin/gcov-${GCC_VER}
18+
- os: osx
19+
compiler: clang
20+
osx_image: xcode11.2
21+
env:
22+
- PATH="${HOME}/Library/Python/2.7/bin:${PATH}"
23+
- MATRIX_EVAL=""
24+
- os: linux
25+
dist: bionic
26+
compiler: gcc
27+
env:
28+
- GCC_VER="9"
29+
- MATRIX_EVAL="CC=gcc-${GCC_VER} && CXX=g++-${GCC_VER}"
30+
31+
addons:
32+
apt:
33+
sources:
34+
- ubuntu-toolchain-r-test
35+
packages:
36+
# I couldn't get ${GCC_VER} in here successfully
37+
- gcc-9
38+
- g++-9
39+
- doxygen
40+
after_script:
41+
- bash <(curl -s https://codecov.io/bash) -x /usr/bin/gcov-${GCC_VER}
42+
- os: linux
43+
dist: bionic
44+
compiler: clang
45+
env:
46+
- MATRIX_EVAL="CC=clang && CXX=clang++"
47+
addons: { apt: { packages: ['doxygen'] } }
48+
49+
50+
before_script:
51+
- eval "${MATRIX_EVAL}"
1652

1753
script:
18-
- CXX=/usr/bin/gcc-10 CC=/usr/bin/g++-10 cmake -D ENABLE_COVERAGE:BOOL=TRUE .
19-
- cmake --build . -- -j2
54+
- cmake -D ENABLE_COVERAGE:BOOL=TRUE .
55+
- cmake --build . -- -j2
2056
- ctest -j2
21-
- bash <(curl -s https://codecov.io/bash) -x /usr/bin/gcov-5
2257

2358

2459

appveyor.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
image:
2-
- Visual Studio 2017
2+
- Visual Studio 2019
33
clone_folder: c:\projects\source
44
build_script:
55
- cmd: >-
66
mkdir build
77
88
cd build
9-
10-
cmake c:\projects\source -G "Visual Studio 15"
11-
12-
cmake --build . --config "Debug"
9+
10+
pip install --user conan
11+
12+
set PATH=%PATH%;C:\Users\appveyor\AppData\Roaming\Python\Scripts
13+
14+
cmake c:\projects\source -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE:STRING=Release
15+
16+
cmake --build . --config "Release"
1317
1418
test_script:
1519
- cmd: ctest -C Debug

cmake/CompilerWarnings.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function(set_project_warnings project_name)
88

99
set(MSVC_WARNINGS
1010
/W4 # Baseline reasonable warnings
11-
/w14242 # 'identfier': conversion from 'type1' to 'type1', possible loss
11+
/w14242 # 'identifier': conversion from 'type1' to 'type1', possible loss
1212
# of data
1313
/w14254 # 'operator': conversion from 'type1:field_bits' to
1414
# 'type2:field_bits', possible loss of data
@@ -37,6 +37,7 @@ function(set_project_warnings project_name)
3737
/w14906 # string literal cast to 'LPWSTR'
3838
/w14928 # illegal copy-initialization; more than one user-defined
3939
# conversion has been implicitly applied
40+
/permissive- # standards conformance mode for MSVC compiler.
4041
)
4142

4243
set(CLANG_WARNINGS
@@ -68,7 +69,7 @@ function(set_project_warnings project_name)
6869

6970
set(GCC_WARNINGS
7071
${CLANG_WARNINGS}
71-
-Wmisleading-indentation # warn if identation implies blocks where blocks
72+
-Wmisleading-indentation # warn if indentation implies blocks where blocks
7273
# do not exist
7374
-Wduplicated-cond # warn if if / else chain has duplicated conditions
7475
-Wduplicated-branches # warn if if / else branches have duplicated code
@@ -79,7 +80,7 @@ function(set_project_warnings project_name)
7980

8081
if(MSVC)
8182
set(PROJECT_WARNINGS ${MSVC_WARNINGS})
82-
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
83+
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
8384
set(PROJECT_WARNINGS ${CLANG_WARNINGS})
8485
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
8586
set(PROJECT_WARNINGS ${GCC_WARNINGS})

cmake/Conan.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ conan_cmake_run(
1818
${CONAN_EXTRA_REQUIRES}
1919
catch2/2.11.0
2020
docopt.cpp/0.6.2
21-
fmt/6.0.0
21+
fmt/6.1.2
2222
spdlog/1.5.0
2323
OPTIONS
2424
${CONAN_EXTRA_OPTIONS}

cmake/Sanitizers.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function(enable_sanitizers project_name)
22

3-
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL
4-
"Clang")
3+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES
4+
".*Clang")
55
option(ENABLE_COVERAGE "Enable coverage reporting for gcc/clang" FALSE)
66

77
if(ENABLE_COVERAGE)

cmake/StandardProjectSettings.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ endif()
2323
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2424

2525
option(ENABLE_IPO
26-
"Enable Iterprocedural Optimization, aka Link Time Optimization (LTO)"
26+
"Enable Interprocedural Optimization, aka Link Time Optimization (LTO)"
2727
OFF)
2828

2929
if(ENABLE_IPO)

cmake/StaticAnalyzers.cmake

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
option(ENABLE_CPPCHECK "Enable static analysis with cppcheck" OFF)
22
option(ENABLE_CLANG_TIDY "Enable static analysis with clang-tidy" OFF)
3+
option(ENABLE_INCLUDE_WHAT_YOU_USE "Enable static analysis with include-what-you-use" OFF)
4+
35
if(ENABLE_CPPCHECK)
46
find_program(CPPCHECK cppcheck)
57
if(CPPCHECK)
@@ -13,10 +15,17 @@ endif()
1315
if(ENABLE_CLANG_TIDY)
1416
find_program(CLANGTIDY clang-tidy)
1517
if(CLANGTIDY)
16-
set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY})
18+
set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY} -extra-arg=-Wno-unknown-warning-option)
1719
else()
1820
message(SEND_ERROR "clang-tidy requested but executable not found")
1921
endif()
2022
endif()
2123

22-
24+
if(ENABLE_INCLUDE_WHAT_YOU_USE)
25+
find_program(INCLUDEWHATYOUUSE include-what-you-use)
26+
if(INCLUDEWHATYOUUSE)
27+
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${INCLUDEWHATYOUUSE})
28+
else()
29+
message(SEND_ERROR "include-what-you-use requested but executable not found")
30+
endif()
31+
endif()

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ endif()
88

99
add_library(catch_main STATIC catch_main.cpp)
1010
target_link_libraries(catch_main PUBLIC CONAN_PKG::catch2)
11+
target_link_libraries(catch_main PRIVATE project_options)
1112

1213
add_executable(tests tests.cpp)
1314
target_link_libraries(tests PRIVATE project_warnings project_options

0 commit comments

Comments
 (0)