Skip to content

Commit 13f398b

Browse files
authored
fix(native): clean up install/build instructions (#5283)
We can remove the CMAKE_BUILD_TYPE entirely for the purpose of this documentation, because it uses our default build-type. In addition to that it would have to be passed as '-DCMAKE_BUILD_TYPE=RelWithDebInfo` and not via `--config` at the build-generator stage. This leads to an error in CMake starting with version 3.20: https://cmake.org/cmake/help/latest/release/3.20.html#other-changes In the actual compile/build stage it could be passed via `--config` for build-generators that provide all build-types under a single hierarchy (like Visual Studio solutions). This is also not applicable for a macOS example, but was silently ignored. I removed it too. Last but not least, I got rid of the explicit '-S .' (=source) argument, because the default value is also the cwd: https://cmake.org/cmake/help/latest/manual/cmake.1.html#generate-a-project-buildsystem
1 parent 480ff61 commit 13f398b

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

src/includes/getting-started-install/native.mdx

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ To build the SDK, download the latest sources from the [Releases page](https://g
55
For example, `CMake` can be used like this (on macOS):
66

77
```shell
8-
# configure the cmake build into the `build` directory, with crashpad (on macOS)
9-
cmake -B build -D SENTRY_BACKEND=crashpad --config RelWithDebInfo -S .
8+
# Configure the CMake build into the `build` directory with crashpad (the default
9+
# backend on macOS, thus optional to specify). Specifying `RelWithDebInfo` as the
10+
# `CMAKE_BUILD_TYPE` is also optional because it is the default in sentry-native
11+
# for all generators supporting it.
12+
cmake -B build -D SENTRY_BACKEND=crashpad -D CMAKE_BUILD_TYPE=RelWithDebInfo
1013
# build the project
11-
cmake --build build --config RelWithDebInfo --parallel
14+
cmake --build build --parallel
1215
# install the resulting artifacts into a specific prefix
1316
cmake --install build --prefix install
1417
# which will result in the following (on macOS):
@@ -24,6 +27,35 @@ install
2427
└── libsentry.dylib.dSYM
2528
```
2629

30+
contrast the above with the build-steps for a typical msbuild project on Windows:
31+
32+
```shell
33+
# The msbuild generator ignores the CMAKE_BUILD_TYPE because it contains all
34+
# build-types. Here we leave out the backend specification and rely on CMake
35+
# selecting crashpad as Windows' default backend.
36+
cmake -B build
37+
# The actual build step then requires we specify which build-type we want
38+
# to apply via the `--config` parameter. Please be aware that in msbuild
39+
# projects, the `--parallel` option has no effect.
40+
cmake --build build --config RelWithDebInfo
41+
# install the resulting artifacts (again requiring build-type!)
42+
cmake --install build --prefix install --config RelWithDebInfo
43+
# which will result in the following output (ignoring non-essential lines):
44+
tree /f install
45+
├───bin
46+
│ crashpad_handler.exe
47+
│ crashpad_handler.pdb
48+
│ sentry.dll
49+
│ sentry.pdb
50+
51+
├───include
52+
│ sentry.h
53+
54+
└───lib
55+
│ sentry.lib
56+
```
57+
58+
2759
[cmake]: https://cmake.org/cmake/help/latest/
2860

2961
<Alert level="warning" title="Bundling crashpad_handler">

src/includes/getting-started-install/native.qt.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@ For example (on macOS):
1818
# with crashpad, and Qt integration (on macOS).
1919
cmake -B build \
2020
-D SENTRY_BACKEND=crashpad \
21-
-D SENTRY_INTEGRATION_QT=YES \
22-
--config RelWithDebInfo \
23-
-S .
21+
-D SENTRY_INTEGRATION_QT=YES
2422

2523
# Build the project
26-
cmake --build build --config RelWithDebInfo --parallel
24+
cmake --build build --parallel
2725

2826
# Install the resulting artifacts into a specific prefix
2927
cmake --install build --prefix install
@@ -41,6 +39,8 @@ install
4139
└── libsentry.dylib.dSYM
4240
```
4341

42+
You can configure the Qt build for Windows analogous to the [regular build instructions](/platforms/native/#install).
43+
4444
[cmake]: https://cmake.org/cmake/help/latest/
4545

4646
<Alert level="warning" title="Bundling crashpad_handler">

0 commit comments

Comments
 (0)