Skip to content

Commit 8371d4c

Browse files
committed
Upgrade documentation and add missing parts
1 parent aac8509 commit 8371d4c

14 files changed

+257
-82
lines changed

docs/ApplicationIcons.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
### macOS
66

77
To generate a `.icns` file on macOS, an `.iconset` folder needs to be converted via `iconutil`. The
8-
folder `src/assets/icons/icon.iconset` contains all needed icon sizes. To generate the needed app icon under `src/assets/icons/icon.icns`, run from inside the `src/assets/icons` folder:
8+
folder `src/assets/icons/icon.iconset` contains all needed icon sizes. To generate the needed app icon
9+
under `src/assets/icons/icon.icns`, run from inside the `src/assets/icons` folder:
910

1011
```shell
1112
iconutil -c icns icon.iconset
1213
```
1314

1415
### Windows
1516

16-
To create the `icon.ico` file [ImageMagick](https://www.imagemagick.org) is used. From inside the `src/assets/icons` folder run:
17+
To create the `icon.ico` file [ImageMagick](https://www.imagemagick.org) is used. From inside the `src/assets/icons`
18+
folder run:
1719

1820
```shell
1921
convert \
@@ -31,29 +33,35 @@ identify icon.ico
3133

3234
### Linux
3335

34-
There is no need to generate an icon set for Linux. A high resolution PNG (1024x1024px) is enough for the app icon. This is located under `icons/BaseAppIcon.png`.
36+
There is no need to generate an icon set for Linux. A high resolution PNG (1024x1024px) is enough for the app icon. This
37+
is located under `icons/BaseAppIcon.png`.
3538

3639
## Icon design guidelines
3740

38-
The example project contains an example icon. To get guiding for creating an own unique app icon, here a couple of resources:
41+
The example project contains an example icon. To get guiding for creating an own unique app icon, here a couple of
42+
resources:
3943

4044
- [Windows app icon guidelines](https://learn.microsoft.com/en-us/windows/apps/design/style/iconography/app-icon-design)
4145
- [Apple human interface design, icons guide](https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/)
4246

4347
## Integrating icons
4448

45-
How are those application icons connected to become the icon of the generated executable? Through the packaging process and manifest files.
49+
How are those application icons connected to become the icon of the generated executable? Through the packaging process
50+
and manifest files.
4651

4752
### Package app icons
4853

49-
For macOS and Windows app icons are packed as static resources via CMake's [target_sources](https://cmake.org/cmake/help/latest/command/target_sources.html) function in `src/app/cmake/AppAssets.cmake`. For example, adding the Windows `.ico` file to the main executable:
54+
For macOS and Windows app icons are packed as static resources via
55+
CMake's [target_sources](https://cmake.org/cmake/help/latest/command/target_sources.html) function
56+
in `src/app/cmake/AppAssets.cmake`. For example, adding the Windows `.ico` file to the main executable:
5057

5158
```cmake
5259
# src/app/cmake/AppAssets.cmake
5360
target_sources(App PUBLIC ${PROJECT_SOURCE_DIR}/src/assets/icons/icon.ico)
5461
```
5562

56-
On Linux, it needs to be part of the installation process that is defined in `src/app/cmake/packaging/Linux.cmake`, where application icons are installed in a shared directory `share/pixmaps`. This does look like the following:
63+
On Linux, it needs to be part of the installation process that is defined in `src/app/cmake/packaging/Linux.cmake`,
64+
where application icons are installed in a shared directory `share/pixmaps`. This does look like the following:
5765

5866
```cmake
5967
# src/app/cmake/packaging/Linux.cmake
@@ -67,7 +75,13 @@ The manifest files then link the app icon to the executable.
6775

6876
#### macOS
6977

70-
For macOS the manifest file is an [Info.plist](https://developer.apple.com/documentation/bundleresources/information_property_list) defining application properties. It is located at `src/app/Manifests/Info.plist` and added to the app bundle through `src/app/cmake/packaging/Darwin.cmake`. Here the CMake function [set_target_properties](https://cmake.org/cmake/help/latest/command/set_target_properties.html) defines `MACOSX_BUNDLE_INFO_PLIST` for the manifest location. The icon name is defined inside the `Info.plist` file under the property name `CFBundleIconFile`.
78+
For macOS the manifest file is
79+
an [Info.plist](https://developer.apple.com/documentation/bundleresources/information_property_list) defining
80+
application properties. It is located at `src/app/Manifests/Info.plist` and added to the app bundle
81+
through `src/app/cmake/packaging/Darwin.cmake`. Here the CMake
82+
function [set_target_properties](https://cmake.org/cmake/help/latest/command/set_target_properties.html)
83+
defines `MACOSX_BUNDLE_INFO_PLIST` for the manifest location. The icon name is defined inside the `Info.plist` file
84+
under the property name `CFBundleIconFile`.
7185

7286
```cmake
7387
# src/app/cmake/packaging/Darwin.cmake
@@ -79,19 +93,25 @@ set_target_properties(App PROPERTIES
7993

8094
#### Windows
8195

82-
The resource file `src/app/Manifests/app.rc` will bind the icon to the Windows executable. The resource file itself is then added as part of the application bundle via [target_sources](https://cmake.org/cmake/help/latest/command/target_sources.html) in `src/app/cmake/AppAssets.cmake`.
96+
The resource file `src/app/Manifests/app.rc` will bind the icon to the Windows executable. The resource file itself is
97+
then added as part of the application bundle
98+
via [target_sources](https://cmake.org/cmake/help/latest/command/target_sources.html)
99+
in `src/app/cmake/AppAssets.cmake`.
83100

84101
```cmake
85102
target_sources(App PUBLIC
86-
${PROJECT_SOURCE_DIR}/src/assets/icons/icon.ico
87-
${PROJECT_SOURCE_DIR}/src/app/Manifests/app.rc)
103+
${PROJECT_SOURCE_DIR}/src/assets/icons/icon.ico
104+
${PROJECT_SOURCE_DIR}/src/app/Manifests/app.rc)
88105
```
89106

90107
#### Linux
91108

92-
For Linux a `src/app/Manifests/App.desktop.in` defines the created shortcut with icon. The `.in` file will be processed by CMake via [configure_file](https://cmake.org/cmake/help/latest/command/configure_file.html) in `src/app/cmake/packaging/Linux.cmake`.
109+
For Linux a `src/app/Manifests/App.desktop.in` defines the created shortcut with icon. The `.in` file will be processed
110+
by CMake via [configure_file](https://cmake.org/cmake/help/latest/command/configure_file.html)
111+
in `src/app/cmake/packaging/Linux.cmake`.
93112

94-
It will take the `.in` file and produce a final `.desktop` file for Linux with the given icon name under the property `Icon=`.
113+
It will take the `.in` file and produce a final `.desktop` file for Linux with the given icon name under the
114+
property `Icon=`.
95115

96116
```cmake
97117
# src/app/cmake/packaging/Linux.cmake

docs/BuildAndExecution.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DDEACTIVATE_LOGGING -B build/debug
2626

2727
### `DEBUG`
2828

29-
Will not only enable application internal debugging, but also profiling (`APP_PROFILE`). This option is mainly useful to get debugging and profiling output on release builds.
29+
Will not only enable application internal debugging, but also profiling (`APP_PROFILE`). This option is mainly useful to
30+
get debugging and profiling output on release builds.
3031

3132
**Example:**
3233

@@ -64,31 +65,39 @@ After configuration the application can be built through CMake via `cmake --buil
6465
cmake --build build/debug
6566
```
6667

67-
This will build the application with the given configuration. Depending on the platform it was executed on a different build directory structure will be generated, reflecting how the application will latter be [installed on packaging](Packaging.md).
68+
This will build the application with the given configuration. Depending on the platform it was executed on a different
69+
build directory structure will be generated, reflecting how the application will latter
70+
be [installed on packaging](Packaging.md).
6871

6972
## Execute
7073

71-
When not running through an [IDE like CLion](https://www.jetbrains.com/clion), the built application can be run by directly executing the generated binary. Depending on the operating system it can be found at a different place, as different build directory structures are generated.
74+
When not running through an [IDE like CLion](https://www.jetbrains.com/clion), the built application can be run by
75+
directly executing the generated binary. Depending on the operating system it can be found at a different place, as
76+
different build directory structures are generated.
7277

7378
### macOS
7479

75-
On Apple devices an app package structure is created under `./build/<TARGET>/src/app/App.app`, where `<TARGET>` is the build target like **debug** or **release**. Inside that [application bundle](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/AboutBundles/AboutBundles.html#//apple_ref/doc/uid/10000123i-CH100-SW1) is the app executable.
80+
On Apple devices an app package structure is created under `./build/<TARGET>/src/app/App.app`, where `<TARGET>` is the
81+
build target like **debug** or **release**. Inside
82+
that [application bundle](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/AboutBundles/AboutBundles.html#//apple_ref/doc/uid/10000123i-CH100-SW1)
83+
is the app executable.
7684

7785
Run on a built target, in this example **debug**:
7886

7987
```shell
8088
./build/debug/src/app/App.app/Contents/MacOS/App
8189
```
8290

83-
Though, even better is to use **XCode as generator** to create app builds on macOS. Only difference in usage is running CMake with `-GXCode`. If `CMAKE_OSX_ARCHITECTURES` is not set, it will create universal binaries on M1/2 macs.
91+
Though, even better is to use **Xcode as generator** to create app builds on macOS. Only difference in usage is running
92+
CMake with `-GXcode`. If `CMAKE_OSX_ARCHITECTURES` is not set, it will create universal binaries on M1/2 macs.
8493

85-
To run a **debug** build created with XCode:
94+
To run a **debug** build created with Xcode:
8695

8796
```shell
8897
./build/xcode/src/app/Debug/App.app/Contents/MacOS/App
8998
```
9099

91-
To run a **release** build created with XCode:
100+
To run a **release** build created with Xcode:
92101

93102
```shell
94103
./build/xcode/src/app/Release/App.app/Contents/MacOS/App
@@ -110,7 +119,8 @@ build/release/src/app/App.exe
110119

111120
### Linux
112121

113-
For Linux the generated structure is a direct executable, as libraries and assets have dedicated locations on the system.
122+
For Linux the generated structure is a direct executable, as libraries and assets have dedicated locations on the
123+
system.
114124

115125
Run on a built target, in this example **debug**:
116126

docs/CMakePresets.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# CMake Presets
2+
3+
The template uses [Cmake Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html), enabling a
4+
convenient way of running CMake, CTest, and CPack.
5+
6+
You can find out more about presets in
7+
the [official CMake documentation about Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html). I
8+
also wrote an [article as a
9+
TL;DR on CMake presets](https://martin-fieber.de/blog/cmake-presets/), giving an overview of how to define and work with
10+
them.
11+
12+
## Configure
13+
14+
To list all available configure presets, some dependent on the current system:
15+
16+
```shell
17+
cmake --list-presets
18+
```
19+
20+
Run configure presets by name:
21+
22+
```shell
23+
cmake --preset debug
24+
```
25+
26+
## Build
27+
28+
To list all available build presets, some dependent on the current system:
29+
30+
```shell
31+
cmake --build --list-presets
32+
```
33+
34+
Run build presets by name:
35+
36+
```shell
37+
cmake --build --preset debug
38+
```
39+
40+
## Test
41+
42+
To list all available test presets:
43+
44+
```shell
45+
ctest --list-presets
46+
```
47+
48+
Run test presets by name, executing CTest:
49+
50+
```shell
51+
ctest --preset all
52+
```
53+
54+
## Packaging
55+
56+
To list all available packaging presets, some dependent on the current system:
57+
58+
```shell
59+
cpack --list-presets
60+
```
61+
62+
Run packaging presets by name, executing CPack:
63+
64+
```shell
65+
cpack --preset release
66+
```
67+
68+
## Workflows
69+
70+
To list all available workflows, some dependent on the current system:
71+
72+
```shell
73+
cmake --workflow --list-presets
74+
```
75+
76+
Run a workflow by name:
77+
78+
```shell
79+
cmake --workflow --preset dist
80+
```
81+
82+
***
83+
84+
Next up: [Platform dependent code](PlatformCode.md)

docs/Fonts.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Fonts
22

3-
Applications fonts are in `src/assets/fonts`, and the template comes with the amazing open source font [Manrope](https://manropefont.com).
3+
Applications fonts are in `src/assets/fonts`, and the template comes with the amazing open source
4+
font [Manrope](https://manropefont.com).
45

56
## Add new font
67

7-
After adding a new font to the `src/assets/fonts` folder, the fonts needs to be added to ImGUI. This is done in `src/core/Core/Application.cpp`, the `run` method.
8+
After adding a new font to the `src/assets/fonts` folder, the fonts needs to be added to ImGUI. This is done
9+
in `src/core/Core/Application.cpp`, the `run` method.
810

911
```c++
1012
ExitStatus App::Application::run() {

docs/HighDPISupport.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# High DPI support
22

3-
The template app supports high DPI displays out-of-the-box. The header `src/core/Core/DPIHandler.hpp` defines the interface for DPI handling. The implementations are in `src/core/Platform` under `DPIHandler.cpp` per platform.
3+
The template app supports high DPI displays out-of-the-box. The header `src/core/Core/DPIHandler.hpp` defines the
4+
interface for DPI handling. The implementations are in `src/core/Platform` under `DPIHandler.cpp` per platform.
45

56
The following two functions are important for DPI handling.
67

78
## `get_scale()`
89

9-
Returns a `float` scaling factor used to set render and font scale. Should be used whenever a relative scaling is needed. See usage in platform `DPIhandler.cpp` files and `src/core/Core/Application.cpp`, `run` method.
10+
Returns a `float` scaling factor used to set render and font scale. Should be used whenever a relative scaling is
11+
needed. See usage in platform `DPIhandler.cpp` files and `src/core/Core/Application.cpp`, `run` method.
1012

1113
## `get_dpi_aware_window_size()`
1214

13-
Returns a `WindowSize`, a struct with height and width as `int`. Will scale `Window::Settings` DPI aware per platform. See file `src/core/Core/Window.cpp`.
15+
Returns a `WindowSize`, a struct with height and width as `int`. Will scale `Window::Settings` DPI aware per platform.
16+
See file `src/core/Core/Window.cpp`.

docs/Logging.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Logging
22

3-
The library [spdlog](https://github.com/gabime/spdlog) is used for logging. The logger is set up in `src/core/Core/Log.{cpp,hpp}` that will define a default logger writing to stdout and into a `app.log` file. The macros used for logging are defined in `src/core/Core/Log.hpp`.
3+
The library [spdlog](https://github.com/gabime/spdlog) is used for logging. The logger is set up
4+
in `src/core/Core/Log.{cpp,hpp}` that will define a default logger writing to stdout and into a `app.log` file. The
5+
macros used for logging are defined in `src/core/Core/Log.hpp`.
46

57
## Available macros
68

docs/MakeItYourOwn.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ There are some variables and settings that should be adapted to specific project
44

55
## Project name and company
66

7-
Inside the root `CMakeLists.txt`, the CMake [project](https://cmake.org/cmake/help/latest/command/project.html) call also defines the project name as `CMAKE_PROJECT_NAME` variable. This is currently called `BasicGuiProjectSetup`. Here an example how this could look like:
7+
Inside the root `CMakeLists.txt`, the CMake [project](https://cmake.org/cmake/help/latest/command/project.html) call
8+
also defines the project name as `CMAKE_PROJECT_NAME` variable. This is currently called `BasicGuiProjectSetup`. Here an
9+
example how this could look like:
810

911
```cmake
1012
# CMakeLists.txt
@@ -15,7 +17,8 @@ project(
1517
LANGUAGES CXX)
1618
```
1719

18-
In that same file, the **project company name and namespace** ([Reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation)) are defined.
20+
In that same file, the **project company name and namespace
21+
** ([Reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation)) are defined.
1922

2023
```cmake
2124
# CMakeLists.txt
@@ -28,15 +31,18 @@ set(PROJECT_COMPANY_NAMESPACE "com.mycompany") # Reverse domain name notation
2831

2932
## App icons
3033

31-
App icons are located under `src/assets/icons/`. There is dedicated documentation on how to update and integrate those into the project under [Application Icons](ApplicationIcons.md).
34+
App icons are located under `src/assets/icons/`. There is dedicated documentation on how to update and integrate those
35+
into the project under [Application Icons](ApplicationIcons.md).
3236

3337
## Installer graphics
3438

35-
The installer on macOS and Windows are graphical and use some images to properly represent the app. Images and documentation for macOS are in `packaging/dmg/`, same for Windows under `packaging/nsis/`.
39+
The installer on macOS and Windows are graphical and use some images to properly represent the app. Images and
40+
documentation for macOS are in `packaging/dmg/`, same for Windows under `packaging/nsis/`.
3641

3742
## Code of conduct
3843

39-
There is a basic Code of Conduct (CoC) provided by https://www.contributor-covenant.org in `CODE_OF_CONDUCT.md`. Search for `EMAIL` inside that document to provide a contact for the CoC.
44+
There is a basic Code of Conduct (CoC) provided by https://www.contributor-covenant.org in `CODE_OF_CONDUCT.md`. Search
45+
for `EMAIL` inside that document to provide a contact for the CoC.
4046

4147
***
4248

0 commit comments

Comments
 (0)