mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 04:48:27 +00:00
C++: Make the system testing feature automatically enable debug info
While we haven't settled on the debug info feature and are merely controlling it via environment variable, setting that can be very hard - especially when using Yocto. To make life easier, let's do in C++ what we can't easily do for Rust but would like to: When enabling system testing, automatically emit the necessary debug info, by setting the environment variable when calling the compiler. This is done by adding SLINT_ENABLED_FEATURES and SLINT_DISABLED_FEATURES properties on the Slint::Slint target that - as lists - export the list of features and their status. This way we can compile Slint in once place and safely in the CMake code running in application scope check about the available features.
This commit is contained in:
parent
e190d2b2ae
commit
964de46c51
2 changed files with 24 additions and 1 deletions
|
|
@ -14,6 +14,12 @@ function(SLINT_TARGET_SOURCES target)
|
|||
# Parse the NAMESPACE argument
|
||||
cmake_parse_arguments(SLINT_TARGET_SOURCES "" "NAMESPACE" "LIBRARY_PATHS" ${ARGN})
|
||||
|
||||
get_target_property(enabled_features Slint::Slint SLINT_ENABLED_FEATURES)
|
||||
if (("EXPERIMENTAL" IN_LIST enabled_features) AND ("SYSTEM_TESTING" IN_LIST enabled_features))
|
||||
set(SLINT_COMPILER_ENV ${CMAKE_COMMAND} -E env)
|
||||
set(SLINT_COMPILER_ENV ${SLINT_COMPILER_ENV} SLINT_EMIT_DEBUG_INFO=1)
|
||||
endif()
|
||||
|
||||
if (DEFINED SLINT_TARGET_SOURCES_NAMESPACE)
|
||||
# Remove the NAMESPACE argument from the list
|
||||
list(FIND ARGN "NAMESPACE" _index)
|
||||
|
|
@ -41,7 +47,7 @@ function(SLINT_TARGET_SOURCES target)
|
|||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_SLINT_BASE_NAME}.h
|
||||
COMMAND Slint::slint-compiler ${_SLINT_ABSOLUTE}
|
||||
COMMAND ${SLINT_COMPILER_ENV} $<TARGET_FILE:Slint::slint-compiler> ${_SLINT_ABSOLUTE}
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/${_SLINT_BASE_NAME}.h
|
||||
--depfile ${CMAKE_CURRENT_BINARY_DIR}/${_SLINT_BASE_NAME}.d
|
||||
--style ${_SLINT_STYLE}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue