Skip to content

Commit 547b041

Browse files
authored
Vcpkg integration (#19)
* Updated project dependencies based on vcpkg * Minor improvements in the implementation * Updated CI configuration * Updated README * Added check to silence warning for tests * Updated build configuration for Windows * In an attempt to fix the failing test linkage on AppVeyor for MSVC, I migrated all tests to Catch2 * Update CI configurations to use Catch2 instead of GTest * Removed skyr/expected.hpp header * Updated configuration for dependencies for tests, using vcpkg
1 parent 7c822cb commit 547b041

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2544
-21680
lines changed

.appveyor.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
1-
os:
2-
- Visual Studio 2017
1+
image:
2+
- Visual Studio 2017
3+
# - Visual Studio 2019
4+
5+
platform:
6+
- x64
7+
8+
configuration:
9+
- Debug
10+
- Release
11+
12+
install:
13+
- cd C:\Tools\vcpkg
14+
- git pull
15+
- .\bootstrap-vcpkg.bat
16+
- vcpkg install tl-expected catch2 nlohmann-json
17+
- vcpkg integrate install
18+
- cd %APPVEYOR_BUILD_FOLDER%
319

420
build_script:
5-
- git submodule init
6-
- git submodule update
7-
- mkdir build
8-
- cd build
9-
- cmake ..
10-
- cmake --build .
11-
- ctest
21+
- git submodule init
22+
- git submodule update
23+
- mkdir build
24+
- cd build
25+
- cmake .. -DCMAKE_TOOLCHAIN_FILE=C:\Tools\vcpkg\scripts\buildsystems\vcpkg.cmake
26+
- cmake --build .
27+
- ctest
28+
29+
cache: c:\Tools\vcpkg\installed\
30+
31+
matrix:
32+
fast_finish: true

.circleci/config.yml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ jobs:
77
steps:
88
- run:
99
name: Installing Dependencies
10-
command: 'apt-get update && apt-get install -y sudo git wget ninja-build && rm -rf /var/lib/apt/lists/*'
10+
command: |
11+
apt-get update
12+
apt-get install -y sudo git wget ninja-build curl unzip tar
13+
rm -rf /var/lib/apt/lists/*
14+
echo 'export CMAKE_BUILD_PARALLEL_LEVEL=4' >> $BASH_ENV
1115
- run:
1216
name: Installing GCC
1317
command: |
@@ -18,19 +22,39 @@ jobs:
1822
name: Install CMAKE
1923
command: |
2024
cd /tmp
21-
wget "https://github.com/Kitware/CMake/releases/download/v3.13.3/cmake-3.13.3-Linux-x86_64.tar.gz"
22-
tar -xzf cmake-3.13.3-Linux-x86_64.tar.gz
23-
echo 'export PATH="/tmp/cmake-3.13.3-Linux-x86_64/bin:$PATH"' >> $BASH_ENV
24-
- checkout
25+
wget "https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2-Linux-x86_64.tar.gz"
26+
tar -xzf cmake-3.15.2-Linux-x86_64.tar.gz
27+
echo 'export PATH="/tmp/cmake-3.15.2-Linux-x86_64/bin:$PATH"' >> $BASH_ENV
2528
- run:
26-
name: Updating Submodules
27-
command: 'git submodule init && git submodule update'
29+
name: Installing VCPKG
30+
command: |
31+
cd /tmp
32+
mkdir -p vcpkg
33+
pushd vcpkg
34+
git init
35+
git remote add origin https://github.com/Microsoft/vcpkg.git
36+
git fetch origin master
37+
git checkout -b master origin/master
38+
./bootstrap-vcpkg.sh
39+
./vcpkg install tl-expected catch2 nlohmann-json
40+
popd
41+
- checkout
2842
- run:
2943
name: Creating Build Files
30-
command: 'cmake -GNinja -H. -Bbuild'
44+
command: |
45+
mkdir _build
46+
pushd _build
47+
cmake -G Ninja -DSkyr_BUILD_TESTS=ON -DSkyr_BUILD_DOCS=OFF -DSkyr_BUILD_EXAMPLES=OFF -DCMAKE_TOOLCHAIN_FILE=/tmp/vcpkg/scripts/buildsystems/vcpkg.cmake ..
48+
popd
3149
- run:
3250
name: Creating Binary Files
33-
command: 'cmake --build build'
51+
command: |
52+
pushd _build
53+
ninja
54+
popd
3455
- run:
3556
name: Running All Unit Tests
36-
command: 'cd build && ctest'
57+
command: |
58+
pushd _build
59+
ctest
60+
popd

.clang-format

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
BasedOnStyle: Google
22
AccessModifierOffset: -1
33
ConstructorInitializerIndentWidth: 4
4-
AlignEscapedNewlinesLeft: true
54
AlignTrailingComments: true
65
AllowAllParametersOfDeclarationOnNextLine: true
7-
AllowShortIfStatementsOnASingleLine: true
6+
AllowShortIfStatementsOnASingleLine: WithoutElse
87
AllowShortLoopsOnASingleLine: true
9-
AlwaysBreakTemplateDeclarations: true
8+
AlwaysBreakTemplateDeclarations: Yes
109
AlwaysBreakBeforeMultilineStrings: true
11-
BreakBeforeBinaryOperators: false
10+
BreakBeforeBinaryOperators: None
1211
BreakConstructorInitializersBeforeComma: false
1312
BinPackParameters: true
1413
ColumnLimit: 80
1514
ConstructorInitializerAllOnOneLineOrOnePerLine: true
16-
DerivePointerBinding: true
1715
ExperimentalAutoDetectBinPacking: false
1816
IndentCaseLabels: true
1917
MaxEmptyLinesToKeep: 1
@@ -23,16 +21,14 @@ PenaltyBreakString: 1000
2321
PenaltyBreakFirstLessLess: 120
2422
PenaltyExcessCharacter: 1000000
2523
PenaltyReturnTypeOnItsOwnLine: 200
26-
PointerBindsToType: true
2724
SpacesBeforeTrailingComments: 2
2825
Cpp11BracedListStyle: true
2926
Standard: Auto
3027
IndentWidth: 2
3128
TabWidth: 4
32-
UseTab: false
29+
UseTab: Never
3330
BreakBeforeBraces: Attach
34-
IndentFunctionDeclarationAfterType: true
3531
SpacesInParentheses: false
3632
SpaceInEmptyParentheses: false
3733
SpacesInCStyleCastParentheses: false
38-
SpaceAfterControlStatementKeyword: true
34+

.gitmodules

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

.travis.yml

Lines changed: 67 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,74 +4,99 @@ language:
44
- cpp
55

66
dist:
7-
- trusty
7+
- xenial
88

9-
#env:
10-
# - BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release"
11-
# - BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release"
12-
# - BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug"
13-
# - BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug"
14-
15-
#before_install:
16-
# - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
17-
# - sudo apt-get update -qq
9+
env:
10+
global: DEPS_DIR="${TRAVIS_BUILD_DIR}/deps_"
1811

1912
matrix:
2013
include:
21-
# # 1/ Linux Clang Builds
22-
# - os: linux
23-
# compiler: clang
24-
# addons: &clang60
25-
# apt:
26-
# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-6.0']
27-
# packages: ['clang-6.0', 'libc++-6-dev']
28-
# env: COMPILER='clang++-6.0'
29-
3014
# 2/ Linux GCC Builds
3115
- os: linux
32-
compiler: gcc
16+
compiler: gcc-7
3317
addons: &gcc7
3418
apt:
3519
sources: ['ubuntu-toolchain-r-test']
3620
packages: ['g++-7']
37-
env: [COMPILER='g++-7', BUILD_FILESYSTEM_PATH_FUNCTION='OFF']
21+
env: [COMPILER='g++-7', VCPKG_TRIPLET='x64-linux']
3822

3923
- os: linux
40-
compiler: gcc
24+
compiler: gcc-8
4125
addons: &gcc8
4226
apt:
4327
sources: ['ubuntu-toolchain-r-test']
4428
packages: ['g++-8']
45-
env: [COMPILER='g++-8', BUILD_FILESYSTEM_PATH_FUNCTION='ON']
29+
env: [COMPILER='g++-8', VCPKG_TRIPLET='x64-linux']
30+
31+
- os: linux
32+
compiler: gcc-9
33+
addons: &gcc9
34+
apt:
35+
sources: ['ubuntu-toolchain-r-test']
36+
packages: ['g++-9']
37+
env: [COMPILER='g++-9', VCPKG_TRIPLET='x64-linux']
4638

47-
# 3/ OSX Clang Builds
48-
- os: osx
49-
osx_image: xcode10
50-
compiler: clang
51-
env: [BUILD_FILESYSTEM_PATH_FUNCTION='OFF']
39+
# # 3/ OSX Clang Builds
40+
# - os: osx
41+
# osx_image: xcode10
42+
# compiler: clang
43+
# env: [COMPILER='clang', VCPKG_TRIPLET='x64-osx']
44+
45+
before_install:
46+
- mkdir -p ${DEPS_DIR}
47+
- pushd ${DEPS_DIR}
48+
- echo ${TRAVIS_OS_NAME}
49+
- |
50+
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
51+
CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2-Linux-x86_64.tar.gz"
52+
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
53+
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
54+
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
55+
which cmake || brew install cmake
56+
fi
57+
- popd
58+
- |
59+
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
60+
brew install gcc
61+
brew upgrade gcc
62+
export CXX=`which g++`
63+
else
64+
export CXX=${COMPILER}
65+
fi
66+
- echo ${CXX}
67+
- ${CXX} --version
5268

5369
install:
54-
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps_"
55-
- mkdir ${DEPS_DIR} && cd ${DEPS_DIR}
56-
- |
57-
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
58-
CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v3.13.3/cmake-3.13.3-Linux-x86_64.tar.gz"
59-
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
60-
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
61-
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
62-
which cmake || brew install cmake
63-
fi
64-
- cd ${TRAVIS_BUILD_DIR}
70+
- mkdir -p ${DEPS_DIR}/vcpkg
71+
- pushd ${DEPS_DIR}/vcpkg
72+
- git init
73+
- git remote add origin https://github.com/Microsoft/vcpkg.git
74+
- git fetch origin master
75+
- git checkout -b master origin/master
76+
- ${CXX} --version
77+
- export
78+
- ./bootstrap-vcpkg.sh
79+
- ./vcpkg install tl-expected catch2 nlohmann-json
80+
- popd
81+
82+
cache:
83+
directories:
84+
- ${DEPS_DIR}/vcpkg/installed
6585

6686
before_script:
67-
export CXX=${COMPILER}
87+
- export CXX=${COMPILER}
6888

6989
script:
7090
- mkdir _build
71-
- cd _build
72-
- cmake -DSkyr_BUILD_TESTS=ON -DSkyr_BUILD_DOCS=OFF -DSkyr_BUILD_EXAMPLES=OFF -DSkyr_BUILD_FILESYSTEM_PATH_FUNCTIONS=$BUILD_FILESYSTEM_PATH_FUNCTIONS ..
91+
- pushd _build
92+
- cmake -DSkyr_BUILD_TESTS=ON
93+
-DSkyr_BUILD_DOCS=OFF
94+
-DSkyr_BUILD_EXAMPLES=OFF
95+
-DCMAKE_TOOLCHAIN_FILE=${DEPS_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake
96+
..
7397
- make -j 8
7498
- make test
99+
- popd
75100

76101
after_failure:
77102
- cat Testing/Temporary/LastTest.log

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7-
## [1,2] - 2019-08-16
7+
## [1.2] - 2019-08-16
88

99
### Added
1010
- Changed CMake scripts to make the library usable by downstream

CMakeLists.txt

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) Glyn Matthews 2012-2018.
1+
# Copyright (c) Glyn Matthews 2012-2019.
22
# Distributed under the Boost Software License, Version 1.0.
33
# (See accompanying file LICENSE_1_0.txt or copy at
44
# http://www.boost.org/LICENSE_1_0.txt)
@@ -13,15 +13,15 @@ option(Skyr_BUILD_EXAMPLES "Build the URL examples." OFF)
1313
option(Skyr_FULL_WARNINGS "Build the library with all warnings turned on." ON)
1414
option(Skyr_WARNINGS_AS_ERRORS "Treat warnings as errors." ON)
1515
option(Skyr_USE_STATIC_CRT "Use static C Runtime library (/MT or MTd)." ON)
16-
option(Skyr_BUILD_FILESYSTEM_PATH_FUNCTIONS "Build the filesystem path functions" ON)
17-
18-
find_package(Threads REQUIRED)
16+
option(Skyr_BUILD_FILESYSTEM_PATH_FUNCTIONS "Build the filesystem path functions" OFF)
1917

2018
set(CMAKE_VERBOSE_MAKEFILE true)
19+
set(CMAKE_CXX_STANDARD 17)
2120

22-
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
23-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
21+
find_package(Threads REQUIRED)
22+
find_package(tl-expected CONFIG REQUIRED)
2423

24+
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
2525
if (Skyr_FULL_WARNINGS)
2626
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
2727
endif()
@@ -32,7 +32,6 @@ if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
3232

3333
message("C++ Flags: ${CMAKE_CXX_FLAGS} link flags: ${CMAKE_CXX_LINK_FLAGS}")
3434
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
35-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
3635
if (NOT Skyr_DISABLE_LIBCXX)
3736
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
3837
endif()
@@ -51,7 +50,7 @@ endif()
5150

5251
if (MSVC)
5352
if(DEFINED MSVC_VERSION AND MSVC_VERSION LESS 1900)
54-
message(FATAL_ERROR "Requires VS 2015 or later")
53+
message(FATAL_ERROR "Requires VS 2017 or later")
5554
endif()
5655

5756
if (Skyr_USE_STATIC_CRT)
@@ -76,11 +75,6 @@ add_subdirectory(src)
7675
if (Skyr_BUILD_TESTS)
7776
message(STATUS "Configuring tests")
7877
enable_testing()
79-
set(BUILD_GMOCK OFF)
80-
set(BUILD_GTEST ON)
81-
set(INSTALL_GMOCK OFF)
82-
set(INSTALL_GTEST OFF)
83-
add_subdirectory(deps/googletest)
8478
add_subdirectory(tests)
8579
endif()
8680

0 commit comments

Comments
 (0)