mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-16 06:07:39 +00:00
Add test suite beyond the existing demo
This commit is contained in:
parent
54a53df768
commit
97c7210039
@ -29,8 +29,9 @@ thiserror = "1.0"
|
||||
cc = "1.0.49"
|
||||
|
||||
[dev-dependencies]
|
||||
cxx-test-suite = { version = "0", path = "tests/ffi" }
|
||||
rustversion = "1.0"
|
||||
trybuild = "1.0"
|
||||
trybuild = "1.0.21"
|
||||
|
||||
[workspace]
|
||||
members = ["cmd", "demo-rs", "macro"]
|
||||
members = ["cmd", "demo-rs", "macro", "tests/ffi"]
|
||||
|
14
tests/ffi/Cargo.toml
Normal file
14
tests/ffi/Cargo.toml
Normal file
@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "cxx-test-suite"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
cxx = { path = "../.." }
|
||||
|
||||
[build-dependencies]
|
||||
cxx = { path = "../.." }
|
11
tests/ffi/build.rs
Normal file
11
tests/ffi/build.rs
Normal file
@ -0,0 +1,11 @@
|
||||
fn main() {
|
||||
if cfg!(trybuild) {
|
||||
return;
|
||||
}
|
||||
|
||||
cxx::Build::new()
|
||||
.bridge("lib.rs")
|
||||
.file("tests.cc")
|
||||
.flag("-std=c++11")
|
||||
.compile("cxx-test-suite");
|
||||
}
|
6
tests/ffi/lib.rs
Normal file
6
tests/ffi/lib.rs
Normal file
@ -0,0 +1,6 @@
|
||||
#[cxx::bridge(namespace = tests)]
|
||||
pub mod ffi {
|
||||
extern "C" {
|
||||
include!("tests/ffi/tests.h");
|
||||
}
|
||||
}
|
6
tests/ffi/tests.cc
Normal file
6
tests/ffi/tests.cc
Normal file
@ -0,0 +1,6 @@
|
||||
#include "tests/ffi/lib.rs"
|
||||
#include "tests/ffi/tests.h"
|
||||
|
||||
namespace tests {
|
||||
|
||||
} // namespace tests
|
6
tests/ffi/tests.h
Normal file
6
tests/ffi/tests.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "include/cxxbridge.h"
|
||||
|
||||
namespace tests {
|
||||
|
||||
} // namespace tests
|
Loading…
x
Reference in New Issue
Block a user