Link the C++ lib against the interpreter

This commit is contained in:
Olivier Goffart 2021-03-17 11:44:20 +01:00
parent 372ba09741
commit dbf06f73cc
4 changed files with 8 additions and 2 deletions

View file

@ -13,7 +13,12 @@ publish = false
path = "lib.rs" path = "lib.rs"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[features]
# In the future, this shouldn't be a default feature, but should be enabled by cmake
default = ["sixtyfps-interpreter"]
[dependencies] [dependencies]
sixtyfps-corelib = { version = "=0.0.5", path="../../sixtyfps_runtime/corelib", features = ["ffi"] } sixtyfps-corelib = { version = "=0.0.5", path="../../sixtyfps_runtime/corelib", features = ["ffi"] }
sixtyfps-rendering-backend-default = { version = "=0.0.5", path="../../sixtyfps_runtime/rendering_backends/default" } sixtyfps-rendering-backend-default = { version = "=0.0.5", path="../../sixtyfps_runtime/rendering_backends/default" }
sixtyfps-interpreter = { version = "=0.0.5", path="../../sixtyfps_runtime/interpreter", features = ["ffi"], optional = true }

View file

@ -13,6 +13,7 @@ path = "lib.rs"
[features] [features]
display-diagnostics = ["sixtyfps-compilerlib/display-diagnostics"] display-diagnostics = ["sixtyfps-compilerlib/display-diagnostics"]
ffi = []
[dependencies] [dependencies]
sixtyfps-corelib = { version = "=0.0.5", path = "../corelib", features = ["rtti"] } sixtyfps-corelib = { version = "=0.0.5", path = "../corelib", features = ["rtti"] }

View file

@ -738,6 +738,7 @@ pub mod testing {
} }
} }
/// For the C++ integration
#[cfg(feature = "ffi")] #[cfg(feature = "ffi")]
pub mod ffi { pub mod ffi {
use super::*; use super::*;

View file

@ -320,8 +320,7 @@ fn gen_backend(root_dir: &Path, include_dir: &Path) -> anyhow::Result<()> {
} }
fn gen_interpreter(root_dir: &Path, include_dir: &Path) -> anyhow::Result<()> { fn gen_interpreter(root_dir: &Path, include_dir: &Path) -> anyhow::Result<()> {
let mut config = default_config(); let config = default_config();
config.export.include.push("ValueOpaque".into());
let mut crate_dir = root_dir.to_owned(); let mut crate_dir = root_dir.to_owned();
crate_dir.extend(["sixtyfps_runtime", "interpreter"].iter()); crate_dir.extend(["sixtyfps_runtime", "interpreter"].iter());
cbindgen::Builder::new() cbindgen::Builder::new()