FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Groundwork in CMake, build workflows, and header include cleanup by wravery · Pull Request #312 · microsoft/cppgraphqlgen · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cpp  (1) .h  (18) .txt  (23) .yml  (3) No extension  (1) dotfile  (1) All 6 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
13 changes: 8 additions & 5 deletions .github/workflows/linux.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Linux
on: [push, pull_request]

jobs:
gcc10:
gcc14:
strategy:
fail-fast: false
matrix:
config: [Debug, Release]

runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4.1.3
Expand All @@ -19,7 +19,10 @@ jobs:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -yq libgtest-dev libboost-program-options-dev rapidjson-dev ninja-build gcc-10 g++-10
sudo apt-get upgrade
sudo add-apt-repository -y universe
sudo apt-get update
sudo apt-get install -yq libgtest-dev libboost-program-options-dev rapidjson-dev ninja-build gcc-14 g++-14

- name: Build GTest
run: |
Expand All @@ -35,8 +38,8 @@ jobs:
- name: Configure CMake
shell: pwsh
env:
CC: gcc-10
CXX: g++-10
CC: gcc-14
CXX: g++-14
working-directory: build/
run: |
$cmakeBuildType = '${{ matrix.config }}'
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/macos.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,51 @@ jobs:
matrix:
config: [Debug, Release]

runs-on: macos-13
runs-on: macos-latest

steps:
- uses: actions/checkout@v4.1.3
with:
submodules: true
fetch-depth: 0

- uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401

- name: Cache vcpkg
uses: actions/cache@v4.0.2
id: cache-vcpkg
with:
path: build/vcpkg_cache/
key: vcpkg-binaries-x64-osx
key: vcpkg-binaries-osx-${{ hashFiles('vcpkg.json') }}

- name: Create Build Environment
if: ${{ !steps.cache-vcpkg.outputs.cache-hit }}
run: |
cmake -E make_directory build
cmake -E make_directory build/vcpkg_cache

- name: Boostrap vcpkg
shell: pwsh
working-directory: vcpkg/
run: |
./bootstrap-vcpkg.sh
./vcpkg integrate install

- name: Configure
shell: pwsh
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
working-directory: build/
run: |
$vcpkgToolchain = Join-Path $env:VCPKG_INSTALLATION_ROOT './scripts/buildsystems/vcpkg.cmake' -Resolve
$vcpkgToolchain = Join-Path $env:VCPKG_ROOT './scripts/buildsystems/vcpkg.cmake' -Resolve
$cmakeBuildType = '${{ matrix.config }}'

$cachedBinaries = Join-Path $(Get-Location) './vcpkg_cache/' -Resolve
$cacheAccess = $(if ('${{ steps.cache-vcpkg.outputs.cache-hit }}' -eq 'true') { 'read' } else { 'write' })
$env:VCPKG_BINARY_SOURCES = "clear;files,$cachedBinaries,$cacheAccess"

cmake "-DCMAKE_TOOLCHAIN_FILE=$vcpkgToolchain" "-DCMAKE_BUILD_TYPE=$cmakeBuildType" ${{ github.workspace }}
$env:PATH = "${env:PATH}:${{ github.workspace }}/ninja-build"
cmake "-DCMAKE_TOOLCHAIN_FILE=$vcpkgToolchain" "-DCMAKE_BUILD_TYPE=$cmakeBuildType" -G Ninja ${{ github.workspace }}

- name: Build
working-directory: build/
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/windows.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- uses: actions/checkout@v4.1.3
with:
submodules: true
fetch-depth: 0

- name: Set target triplet
id: set-variables
Expand All @@ -28,19 +29,28 @@ jobs:
id: cache-vcpkg
with:
path: build/vcpkg_cache/
key: vcpkg-binaries-${{ steps.set-variables.outputs.vcpkg_triplet }}
key: vcpkg-binaries-${{ steps.set-variables.outputs.vcpkg_triplet }}-${{ hashFiles('vcpkg.json') }}

- name: Create Build Environment
if: ${{ !steps.cache-vcpkg.outputs.cache-hit }}
run: |
cmake -E make_directory build
cmake -E make_directory build/vcpkg_cache

- name: Boostrap vcpkg
shell: pwsh
working-directory: vcpkg/
run: |
./bootstrap-vcpkg.bat
./vcpkg integrate install

- name: Configure
shell: pwsh
env:
VCPKG_ROOT: ${{ github.workspace }}\vcpkg
working-directory: build/
run: |
$vcpkgToolchain = Join-Path $env:VCPKG_INSTALLATION_ROOT '.\scripts\buildsystems\vcpkg.cmake' -Resolve
$vcpkgToolchain = Join-Path $env:VCPKG_ROOT './scripts/buildsystems/vcpkg.cmake' -Resolve
$vcpkgTriplet = '${{ steps.set-variables.outputs.vcpkg_triplet }}'
$cmakeSharedLibs = $(if ('${{ matrix.libs }}' -eq 'shared') { 'ON' } else { 'OFF' })
$msbuildArch = $(if ('${{ matrix.arch }}' -eq 'x64') { 'X64' } else { 'Win32' })
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "PEGTL"]
path = PEGTL
url = https://github.com/taocpp/PEGTL.git
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git
11 changes: 5 additions & 6 deletions CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.28)

# Enable CMAKE_MSVC_RUNTIME_LIBRARY on Windows: https://cmake.org/cmake/help/latest/policy/CMP0091.html
cmake_policy(SET CMP0091 NEW)

# Do not set default MSVC warning flags: https://cmake.org/cmake/help/latest/policy/CMP0092.html
cmake_policy(SET CMP0092 NEW)
if(POLICY CMP0167)
# Prefer the upstream BoostConfig.cmake file instead of the builtin FindBoost module: https://cmake.org/cmake/help/latest/policy/CMP0167.html
cmake_policy(SET CMP0167 NEW)
endif()

# Export compile commands for other tools, e.g. SonarLint.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down
2 changes: 1 addition & 1 deletion cmake/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.28)

# Enable version checks in find_package
include(CMakePackageConfigHelpers)
Expand Down
19 changes: 4 additions & 15 deletions include/graphqlservice/GraphQLClient.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,10 @@
#ifndef GRAPHQLCLIENT_H
#define GRAPHQLCLIENT_H

// clang-format off
#ifdef GRAPHQL_DLLEXPORTS
#ifdef IMPL_GRAPHQLCLIENT_DLL
#define GRAPHQLCLIENT_EXPORT __declspec(dllexport)
#else // !IMPL_GRAPHQLCLIENT_DLL
#define GRAPHQLCLIENT_EXPORT __declspec(dllimport)
#endif // !IMPL_GRAPHQLCLIENT_DLL
#else // !GRAPHQL_DLLEXPORTS
#define GRAPHQLCLIENT_EXPORT
#endif // !GRAPHQL_DLLEXPORTS
// clang-format on

#include "graphqlservice/GraphQLResponse.h"

#include "graphqlservice/internal/Version.h"
#include "GraphQLResponse.h"

#include "internal/Version.h"
#include "internal/DllExports.h"

#include <algorithm>
#include <iterator>
Expand Down
12 changes: 1 addition & 11 deletions include/graphqlservice/GraphQLParse.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@
#ifndef GRAPHQLPARSE_H
#define GRAPHQLPARSE_H

// clang-format off
#ifdef GRAPHQL_DLLEXPORTS
#ifdef IMPL_GRAPHQLPEG_DLL
#define GRAPHQLPEG_EXPORT __declspec(dllexport)
#else // !IMPL_GRAPHQLPEG_DLL
#define GRAPHQLPEG_EXPORT __declspec(dllimport)
#endif // !IMPL_GRAPHQLPEG_DLL
#else // !GRAPHQL_DLLEXPORTS
#define GRAPHQLPEG_EXPORT
#endif // !GRAPHQL_DLLEXPORTS
// clang-format on
#include "internal/DllExports.h"

