Skip to content

Commit d1e1225

Browse files
committed
chore(doc): update README
1 parent 98d1229 commit d1e1225

File tree

1 file changed

+39
-25
lines changed

1 file changed

+39
-25
lines changed

README.md

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,15 @@ service with `Node`, `Electron`, or `Tauri`. PRs with links to your own samples
7070
## Installation process
7171

7272
The minimum OS and toolchain versions I've tested with this version of `cppgraphqlgen` are:
73-
- Microsoft Windows: Visual Studio 2019
74-
- Linux: Ubuntu 20.04 LTS with gcc 10.3.0
75-
- macOS: 11 (Big Sur) with AppleClang 13.0.0.
73+
- Microsoft Windows: Visual Studio 2022
74+
- Linux: Ubuntu 24.04 LTS with gcc 14.2.0 and clang 18.1.3
75+
- macOS: 14.7 with AppleClang 15.0.0.
7676

77-
The key compiler requirement is support for C++20 including coroutines and concepts. Some of these compiler
78-
versions still treat coroutine support as experimental, and the CMake configuration can auto-detect that,
79-
but earlier versions of gcc and clang do not seem to have enough support for C++20.
77+
The key compiler requirement is support for C++20 including coroutines and concepts. There's also optional support
78+
for C++20 module (see the `GRAPHQL_BUILD_MODULES` configuration option for more details). Some of these compilers
79+
versions crash with an ICE (Internal Compiler Error) if you try to build the C++20 interface modules, so your mileage
80+
may vary. As of this writing, the Visual Studio 2022 compiler (MSVC 19.41.34123.0) on Windows and the clang 18.1.3
81+
compiler on Linux are both able to build them, gcc 14.2.0 and AppleClang 15.0.0 fail.
8082

8183
The easiest way to build and install `cppgraphqlgen` is to use [microsoft/vcpkg](https://github.com/microsoft/vcpkg).
8284
See the [Getting Started](https://github.com/microsoft/vcpkg#getting-started) section of the `vcpkg` README
@@ -88,12 +90,16 @@ package (and its dependencies) are advertised to the `CMake` `find_package` func
8890
this in the `vcpkg` documentation.
8991

9092
If you want to build `cppgraphqlgen` yourself, you can do that with `CMake` from a clone or archive of this repo.
91-
See the [Build and Test](#build-and-test) section below for instructions. You will need to install the dependencies
92-
first where `find_package` can find them. If `vcpkg` works otherwise, you can do that with `vcpkg install pegtl
93-
boost-program-options rapidjson gtest`. Some of these are optional, if for example you do not build the tests. If
94-
`vcpkg` does not work, please see the documentation for each of those dependencies, as well as your
95-
platform/toolchain documentation for perferred installation mechanisms. You may need to build some or all of them
96-
separately from source.
93+
See the [Build and Test](#build-and-test) section below for instructions. If you are using a clone, this repo includes
94+
a couple of (optional) sub-modules that can help, `PEGTL` and `vcpkg`. If you include the `vcpkg` sub-module in your
95+
clone (and run the `vcpkg/bootstrap-vcpkg` script for your platform), the presets in `CMakePresets.json` will
96+
automatically use this and cache the dependencies between builds.
97+
98+
If you already have a separate installation of `vcpkg`, you can install all of the default dependencies with `vcpkg install
99+
pegtl boost-program-options taocpp-json gtest` first. Some of these are optional, if for example you do not build the tests.
100+
If `vcpkg` does not work, please see the documentation for each of those dependencies, as well as your platform/toolchain
101+
documentation for perferred installation mechanisms. You will need to install the dependencies first where `find_package`
102+
can find them. This may require building some or all of them separately from source.
97103

98104
## Software dependencies
99105

@@ -109,21 +115,24 @@ the license text. Please see the license or copyright notice which comes with ea
109115

110116
### graphqlpeg
111117

112-
- GraphQL parsing: [Parsing Expression Grammar Template Library (PEGTL)](https://github.com/taocpp/PEGTL) release 3.2.6,
113-
which is part of [The Art of C++](https://taocpp.github.io/) library collection. I've added this as a sub-module, so you
114-
do not need to install this separately. If you already have 3.2.6 installed where CMake can find it, it will use that
118+
- GraphQL parsing: [Parsing Expression Grammar Template Library (PEGTL)](https://github.com/taocpp/PEGTL) release 3.2.6
119+
or later, which is part of [The Art of C++](https://taocpp.github.io/) library collection. I've added this as a sub-module,
120+
so you do not need to install this separately. If you already have 3.2.6 installed where CMake can find it, it will use that
115121
instead of the sub-module and avoid installing another copy of PEGTL.
116122

117123
### graphqlservice
118124

119125
The core library depends on `graphqlpeg` and it references the PEGTL headers itself at build time. Both of those mean it
120126
depends on PEGTL as well.
121127

122-
### graphqljson (`GRAPHQL_USE_RAPIDJSON=ON`)
128+
### graphqljson
123129

124-
- JSON support: [RapidJSON](https://github.com/Tencent/rapidjson) release 1.1.0. If you don't need JSON support, you can
125-
also avoid installing this dependency. You will need to set `GRAPHQL_USE_RAPIDJSON=OFF` in your CMake configuration to
126-
do that.
130+
If you don't need JSON support, you can also avoid installing either of these dependencies. You will need
131+
to set both `GRAPHQL_USE_TAOCPP_JSON=OFF` and `GRAPHQL_USE_RAPIDJSON=OFF` in your CMake configuration to do that:
132+
- `GRAPHQL_USE_TAOCPP_JSON=ON`: [taoJSON](https://github.com/taocpp/json). This is the default option and dependency
133+
as of `cppgraphqlgen` v5.0 since it aligns with using `PEGTL`.
134+
- `GRAPHQL_USE_RAPIDJSON=ON`: [RapidJSON](https://github.com/Tencent/rapidjson) release 1.1.0. This option and dependency
135+
will be ignored if `GRAPHQL_USE_TAOCPP_JSON` is enabled.
127136

128137
### schemagen
129138

@@ -167,17 +176,18 @@ Usage: clientgen [options] <schema file> <request file> <output filename prefix
167176
Command line options:
168177
--version Print the version number
169178
-? [ --help ] Print the command line options
170-
-v [ --verbose ] Verbose output including generated header names as
179+
-v [ --verbose ] Verbose output including generated header names as
171180
well as sources
172181
-s [ --schema ] arg Schema definition file path
173182
-r [ --request ] arg Request document file path
174-
-o [ --operation ] arg Operation name if the request document contains more
183+
-o [ --operation ] arg Operation name if the request document contains more
175184
than one
176185
-p [ --prefix ] arg Prefix to use for the generated C++ filenames
177186
-n [ --namespace ] arg C++ sub-namespace for the generated types
178187
--source-dir arg Target path for the <prefix>Client.cpp source file
179188
--header-dir arg Target path for the <prefix>Client.h header file
180189
--no-introspection Do not expect support for Introspection
190+
--shared-types Re-use shared types from <prefix>SharedTypes.h
181191
```
182192

183193
This utility should output one header and one source file for each request document. A request document may contain more
@@ -216,9 +226,9 @@ There are several helper functions for `CMake` declared in
216226
other samples sub-directories for examples of how to use them to automatically rerun the code generators and update
217227
the files in your source directory.
218228

219-
### Migrating from v3.x to main
229+
### Migrating from v4.x to main
220230

221-
Please see the [Migration Guide for v4.x](./doc/migration.md) for more details about upgrading to from the `v3.x` branch
231+
Please see the [Migration Guide for v5.x](./doc/migration.md) for more details about upgrading to from the `v4.x` branch
222232
to the `main` branch. Active development takes place almost entirely in `main`.
223233

224234
### Additional Documentation
@@ -233,6 +243,7 @@ There are some more targeted documents in the [doc](./doc) directory:
233243
* [Field Parameters](./doc/fieldparams.md)
234244
* [Directives](./doc/directives.md)
235245
* [Subscriptions](./doc/subscriptions.md)
246+
* [Schema Stitching](./doc/stitching.md)
236247

237248
### Samples
238249

@@ -244,7 +255,8 @@ All of the samples are under [samples](samples/), with nested sub-directories fo
244255
with the `schemagen --no-introspection` parameter. The mock implementation of the service for both schemas is in
245256
[samples/today/TodayMock.h](samples/today/TodayMock.h) and [samples/today/TodayMock.cpp](samples/today/TodayMock.cpp).
246257
It builds an interactive `sample`/`sample_nointrospection` and `benchmark`/`benchmark_nointrospection` target for
247-
each version, and it uses each of them in several unit tests.
258+
each version, and it uses each of them in several unit tests. _Note: The schema and mock implementation libraries
259+
do not depend on `GRAPHQL_BUILD_MODULES=ON`, but the `sample` executable and test dependencies do._
248260
- [samples/client](samples/client/): Several sample queries built with `clientgen` against the
249261
[schema.today.graphql](samples/today/schema.today.graphql) schema shared with [samples/today](samples/today/). It
250262
includes a `client_benchmark` executable for comparison with benchmark executables using the same hardcoded query
@@ -258,6 +270,8 @@ is no implementation of this schema, it relies entirely generated stubs (created
258270
successfully without defining more than placeholder objects fo the Query, Mutation, and Subscription operations in
259271
[samples/validation/ValidationMock.h](samples/validation/ValidationMock.h). It is used to test the validation logic
260272
with every example or counter-example in the spec in [test/ValidationTests.cpp](test/ValidationTests.cpp).
273+
- [samples/stitched](samples/stitched/): Stitches together the schemas in [samples/today](samples/today/) and
274+
[samples/learn](samples/learn/) using the `Request::stitch` method on each of the mock service implementations.
261275
- [samples/proxy](samples/proxy/) (`GRAPHQL_BUILD_HTTP_SAMPLE=ON`): Generates a `client` and `server` pair of
262276
executables which proxy requests from the `client` to the `server` over HTTP (on port 8080 for localhost). The HTTP
263277
support in both samples comes from [Boost.Beast](https://www.boost.org/doc/libs/1_82_0/libs/beast/doc/html/index.html),
@@ -270,7 +284,7 @@ borrow heavily from examples in the `Boost.Beast` documentation._
270284
### Visual Studio on Windows
271285

272286
Use the Open Folder command to open the root of the repo. If you've installed the dependencies with
273-
vcpkg and run its Visual Studio integration command, Visual Studio should know how to build each of
287+
`vcpkg` and run its Visual Studio integration command, Visual Studio should know how to build each of
274288
the targets in this project automatically.
275289

276290
Once you've built the project Visual Studio's Test Explorer window should list the unit tests, and you

0 commit comments

Comments
 (0)