Use two arrays, one for events and one for coordinates. That simplifies
the code generator and the generated code, and it also provides for
a more compact memory representation.
Using the commands property we can just paste SVG paths. This makes it
much easier to write examples/demos. A good online path designer is
for example https://codepen.io/anthonydugois/pen/mewdyZ
Making color a real property type broke the build of tests that compare
color properties. Fix this and the incorrect decoding of
strings in the cast to colors, by providing a proper public C++ color
wrapper type.
Removed the drop and create from the ComponentVTable:
since we are not using VBox<ComponentVTable>, this simplifies a bit
the code of the interpreter and everything else.
But there is still a lot of changes everywhere to support that the Component
is pinned.
This is just for the component. Which would be required if later we want
to access the properties as Pin<Property<_>>. But we have not yet ability
to do projections
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.
The Image's source property used to be a string. Now it is a Resource
enum, which can either be None or an absolute file path to the image on
disk. This also replaces the internal Image type.
The compiler internally resolves the img bang expression to a resource
reference, which shall remain just an absolute path. For now the target
generator passes that through, but in the future the target generator
may choose a target specific way of embedding the data and thus
generating a different Resource type in the final code (through
compile_expression in the cpp and rust generator).
The C++ binding is a bit messy as cbindgen doesn't really support
exporting enums that can be constructed on the C++ side. So instead we
use cbindgen to merely export the type internally and only use the tag
from it then. The public API is then a custom Resource type that is
meant to be binary compatible.
By setting RUSTFLAGS in the Cargo config we run into the situation that
when doing a host build, all rust files are compiled with the flags,
including build.rs. When cross-compiling, build.rs is not build with the
RUSTFLAGS specified. That makes kind of sense, but it also means that
all the build scripts are always recompiled when switching between a
target and a host build - and that applies to *all* packages, including
dependencies.
So short of a better solution, this patch removes the need to set
RUSTFLAGS. It was used to extract the system library dependencies for
the static library we'd create. Instead we're now building two shared
libraries and are linking against them. They contain the rust library
twice, so that's not really a desirable final state either, but
productivity wins right now :-)
It might make sense to go back to creating *one* shared library through
a dedicated crate and -- since 'pub extern "C"' functions are not
transitively exported, it may require re-exporting them by hand or using
some clever build trick perhaps.
The cargo target directory tree is now populated with a cmake package
file and that's also installed into the prefix specified with the cargo
cmake xtask.
As a consequence, the cpptest example can be built by first building the
cmake package:
cargo xtask cmake
or
cargo xtask cmake --release --target some-triplet)
or
cargo xtask cmake --release --prefix /somewhere --install
and then run cmake in the cpptest example with a prefix path:
-DCMAKE_PREFIX_PATH=/where/you/installed/it or simply
-DCMAKE_PREFIX_PATH=../../target/debug for example.
Pending still is the sixtyfps compiler tool installation and discovery.
This is done by calling cargo with json output to build the libraries,
collect the .a files, extract the native libraries needed for final
linkage and pass all that to a CMake project that cobbles together the
.a files into a propery cmake target with include paths, etc.