#include <memory>
#include <string_view>
Expand Down
15 changes: 2 additions & 13 deletions include/graphqlservice/GraphQLResponse.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,8 @@
#ifndef GRAPHQLRESPONSE_H
#define GRAPHQLRESPONSE_H

// clang-format off
#ifdef GRAPHQL_DLLEXPORTS
#ifdef IMPL_GRAPHQLRESPONSE_DLL
#define GRAPHQLRESPONSE_EXPORT __declspec(dllexport)
#else // !IMPL_GRAPHQLRESPONSE_DLL
#define GRAPHQLRESPONSE_EXPORT __declspec(dllimport)
#endif // !IMPL_GRAPHQLRESPONSE_DLL
#else // !GRAPHQL_DLLEXPORTS
#define GRAPHQLRESPONSE_EXPORT
#endif // !GRAPHQL_DLLEXPORTS
// clang-format on

#include "graphqlservice/internal/Awaitable.h"
#include "internal/Awaitable.h"
#include "internal/DllExports.h"

#include <cstdint>
#include <initializer_list>
Expand Down
25 changes: 7 additions & 18 deletions include/graphqlservice/GraphQLService.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,13 @@
#ifndef GRAPHQLSERVICE_H
#define GRAPHQLSERVICE_H

// clang-format off
#ifdef GRAPHQL_DLLEXPORTS
#ifdef IMPL_GRAPHQLSERVICE_DLL
#define GRAPHQLSERVICE_EXPORT __declspec(dllexport)
#else // !IMPL_GRAPHQLSERVICE_DLL
#define GRAPHQLSERVICE_EXPORT __declspec(dllimport)
#endif // !IMPL_GRAPHQLSERVICE_DLL
#else // !GRAPHQL_DLLEXPORTS
#define GRAPHQLSERVICE_EXPORT
#endif // !GRAPHQL_DLLEXPORTS
// clang-format on

#include "graphqlservice/GraphQLParse.h"
#include "graphqlservice/GraphQLResponse.h"

#include "graphqlservice/internal/Awaitable.h"
#include "graphqlservice/internal/SortedMap.h"
#include "graphqlservice/internal/Version.h"
#include "GraphQLParse.h"
#include "GraphQLResponse.h"

#include "internal/Awaitable.h"
#include "internal/DllExports.h"
#include "internal/SortedMap.h"
#include "internal/Version.h"

#include <chrono>
#include <condition_variable>
Expand Down
16 changes: 3 additions & 13 deletions include/graphqlservice/JSONResponse.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,9 @@
#ifndef JSONRESPONSE_H
#define JSONRESPONSE_H

// clang-format off
#ifdef GRAPHQL_DLLEXPORTS
#ifdef IMPL_JSONRESPONSE_DLL
#define JSONRESPONSE_EXPORT __declspec(dllexport)
#else // !IMPL_JSONRESPONSE_DLL
#define JSONRESPONSE_EXPORT __declspec(dllimport)
#endif // !IMPL_JSONRESPONSE_DLL
#else // !GRAPHQL_DLLEXPORTS
#define JSONRESPONSE_EXPORT
#endif // !GRAPHQL_DLLEXPORTS
// clang-format on

#include "graphqlservice/GraphQLResponse.h"
#include "GraphQLResponse.h"

#include "internal/DllExports.h"

namespace graphql::response {

Expand Down
12 changes: 1 addition & 11 deletions include/graphqlservice/internal/Base64.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@
#ifndef GRAPHQLBASE64_H
#define GRAPHQLBASE64_H

// clang-format off
#ifdef GRAPHQL_DLLEXPORTS
#ifdef IMPL_GRAPHQLRESPONSE_DLL
#define GRAPHQLRESPONSE_EXPORT __declspec(dllexport)
#else // !IMPL_GRAPHQLRESPONSE_DLL
#define GRAPHQLRESPONSE_EXPORT __declspec(dllimport)
#endif // !IMPL_GRAPHQLRESPONSE_DLL
#else // !GRAPHQL_DLLEXPORTS
#define GRAPHQLRESPONSE_EXPORT
#endif // !GRAPHQL_DLLEXPORTS
// clang-format on
#include "DllExports.h"

#include <cstdint>
#include <string>
Expand Down
49 changes: 49 additions & 0 deletions include/graphqlservice/internal/DllExports.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#pragma once

#ifndef DLLEXPORTS_H
#define DLLEXPORTS_H

// clang-format off
#ifdef GRAPHQL_DLLEXPORTS
#ifdef IMPL_GRAPHQLCLIENT_DLL
#define GRAPHQLCLIENT_EXPORT __declspec(dllexport)
#else // !IMPL_GRAPHQLCLIENT_DLL
#define GRAPHQLCLIENT_EXPORT __declspec(dllimport)
#endif // !IMPL_GRAPHQLCLIENT_DLL

#ifdef IMPL_GRAPHQLPEG_DLL
#define GRAPHQLPEG_EXPORT __declspec(dllexport)
#else // !IMPL_GRAPHQLPEG_DLL
#define GRAPHQLPEG_EXPORT __declspec(dllimport)
#endif // !IMPL_GRAPHQLPEG_DLL

#ifdef IMPL_GRAPHQLRESPONSE_DLL
#define GRAPHQLRESPONSE_EXPORT __declspec(dllexport)
#else // !IMPL_GRAPHQLRESPONSE_DLL
#define GRAPHQLRESPONSE_EXPORT __declspec(dllimport)
#endif // !IMPL_GRAPHQLRESPONSE_DLL

#ifdef IMPL_GRAPHQLSERVICE_DLL
#define GRAPHQLSERVICE_EXPORT __declspec(dllexport)
#else // !IMPL_GRAPHQLSERVICE_DLL
#define GRAPHQLSERVICE_EXPORT __declspec(dllimport)
#endif // !IMPL_GRAPHQLSERVICE_DLL

#ifdef IMPL_JSONRESPONSE_DLL
#define JSONRESPONSE_EXPORT __declspec(dllexport)
#else // !IMPL_JSONRESPONSE_DLL
#define JSONRESPONSE_EXPORT __declspec(dllimport)
#endif // !IMPL_JSONRESPONSE_DLL
#else // !GRAPHQL_DLLEXPORTS
#define GRAPHQLCLIENT_EXPORT
#define GRAPHQLPEG_EXPORT
#define GRAPHQLRESPONSE_EXPORT
#define GRAPHQLSERVICE_EXPORT
#define JSONRESPONSE_EXPORT
#endif // !GRAPHQL_DLLEXPORTS
// clang-format on

#endif // DLLEXPORTS_H
2 changes: 1 addition & 1 deletion include/graphqlservice/internal/Grammar.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef GRAPHQLGRAMMAR_H
#define GRAPHQLGRAMMAR_H

#include "graphqlservice/internal/SyntaxTree.h"
#include "SyntaxTree.h"

#include <functional>

Expand Down
3 changes: 2 additions & 1 deletion include/graphqlservice/internal/Introspection.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

#include "graphqlservice/introspection/IntrospectionSchema.h"

#include "graphqlservice/internal/Schema.h"
#include "DllExports.h"
#include "Schema.h"

namespace graphql::introspection {

Expand Down
8 changes: 7 additions & 1 deletion include/graphqlservice/internal/Schema.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
#ifndef GRAPHQLSCHEMA_H
#define GRAPHQLSCHEMA_H

#include "graphqlservice/GraphQLService.h"
#include "DllExports.h"
#include "SortedMap.h"
#include "Version.h"

#include <memory>
#include <optional>
#include <shared_mutex>
#include <string_view>
#include <vector>

namespace graphql {
namespace introspection {
Expand Down
Loading

Back | FazBrowse Home | New Git URL