Skip to content

Commit

Permalink
Moves integration test to a dedicated crate
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon committed Oct 5, 2024
1 parent 5a23aa1 commit baba340
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ jobs:
run: cargo fmt --check
- name: Run tests
run: cargo test
- name: Run example
run: cargo run -p example
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ edition = "2021"
[dependencies]
cppbind-macros = { version = "0.1", path = "macros" }

[build-dependencies]
cc = "1.1.24"

[workspace]
members = ["macros"]
members = ["example", "macros"]
17 changes: 0 additions & 17 deletions build.rs

This file was deleted.

10 changes: 10 additions & 0 deletions example/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "example"
version = "0.1.0"
edition = "2021"

[dependencies]
cppbind = { path = ".." }

[build-dependencies]
cc = "1.1.24"
15 changes: 15 additions & 0 deletions example/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use std::path::Path;

fn main() {
let root = Path::new("src");
let mut b = cc::Build::new();
let files = ["main.cpp"];

for f in files.into_iter().map(|f| root.join(f)) {
b.file(&f);

println!("cargo::rerun-if-changed={}", f.to_str().unwrap());
}

b.cpp(true).compile("example");
}
2 changes: 1 addition & 1 deletion tests/binding.cpp → example/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../cppbind.hpp"
#include "../../cppbind.hpp"

#include <string>

Expand Down
2 changes: 2 additions & 0 deletions tests/binding.rs → example/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use cppbind::cpp;

fn main() {}

cpp! {
class class1 {
public:
Expand Down

0 comments on commit baba340

Please sign in to comment.