Add support for importing components, data structures, etc. generated from an earlier Slint compiler invocation #7060
Labels
a:language-c++
C++ API, codegen, CMake build system (mS,mO)
a:language-rust
Rust API and codegen (mO,mS)
enhancement
New feature or request
This issue originates from #6196.
Example:
foo.slint
, which exports components, globals, data structures, etc. as well as business logic related to foo.slint.main.slint
, which importsfoo.slint
(for example as a library) and wants to re-use components, etc. as well as the business logic from crate A, without generatingfoo.slint
's types again.The objective is to enable this workflow for Rust and C++.
In order to implement this, we need to use the Slint library system as well as the ability to associate a Slint library with a Rust module or a C++ namespace, and in addition we need build system support so that cmake or cargo can locate the user's slint library just from the dependencies.
my-library
'sbuild.rs
:my-library''s
lib.rs`:App's
Cargo.toml
:App's invocation of the slint compiler would use
DEP_MY_LIBRARY_SLINT_XXX
to locate the path to the .slint library file, name of the library, etc.It would be tempting to use the
links
feature of Cargo for this, but that's a hack. The recommended way would be that my-library also has amy-library-build
crate that provides API for App'sbuild.rs
, to then invoke the slint compiler accordingly.The text was updated successfully, but these errors were encountered: