Generate cxx binding in build.rs

This commit is contained in:
topjohnwu
2023-05-19 15:16:54 -07:00
parent 57bd450798
commit 2bcf2e76f1
27 changed files with 169 additions and 49 deletions

View File

@@ -7,6 +7,9 @@ edition = "2021"
crate-type = ["staticlib"]
path = "lib.rs"
[build-dependencies]
cxx-gen = { path = "../external/cxx-rs/gen/lib" }
[dependencies]
base = { path = "../base" }
cxx = "1.0.69"

8
native/src/init/build.rs Normal file
View File

@@ -0,0 +1,8 @@
use crate::gen::gen_cxx_binding;
#[path = "../base/gen.rs"]
mod gen;
fn main() {
gen_cxx_binding("init-rs");
}

View File

@@ -10,8 +10,6 @@
#include "init.hpp"
#include <init-rs.cpp>
using namespace std;
bool unxz(int fd, const uint8_t *buf, size_t size) {

View File

@@ -1,5 +1,6 @@
#include <base.hpp>
#include <init-rs.hpp>
#include "init-rs.hpp"
using kv_pairs = std::vector<std::pair<std::string, std::string>>;