slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.93k stars 566 forks source link

CMake target property to control resource embedding #2279

Closed tronical closed 1 year ago

tronical commented 1 year ago

The Rust API of the compiler (via build.rs) allows controlling who resources such as images or SVGs are embedded in the generated code.

For C++ an API is missing.

This issue proposes adding support for a boolean command line option to the slint-compiler binary and a SLINT_EMBED_RESOURCES boolean CMake target property that slint_target_sources should use in a generator expression to the custom command to invoke the compiler.

Example:

add_executable(foo ...)
slint_target_sources(foo bar.slint)
set_property(TARGET foo PROPERTY SLINT_EMBED_RESOURCES TRUE)
tronical commented 1 year ago

This was implemented and is documented at https://slint-ui.com/releases/1.0.2/docs/cpp/cmake.html#resource-embedding