Commit graph

685 commits

Author SHA1 Message Date
Simon Hausmann
46d7aaa2cb WIP 2020-06-05 14:11:29 +02:00
Olivier Goffart
9fc60e104f Add another way to load .60 files from a build script 2020-06-05 13:45:38 +02:00
Olivier Goffart
0553ab8b1a Use env::var_os instead of env::var
For the unliekly case in which the git repository is checked out in a directory
that cannot be represented with unicode
2020-06-05 13:45:37 +02:00
Simon Hausmann
31da762245 Complete compilation and running of .60 to mapped c++ tests
* Fix text-file-busy error when running the binary by replacing the use
  of named temp file with simply using the input source file and the
  extension replaced. A scope guard make sure to also delete the binary.
* Fix hard-coded library dependencies by sharing code with the cmake
  xtask that needs the same list.
2020-06-05 13:30:13 +02:00
Simon Hausmann
a69594530f First step towards compiling the generated C++ in the test driver
This extracts a compiler command line from the cc crate, runs the
compiler and tries to run the resulting binary. Unfortunately the latter
fails still.
2020-06-05 11:08:05 +02:00
Olivier Goffart
e6681a7087 Move the rust generator to the compiler lib 2020-06-05 10:54:22 +02:00
Simon Hausmann
19a2777aec Fix build 2020-06-05 09:28:09 +02:00
Olivier Goffart
3651885d87 Move the compiler binary in tools/
And rename sixtyfps_compiler to sixtyfps_compilerlib
2020-06-05 09:23:38 +02:00
Simon Hausmann
3d1064f2e8 Separate the C++ bits into a separate module 2020-06-05 09:00:49 +02:00
Simon Hausmann
8624566e5c Add boilerplate for new testing harness
The objective is to have a bunch of .60 files with annotations inside
and the test harness picks them up and runs them through the Rust and
C++ frontend.
2020-06-05 08:56:16 +02:00
Simon Hausmann
fef5004780 Fix repeated rebuilds
Don't try to determine the native libs dependency *and* the artifact
collection in one go by setting RUSTFLAGS, as that causes everything to
be rebuilt over and over again.

Instead, go back to invoking rustc once to determine the native libs
dependencies.
2020-06-04 19:25:44 +02:00
Simon Hausmann
5d2b5f7e4c Simplify cmake xtask
Call cargo only once by building the target package (gl renderer) right
away and passing the RUSTFLAGS to get the native library dependency.

Suggested by Olivier :)
2020-06-04 17:52:26 +02:00
Simon Hausmann
4eb50335a4 Prospective build fix for the CI
Make sure to prepare the cmake module and extend the lookup in the
project to prefer the local build.
2020-06-04 16:55:27 +02:00
Simon Hausmann
68e4eaa3dc Bump cache action to version 2
This apparently also enables caching for any refs
2020-06-04 16:55:27 +02:00
Olivier Goffart
5f5aa0fc38 Add a package.json for the example 2020-06-04 15:48:41 +02:00
Olivier Goffart
7a8c549625 Be able to read or write properties from JS 2020-06-04 15:48:39 +02:00
Simon Hausmann
2e0a5ddb25 Create & install a cmake package file (part 3)
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.
2020-06-04 15:33:18 +02:00
Simon Hausmann
a2c5e66bee Rename gl renderer backend package
Use a full prefixed name (sixtyfps_rendering_backend_gl) to ensure that
the created static lib can be installed without file conflicts (libgl is
not a unique name).
2020-06-04 15:30:41 +02:00
Simon Hausmann
45879a4e04 Add an install option to the cmake xtask to run cmake --install 2020-06-04 15:29:19 +02:00
Simon Hausmann
a4da4de8c8 Add the ability to specify an install prefix for the cmake xtask build 2020-06-04 15:29:19 +02:00
Simon Hausmann
c5001703d4 Build the cmake module for our runtime as xtask, part 2
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.
2020-06-04 15:29:19 +02:00
Simon Hausmann
8a2a7ae8cb Add a boilerplate for the xtask concept
This shall provide a task to build the cmake module.
2020-06-04 15:29:19 +02:00
Simon Hausmann
33cfe03dc9 Rework the C++ facing build system, part 1
The objective is to automatically create a propery cmake module, with a
FindSixtyFPSConfig.cmake, corresponding targets .cmake files, etc. This
should encapsulate the build profile (debug vs. release) and also allow
making the choice of shared vs. static transparent.

Unfortunately it does not seem to be possible to easily combine different
crates into one cdylib crate that can re-export symbols from the
statically linked rust crates (cbindgen generated, as well as manual
extern "C").

That means for the dynamic case (not cared for right now), we're going
to need to create either one cdylib per crate that has public symbols or
manually re-export the symbols.

