You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -78,6 +82,9 @@ This file is situated in the root directory of qpcpp. It performs a pre-initiali
78
82
*`QPCPP-CFG-GUI` - BOOL: set this Boolean variable to ON/TRUE, if GUI support (win32) shall be compiled in. Default: OFF
79
83
*`QPCPP_CFG_UNIT_TEST` - BOOL: set this to ON/TRUE to support qutest, if build configuration `Spy` is active. Default: OFF
80
84
*`QPCPP_CFG_VERBOSE` - BOOL: set this to enable more verbosity in message output. Default: OFF
85
+
*`QPCPP_CFG_QPCONFIG_H_INCLUDE_PATH`: - STRING (PATH): (`QP/CPP 8.0.0`) set this to have the build of QP/CPP use your project specific `qp_config.hpp`.
86
+
Default: `${QPCPP_SDK_PATH}/ports/config`
87
+
81
88
82
89
### General usage hints
83
90
1. Set `QPCPP_SDK_PATH` or `QPCPP_FETCH_FROM_GIT` either in your `CMakeLists.txt` file or as an environment variable.
@@ -87,7 +94,7 @@ This file is situated in the root directory of qpcpp. It performs a pre-initiali
87
94
5. Define the cmake target (executable or library)
88
95
6. Include `qpcpp_sdk_init.cmake`
89
96
7. configure the qpc SDK
90
-
8. call `qpcpp_sdk_init`
97
+
8. call `qpcpp_sdk_init()`
91
98
9. Add the qpcpp library to your cmake target:
92
99
`target_link_libraries(<target>> PRIVATE qpcpp)`
93
100
@@ -102,53 +109,23 @@ Generate and build your cmake project
102
109
Refer to the [CMakePresets.json manual](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) for further details.
103
110
Then you generate with `cmake --preset=<preset> .` from your project directory. The build then can be started with `cmake --build --preset=<preset>`.
104
111
105
-
### QPC configurations support
112
+
### QPCPP configurations support
106
113
Many `qpcpp` examples provide 3 build configurations:
107
114
*`Debug` - build with debug support and debug symbols. Most optimizations are turned off
108
115
*`Release` - build without debug support. Activate optimizations instead
109
116
*`Spy` - build like `Debug`. Additionally activate support for `QSpy`.
110
117
111
118
These configurations are also supported by qpcpp with cmake. Different possibilities exist to activate those.
112
119
113
-
### `qp_config.h` support
114
-
Some build configurations require the inclusion of `qp_config.h`. To achieve this, the QPC macro `QP_CONFIG` should be set, when compiling the
115
-
`qpcpp` source files. The include search paths also needs to be set accordingly in order for the preprocessor to be able to find the correct include
116
-
file.
120
+
### `qp_config.hpp` support
121
+
With the release of QP/C++ V8.0.0 the inclusion of `qp_config.hpp` is mandatory.
122
+
The `cmake` build system of qpc addresses this by providing the configuration variable `QPCPP_CFG_QPCONFIG_H_INCLUDE_PATH`. Set this to the path of your local project's `qp_config.hpp` and this will automatically be found by the build system. Do this in your main `CMakeLists.txt` file __before__ calling `qpcpp_sdk_init()`.
117
123
118
-
As `qp_config.hpp` is a project related file, which - in most cases - resides outside the `qpcpp` source code tree, the decision is to handle the
119
-
above mentioned topic within the root project's `CMakeLists.txt` file instead of integrating this topic into a rather complicated configuration
120
-
of `qpcpp` itself.
124
+
You do not need to set this variable, should the qpcpp default settings be sufficient for your project. In this case the build system uses the `qp_config.hpp` file, as it can be found in the directory `${QPCPP_SDK_PATH}/src/ports/config`.
121
125
122
126
An example can be found in the [cmake dpp example](https://github.com/QuantumLeaps/qpcpp-examples/tree/main/posix-win32-cmake/dpp). Have a look into
123
127
the example's [CMakeLists.txt](https://github.com/QuantumLeaps/qpcpp-examples/blob/main/posix-win32-cmake/dpp/CMakeLists.txt).
124
128
125
-
You will find the reference to the `qpc` library, followed by the project's specific setup for `qp_config.h` like this:
126
-
```
127
-
# set up qpcpp library
128
-
target_link_libraries(dpp
129
-
PRIVATE
130
-
qpcpp
131
-
)
132
-
# should a 'qp_config.h' configuration file be used and is it available
133
-
# edit the HINTS in the 'find_file()' call according to your project settings
134
-
if(USE_QP_CONFIG)
135
-
find_file(QP_CONFIG qp_config.h HINTS ${CMAKE_CURRENT_SOURCE_DIR}) # try to identify 'qp_config.h'
136
-
if(QP_CONFIG) # found 'qp_config.h'
137
-
cmake_path(GET QP_CONFIG PARENT_PATH QP_CONFIG_DIR) # extract the path from the FQFN
138
-
target_compile_definitions(qpcpp # add -DQP_CONFIG to the qpcpp build
139
-
PUBLIC
140
-
QP_CONFIG
141
-
)
142
-
target_include_directories(qpcpp # add the path to 'qp_config.h' to the list of include paths for qpcpp
143
-
PUBLIC
144
-
${QP_CONFIG_DIR}
145
-
)
146
-
else() # 'qp_config.h' requested but not find - try to configure and build anyways
147
-
message(WARNING "File 'qp_config.h' not found!")
148
-
endif()
149
-
endif()
150
-
```
151
-
152
129
### Multi configuration generators
153
130
The most easy way to make use of the different configurations is to use a multi config generator like `Ninja Multi-Config` or `MS Visual Studio`.
154
131
Using one of such generators enables to generate the build system using `cmake` and afterwards simply selecting the desired build configuration like
0 commit comments