neon-bindings / examples

A collection of examples of Neon
324 stars 43 forks source link

Did not copy "cdylib:my-dependency" #80

Closed gitmalong closed 3 years ago

gitmalong commented 3 years ago

Hi!

Piggybacking on the hello world example by calling a hello world method that is based in my own local package.

my-rust-bindings Cargo.toml

[package]
name = "my-rust-bindings"
version = "0.1.0"
license = "ISC"
edition = "2018"
exclude = ["index.node"]

[lib]
crate-type = ["cdylib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
my-rust = { path = "../my-rust" }

[dependencies.neon]
version = "0.9"
default-features = false
features = ["napi-6"]

my-rust Cargo.toml

[package]
name = "my-rust"
version = "0.1.1"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rand = "0.8.4"
// some more ..

[[bin]]
name = "my"
path = "src/main.rs"

[lib]
name = "mylib"
path = "src/lib.rs"

[dependencies.neon]
version = "0.9"
default-features = false
features = ["napi-6"]

my-rust src/lib.rs

use neon::prelude::*;
use mylib::my_module::hello_bm;

#[neon::main]
fn main(mut cx: ModuleContext) -> NeonResult<()> {
    cx.export_function("hello", hello_bm)?;
    Ok(())
}

Running npm run build -- --release --verbose from my my-rust-bindings folder leads to

    Finished release [optimized] target(s) in 2m 24s
Did not copy "cdylib:my-rust"

An index.node is not being created.

Any idea why it has not copied cdylib:my-rust?

Thanks so much!

gitmalong commented 3 years ago

Wrong repo.