For the static case, linking just against the "last crate" in the chain
(the gl renderer backend) is sufficient to pull in all needed symbols.

In addition for the static case we need to specify the linkage of some
external libraries. This can be extracted manually via

    cargo rustc -p gl -- --print=native-static-libs

for example. For now that's in the changed CMakeLists.txt, but the plan
going forward is to automate this extraction in an xtask, to paste that
into the cmake target.

Finally, both linkage scenarios require access to the headers. This is
for now solved by generating them simply in an include sub-directory of
the build folder ($root/target/${profile}/include).
2020-06-04 15:29:19 +02:00
Olivier Goffart
ec8baa81f2 formating 2020-06-04 14:05:17 +02:00
Olivier Goffart
7b8df5ca9d Use interior mutability for the cache
So we do not need a mutable reference to the Component
2020-06-04 14:03:30 +02:00
Olivier Goffart
e4366efb67 Do not require the component to be static to show a window 2020-06-04 13:44:40 +02:00
Olivier Goffart
aa08ee1148 Fix signal connection from JS
Since we do not have persistent handle, I need to find a place to save the
callback, so i save them in a property of the component
2020-06-04 12:49:33 +02:00
Olivier Goffart
adaadc30a9 Remove the "Rendering..." debug message.
This just polute the output while debugging other stuff
2020-06-04 12:49:33 +02:00
Olivier Goffart
49d2aec7e2 Node: add possibility to add signal handler
Right now, this only works once and then panic the second time
2020-06-04 12:49:33 +02:00
Simon Hausmann
12457ed7f3 Fix crash when using optimized gcc builds
Don't return void in non-void functions.
2020-06-04 08:44:24 +02:00
Olivier Goffart
5ee09398e8 Node: Allow to init properties to value 2020-06-03 17:33:45 +02:00
Olivier Goffart
30d61452ba Interpreter and node API: some refactoring towards being able to set properties from JS 2020-06-03 17:33:43 +02:00
Olivier Goffart
fd829fc89f Some more refactoring of the interpreter
Move the content of lib.rs to a module so we can have some
kind of public api in the lib.rs
2020-06-03 17:33:26 +02:00
Olivier Goffart
0a48252702 Interpreter: implement the ComponentVTable properly
with the drop and construct function
2020-06-03 17:33:26 +02:00
Olivier Goffart
8cfde5be5e Refactor the creation of dynamic type in the viewer
Put the creation of dynamic type in another module.
Respect the alignement.
2020-06-03 17:33:26 +02:00
Olivier Goffart
13c7e0dec8 Begin working on a Node API
Currently, the followinf command in the example/nodetest directory works:
    npm install ../../api/sixtyfps-node && node main.js
2020-06-03 17:33:05 +02:00
Olivier Goffart
a8f02df642 Refactor the viewer into a binary, and an interpreter crate
The interpreter can be used from other crates such as the test or the JS for example
2020-06-02 17:05:48 +02:00
Olivier Goffart
9c3dbe1a81 Small doc fixup to workaround rustdoc bug
https://github.com/rust-lang/rust/issues/45939
https://github.com/rust-lang/rust/issues/60543
2020-05-31 16:20:22 +02:00
Olivier Goffart
63430c2acb Add a readme for the cpp api 2020-05-31 15:34:04 +02:00
Olivier Goffart
88b7f7c0bf Signal support in the viewer 2020-05-31 02:03:02 +02:00
Olivier Goffart
2debdb43ed Viewer: Use corelib::rtti::PropertyInfo for declared property 2020-05-30 18:16:51 +02:00
Olivier Goffart
c024f97890 Viewer: use binding when needed 2020-05-30 17:42:17 +02:00
Olivier Goffart
5f01ec30ee Fix the viewer using generated rtti from a macro
One thing that needed to change is that we needed the vtable to be unique
2020-05-30 15:08:51 +02:00
Olivier Goffart
a883da3281 WIP: Use a macro to generate the RTTI 2020-05-30 15:01:50 +02:00
Olivier Goffart
0819b6f6cb WIP to create a macro crate for corelib 2020-05-29 11:51:25 +02:00
Simon Hausmann
c5cdb86b25 Get rid of the life time specifier for ComponentImpl
This was done by simply reference-counting the RTTI structure that's shared.
2020-05-28 20:38:42 +02:00
Simon Hausmann
f9fe2d8fea Don't crash on hello.60
There's a signal binding in there that's not handled yet.
2020-05-28 20:37:36 +02:00
Olivier Goffart
619e21295d reformat 2020-05-28 17:15:11 +02:00
Olivier Goffart
dc276290e9 Add support for self assignment (+=, -=, ...) 2020-05-28 17:02:06 +02:00
Simon Hausmann
d0b9505b28 Don't crash when loading hello.60 in the viewer
Ignore signals for now.
2020-05-28 15:44:00 +02:00