C++ Only link against the backend library

For some raison, not all symbols gets exported,
add some dummy code which seems to do the trick
This commit is contained in:
Olivier Goffart 2020-06-17 18:38:47 +02:00
parent 8f0520f2be
commit 54f81d4d29
5 changed files with 24 additions and 7 deletions

View file

@ -7,8 +7,6 @@ build = "build.rs"
[lib]
path = "lib.rs"
crate-type = [ "lib", "cdylib" ]
[features]
# Allow the vewer to query at runtime information about item types

View file

@ -134,3 +134,14 @@ pub unsafe extern "C" fn sixtyfps_signal_set_handler(
pub unsafe extern "C" fn sixtyfps_signal_drop(handle: *mut SignalOpaque) {
core::ptr::read(handle as *mut Signal<()>);
}
/// Somehow this is required for the extern "C" things to be exported in a dependent dynlib
#[doc(hidden)]
pub fn dummy() {
#[derive(Clone)]
struct Foo;
foo(Foo);
fn foo(f: impl Clone) {
let _ = f.clone();
}
}

View file

@ -156,3 +156,13 @@ pub extern "C" fn solve_grid_layout(data: &GridLayoutData) {
}
}
}
/// Somehow this is required for the extern "C" things to be exported in a dependent dynlib
pub fn dummy() {
#[derive(Clone)]
struct Foo;
foo(Foo);
fn foo(f: impl Clone) {
let _ = f.clone();
}
}

View file

@ -51,7 +51,7 @@ impl CMakeCommand {
let mut target_dir = None;
let mut params = vec!["-p", "sixtyfps_corelib", "-p", "sixtyfps_rendering_backend_gl"];
let mut params = vec!["-p", "sixtyfps_rendering_backend_gl"];
params.extend(build_params);
let mut first_lib: PathBuf = PathBuf::new();
@ -59,9 +59,7 @@ impl CMakeCommand {
run_cargo(&cargo(), "build", &params, |message| {
match message {
Message::CompilerArtifact(ref artifact) => {
if artifact.target.name != "sixtyfps_rendering_backend_gl"
&& artifact.target.name != "sixtyfps_corelib"
{
if artifact.target.name != "sixtyfps_rendering_backend_gl" {
return Ok(());
}