diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-06-10 16:33:31 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-06-10 16:33:31 +0000 |
| commit | 5365d670901505c9d9fb447cdc8aac9cbbff971e (patch) | |
| tree | 1d8a3dfa0f73b01f42e81f2504d4b8a9b7972f2e | |
| parent | Updated core (diff) | |
| download | DiligentEngine-5365d670901505c9d9fb447cdc8aac9cbbff971e.tar.gz DiligentEngine-5365d670901505c9d9fb447cdc8aac9cbbff971e.zip | |
Updated CMake custom target configuration
| m--------- | DiligentCore | 0 | ||||
| -rw-r--r-- | README.md | 29 |
2 files changed, 22 insertions, 7 deletions
diff --git a/DiligentCore b/DiligentCore -Subproject 2fe8158aa6115da306883c765c6ec1270dc7403 +Subproject e70a84be244761ebd620e2922c8423687d4e507 @@ -499,11 +499,14 @@ reduce the size of the Vulkan back-end binary. <a name="build_and_run_customizing"></a> ## Customizing Build -Diligent Engine allows clients to customize build settings by providing configuration script file that defines two optional +Diligent Engine allows clients to customize build settings by providing configuration script file that defines the following optional [cmake functions](https://cmake.org/cmake/help/latest/command/function.html): * `custom_configure_build()` - defines global build properties such as build configurations, c/c++ compile flags, link flags etc. -* `custom_configure_target()` - defines custom settings for every target in the build. +* `custom_pre_configure_target()` - defines custom settings for every target in the build and is called before the engine's + build system starts configuring the target. +* `custom_post_configure_target()` - called after the engine's build system has configured the target to let the client + override properties set by the engine. The path to the configuration script should be provided through `BUILD_CONFIGURATION_FILE` variable when running cmake and must be relative to the cmake root folder, for example: @@ -573,12 +576,12 @@ endfunction() ``` -### Customizing individual target build settings with custom_configure_target() function +### Customizing individual target build settings with custom_pre_configure_target() and custom_post_configure_target() functions -If defined, `custom_configure_target()` is called for every target created by the build system and +If defined, `custom_pre_configure_target()` is called for every target created by the build system and allows configuring target-specific properties. -By default, the build system sets some target properties. If `custom_configure_target()` sets all required properties, +By default, the build system sets some target properties. If `custom_pre_configure_target()` sets all required properties, it can tell the build system that no further processing is required by setting `TARGET_CONFIGURATION_COMPLETE` [parent scope](https://cmake.org/cmake/help/latest/command/set.html#set-normal-variable) variable to `TRUE`: @@ -586,10 +589,10 @@ it can tell the build system that no further processing is required by setting ` set(TARGET_CONFIGURATION_COMPLETE TRUE PARENT_SCOPE) ``` -The following is an example of `custom_configure_target()` function: +The following is an example of `custom_pre_configure_target()` function: ```cmake -function(custom_configure_target TARGET) +function(custom_pre_configure_target TARGET) set_target_properties(${TARGET} PROPERTIES STATIC_LIBRARY_FLAGS_RELEASEMT /LTCG ) @@ -597,6 +600,18 @@ function(custom_configure_target TARGET) endfunction() ``` +If the client only needs to override some settings, it may define `custom_post_configure_target()` function that is called +after the engine has completed configuring the target, for example: + +```cmake +function(custom_post_configure_target TARGET) + set_target_properties(${TARGET} PROPERTIES + CXX_STANDARD 17 + ) +endfunction() +``` + + <a name="getting_started"></a> # Getting started with the API |
