two bugs:
- If the .slint file did not contain any import, the depfile would have
no dependencies, and as a result, ninja would consider that it is
always dirty.
- In case the binary dir is a sub directory, the dependencies were
relative to the wrong directory. Thgis is because the behavior
changed in some version of cmake (see https://cmake.org/cmake/help/latest/policy/CMP0116.html)
to avoid any problem, use the absolute paths
Fixes#3261
We aldready document in cmake.md that a valid value for
`SLINT_EMBED_RESOURCES` is `embed-for-software-renderer`, but this
doesn't work since it expect a `software-renderer` feature that don't
exist. So create this feature.
This feature brings on all the image and font loading machinery in the
compiler. But I still enable it by default since it is a documented
cmake option.
For Ninja builds we instruct the compiler to generate a dependency file.
This would include paths like builtin:/native/../common/slint-logo-light.svg,
which my version of Ninja on Windows doesn't like at all and just flat out aborts on.
It doesn't make sense for us to emit those as dependencies, so this patch excludes
builtin paths.
The README.md contains the warning that used to be in lib.rs.
Add README.md files to all internal crates
... pointing to the official public crate to use instead.
Rename internal crates
fixup: README files
fixup rename
We need to embed resources in wasm builds. Unfortunately we can't detect
that we're called by say wasm-pack and "TARGET"/"HOST" only works inside
build.rs. So instead, to keep things simple, this change always embeds
the image resources when targeting Rust.
The `SIXTYFPS_EMBED_RESOURCES` environment variable can be used to
override this anywhere for any language.
Fixes#130
This will allow the online editor to load imports from URL asynchroniously later
Since currently the compiler is only working on a single thread, and that we
never await on a future that could block, it is allowed to use the spin_on executor
This allows specifying additional component locations. It works for
simple structs, but not yet for more complex types due to a bug yet to
be fixed :-)
Move run_passes into the library compilation function. That way the
FileDiagnostics are created by the parser, can be passed on to the library
compilation function and after that we don't need them anymore and can
replace them with future BuildDiagnostics for example.
Don't require the callers to hold on to the source code string until an
eventual diagnostics code path is hit. Instead it turns out it's
simpler to let the parser consume the source code as string, where
internally after tokenizing it can be moved into the diagnostics and
from there into the code map if needed.
There are a few places where we now clone the source code, but that's
only in cases where we also extract stuff separately (test code) or the
syntax updater.
For a .60 files the locally defined components are now stored in a separate
per-document TypeRegistry instance that falls back to the global registry
for lookups.
This is relatively straight-forward via a pass in the compiler to
collect the resources to embed and then use include_bytes! (once per
resource).
What's really annoying is that the rust resource enum can't store a
&'static [u8] because cbindgen doesn't represent that, probably because
the slice representation isn't guaranteed to stay as it is. So instead
this, for now, uses raw pointers.