Skip to content

Commit e9c7081

Browse files
authored
Merge pull request #312 from wravery/next
Groundwork in CMake, build workflows, and header include cleanup
2 parents 681b0e1 + 7dc77fa commit e9c7081

Some content is hidden

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

47 files changed

+172
-126
lines changed

.github/workflows/linux.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Linux
33
on: [push, pull_request]
44

55
jobs:
6-
gcc10:
6+
gcc14:
77
strategy:
88
fail-fast: false
99
matrix:
1010
config: [Debug, Release]
1111

12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-24.04
1313

1414
steps:
1515
- uses: actions/checkout@v4.1.3
@@ -19,7 +19,10 @@ jobs:
1919
- name: Install Dependencies
2020
run: |
2121
sudo apt-get update
22-
sudo apt-get install -yq libgtest-dev libboost-program-options-dev rapidjson-dev ninja-build gcc-10 g++-10
22+
sudo apt-get upgrade
23+
sudo add-apt-repository -y universe
24+
sudo apt-get update
25+
sudo apt-get install -yq libgtest-dev libboost-program-options-dev rapidjson-dev ninja-build gcc-14 g++-14
2326
2427
- name: Build GTest
2528
run: |
@@ -35,8 +38,8 @@ jobs:
3538
- name: Configure CMake
3639
shell: pwsh
3740
env:
38-
CC: gcc-10
39-
CXX: g++-10
41+
CC: gcc-14
42+
CXX: g++-14
4043
working-directory: build/
4144
run: |
4245
$cmakeBuildType = '${{ matrix.config }}'

.github/workflows/macos.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,51 @@ jobs:
99
matrix:
1010
config: [Debug, Release]
1111

12-
runs-on: macos-13
12+
runs-on: macos-latest
1313

1414
steps:
1515
- uses: actions/checkout@v4.1.3
1616
with:
1717
submodules: true
18+
fetch-depth: 0
19+
20+
- uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401
1821

1922
- name: Cache vcpkg
2023
uses: actions/cache@v4.0.2
2124
id: cache-vcpkg
2225
with:
2326
path: build/vcpkg_cache/
24-
key: vcpkg-binaries-x64-osx
27+
key: vcpkg-binaries-osx-${{ hashFiles('vcpkg.json') }}
2528

2629
- name: Create Build Environment
2730
if: ${{ !steps.cache-vcpkg.outputs.cache-hit }}
2831
run: |
2932
cmake -E make_directory build
3033
cmake -E make_directory build/vcpkg_cache
3134
35+
- name: Boostrap vcpkg
36+
shell: pwsh
37+
working-directory: vcpkg/
38+
run: |
39+
./bootstrap-vcpkg.sh
40+
./vcpkg integrate install
41+
3242
- name: Configure
3343
shell: pwsh
44+
env:
45+
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
3446
working-directory: build/
3547
run: |
36-
$vcpkgToolchain = Join-Path $env:VCPKG_INSTALLATION_ROOT './scripts/buildsystems/vcpkg.cmake' -Resolve
48+
$vcpkgToolchain = Join-Path $env:VCPKG_ROOT './scripts/buildsystems/vcpkg.cmake' -Resolve
3749
$cmakeBuildType = '${{ matrix.config }}'
3850
3951
$cachedBinaries = Join-Path $(Get-Location) './vcpkg_cache/' -Resolve
4052
$cacheAccess = $(if ('${{ steps.cache-vcpkg.outputs.cache-hit }}' -eq 'true') { 'read' } else { 'write' })
4153
$env:VCPKG_BINARY_SOURCES = "clear;files,$cachedBinaries,$cacheAccess"
4254
43-
cmake "-DCMAKE_TOOLCHAIN_FILE=$vcpkgToolchain" "-DCMAKE_BUILD_TYPE=$cmakeBuildType" ${{ github.workspace }}
55+
$env:PATH = "${env:PATH}:${{ github.workspace }}/ninja-build"
56+
cmake "-DCMAKE_TOOLCHAIN_FILE=$vcpkgToolchain" "-DCMAKE_BUILD_TYPE=$cmakeBuildType" -G Ninja ${{ github.workspace }}
4457
4558
- name: Build
4659
working-directory: build/

.github/workflows/windows.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- uses: actions/checkout@v4.1.3
1818
with:
1919
submodules: true
20+
fetch-depth: 0
2021

2122
- name: Set target triplet
2223
id: set-variables
@@ -28,19 +29,28 @@ jobs:
2829
id: cache-vcpkg
2930
with:
3031
path: build/vcpkg_cache/
31-
key: vcpkg-binaries-${{ steps.set-variables.outputs.vcpkg_triplet }}
32+
key: vcpkg-binaries-${{ steps.set-variables.outputs.vcpkg_triplet }}-${{ hashFiles('vcpkg.json') }}
3233

3334
- name: Create Build Environment
3435
if: ${{ !steps.cache-vcpkg.outputs.cache-hit }}
3536
run: |
3637
cmake -E make_directory build
3738
cmake -E make_directory build/vcpkg_cache
3839
40+
- name: Boostrap vcpkg
41+
shell: pwsh
42+
working-directory: vcpkg/
43+
run: |
44+
./bootstrap-vcpkg.bat
45+
./vcpkg integrate install
46+
3947
- name: Configure
4048
shell: pwsh
49+
env:
50+
VCPKG_ROOT: ${{ github.workspace }}\vcpkg
4151
working-directory: build/
4252
run: |
43-
$vcpkgToolchain = Join-Path $env:VCPKG_INSTALLATION_ROOT '.\scripts\buildsystems\vcpkg.cmake' -Resolve
53+
$vcpkgToolchain = Join-Path $env:VCPKG_ROOT './scripts/buildsystems/vcpkg.cmake' -Resolve
4454
$vcpkgTriplet = '${{ steps.set-variables.outputs.vcpkg_triplet }}'
4555
$cmakeSharedLibs = $(if ('${{ matrix.libs }}' -eq 'shared') { 'ON' } else { 'OFF' })
4656
$msbuildArch = $(if ('${{ matrix.arch }}' -eq 'x64') { 'X64' } else { 'Win32' })

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "PEGTL"]
22
path = PEGTL
33
url = https://github.com/taocpp/PEGTL.git
4+
[submodule "vcpkg"]
5+
path = vcpkg
6+
url = https://github.com/microsoft/vcpkg.git

CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required(VERSION 3.15)
4+
cmake_minimum_required(VERSION 3.28)
55

6-
# Enable CMAKE_MSVC_RUNTIME_LIBRARY on Windows: https://cmake.org/cmake/help/latest/policy/CMP0091.html
7-
cmake_policy(SET CMP0091 NEW)
8-
9-
# Do not set default MSVC warning flags: https://cmake.org/cmake/help/latest/policy/CMP0092.html
10-
cmake_policy(SET CMP0092 NEW)
6+
if(POLICY CMP0167)
7+
# Prefer the upstream BoostConfig.cmake file instead of the builtin FindBoost module: https://cmake.org/cmake/help/latest/policy/CMP0167.html
8+
cmake_policy(SET CMP0167 NEW)
9+
endif()
1110

1211
# Export compile commands for other tools, e.g. SonarLint.
1312
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required(VERSION 3.15)
4+
cmake_minimum_required(VERSION 3.28)
55

66
# Enable version checks in find_package
77
include(CMakePackageConfigHelpers)

include/graphqlservice/GraphQLClient.h

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,10 @@
66
#ifndef GRAPHQLCLIENT_H
77
#define GRAPHQLCLIENT_H
88

9-
// clang-format off
10-
#ifdef GRAPHQL_DLLEXPORTS
11-
#ifdef IMPL_GRAPHQLCLIENT_DLL
12-
#define GRAPHQLCLIENT_EXPORT __declspec(dllexport)
13-
#else // !IMPL_GRAPHQLCLIENT_DLL
14-
#define GRAPHQLCLIENT_EXPORT __declspec(dllimport)
15-
#endif // !IMPL_GRAPHQLCLIENT_DLL
16-
#else // !GRAPHQL_DLLEXPORTS
17-
#define GRAPHQLCLIENT_EXPORT
18-
#endif // !GRAPHQL_DLLEXPORTS
19-
// clang-format on
20-
21-
#include "graphqlservice/GraphQLResponse.h"
22-
23-
#include "graphqlservice/internal/Version.h"
9+
#include "GraphQLResponse.h"
10+
11+
#include "internal/Version.h"
12+
#include "internal/DllExports.h"
2413

2514
#include <algorithm>
2615
#include <iterator>

include/graphqlservice/GraphQLParse.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,7 @@
66
#ifndef GRAPHQLPARSE_H
77
#define GRAPHQLPARSE_H
88

9-
// clang-format off
10-
#ifdef GRAPHQL_DLLEXPORTS
11-
#ifdef IMPL_GRAPHQLPEG_DLL
12-
#define GRAPHQLPEG_EXPORT __declspec(dllexport)
13-
#else // !IMPL_GRAPHQLPEG_DLL
14-
#define GRAPHQLPEG_EXPORT __declspec(dllimport)
15-
#endif // !IMPL_GRAPHQLPEG_DLL
16-
#else // !GRAPHQL_DLLEXPORTS
17-
#define GRAPHQLPEG_EXPORT
18-
#endif // !GRAPHQL_DLLEXPORTS
19-
// clang-format on
9+
#include "internal/DllExports.h"
2010

2111
#include <memory>
2212
#include <string_view>

include/graphqlservice/GraphQLResponse.h

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,8 @@
66
#ifndef GRAPHQLRESPONSE_H
77
#define GRAPHQLRESPONSE_H
88

9-
// clang-format off
10-
#ifdef GRAPHQL_DLLEXPORTS
11-
#ifdef IMPL_GRAPHQLRESPONSE_DLL
12-
#define GRAPHQLRESPONSE_EXPORT __declspec(dllexport)
13-
#else // !IMPL_GRAPHQLRESPONSE_DLL
14-
#define GRAPHQLRESPONSE_EXPORT __declspec(dllimport)
15-
#endif // !IMPL_GRAPHQLRESPONSE_DLL
16-
#else // !GRAPHQL_DLLEXPORTS
17-
#define GRAPHQLRESPONSE_EXPORT
18-
#endif // !GRAPHQL_DLLEXPORTS
19-
// clang-format on
20-
21-
#include "graphqlservice/internal/Awaitable.h"
9+
#include "internal/Awaitable.h"
10+
#include "internal/DllExports.h"
2211

2312
#include <cstdint>
2413
#include <initializer_list>

include/graphqlservice/GraphQLService.h

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,13 @@
66
#ifndef GRAPHQLSERVICE_H
77
#define GRAPHQLSERVICE_H
88

9-
// clang-format off
10-
#ifdef GRAPHQL_DLLEXPORTS
11-
#ifdef IMPL_GRAPHQLSERVICE_DLL
12-
#define GRAPHQLSERVICE_EXPORT __declspec(dllexport)
13-
#else // !IMPL_GRAPHQLSERVICE_DLL
14-
#define GRAPHQLSERVICE_EXPORT __declspec(dllimport)
15-
#endif // !IMPL_GRAPHQLSERVICE_DLL
16-
#else // !GRAPHQL_DLLEXPORTS
17-
#define GRAPHQLSERVICE_EXPORT
18-
#endif // !GRAPHQL_DLLEXPORTS
19-
// clang-format on
20-
21-
#include "graphqlservice/GraphQLParse.h"
22-
#include "graphqlservice/GraphQLResponse.h"
23-
24-
#include "graphqlservice/internal/Awaitable.h"
25-
#include "graphqlservice/internal/SortedMap.h"
26-
#include "graphqlservice/internal/Version.h"
9+
#include "GraphQLParse.h"
10+
#include "GraphQLResponse.h"
11+
12+
#include "internal/Awaitable.h"
13+
#include "internal/DllExports.h"
14+
#include "internal/SortedMap.h"
15+
#include "internal/Version.h"
2716

2817
#include <chrono>
2918
#include <condition_variable>

0 commit comments

Comments
 (0)