mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-21 00:21:41 +00:00
Change test suite's include_prefix to match workspace path
This commit is contained in:
parent
e5098cb4a7
commit
d41eef59c9
@ -26,10 +26,9 @@ cxx_library(
|
||||
":bridge/source",
|
||||
":module/source",
|
||||
],
|
||||
header_namespace = "cxx-test-suite",
|
||||
headers = {
|
||||
"lib.rs.h": ":bridge/header",
|
||||
"tests.h": "ffi/tests.h",
|
||||
"ffi/lib.rs.h": ":bridge/header",
|
||||
"ffi/tests.h": "ffi/tests.h",
|
||||
},
|
||||
deps = ["//:core"],
|
||||
)
|
||||
|
@ -29,8 +29,6 @@ cc_library(
|
||||
":module/source",
|
||||
],
|
||||
hdrs = ["ffi/tests.h"],
|
||||
include_prefix = "cxx-test-suite",
|
||||
strip_include_prefix = "ffi",
|
||||
deps = [
|
||||
":bridge/include",
|
||||
"//:core",
|
||||
@ -40,15 +38,11 @@ cc_library(
|
||||
rust_cxx_bridge(
|
||||
name = "bridge",
|
||||
src = "ffi/lib.rs",
|
||||
include_prefix = "cxx-test-suite",
|
||||
strip_include_prefix = "ffi",
|
||||
deps = [":impl"],
|
||||
)
|
||||
|
||||
rust_cxx_bridge(
|
||||
name = "module",
|
||||
src = "ffi/module.rs",
|
||||
include_prefix = "cxx-test-suite",
|
||||
strip_include_prefix = "ffi",
|
||||
deps = [":impl"],
|
||||
)
|
||||
|
@ -1,8 +1,11 @@
|
||||
use cxx_build::CFG;
|
||||
|
||||
fn main() {
|
||||
if cfg!(trybuild) {
|
||||
return;
|
||||
}
|
||||
|
||||
CFG.include_prefix = "tests/ffi";
|
||||
let sources = vec!["lib.rs", "module.rs"];
|
||||
cxx_build::bridges(sources)
|
||||
.file("tests.cc")
|
||||
|
@ -23,7 +23,7 @@ pub mod ffi {
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
include!("cxx-test-suite/tests.h");
|
||||
include!("tests/ffi/tests.h");
|
||||
|
||||
type C;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#[cxx::bridge(namespace = tests)]
|
||||
pub mod ffi {
|
||||
extern "C" {
|
||||
include!("cxx-test-suite/tests.h");
|
||||
include!("tests/ffi/tests.h");
|
||||
|
||||
type C = crate::ffi::C;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "cxx-test-suite/tests.h"
|
||||
#include "cxx-test-suite/lib.rs.h"
|
||||
#include "tests/ffi/tests.h"
|
||||
#include "tests/ffi/lib.rs.h"
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <numeric>
|
||||
|
@ -1,12 +1,7 @@
|
||||
load("@bazel_skylib//rules:run_binary.bzl", "run_binary")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
def rust_cxx_bridge(
|
||||
name,
|
||||
src,
|
||||
include_prefix = None,
|
||||
strip_include_prefix = None,
|
||||
deps = []):
|
||||
def rust_cxx_bridge(name, src, deps = []):
|
||||
native.alias(
|
||||
name = "%s/header" % name,
|
||||
actual = src + ".h",
|
||||
@ -43,6 +38,4 @@ def rust_cxx_bridge(
|
||||
cc_library(
|
||||
name = "%s/include" % name,
|
||||
hdrs = [src + ".h"],
|
||||
include_prefix = include_prefix,
|
||||
strip_include_prefix = strip_include_prefix,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user