napi-rs / cross-build

Cross build examples
https://napi.rs/docs/cross-build/summary
34 stars 5 forks source link

How can I build a project based on napi-rs for another OS #20

Closed kolserdav closed 7 months ago

kolserdav commented 7 months ago

Hello, thanks for your great work!

I'm trying to build my project https://github.com/kolserdav/synchronous-server-node for Windows from Linux. But it doesn't work for me. The result is still compiled for Linux not Windows.

You might add some instructions of cross building?

kolserdav commented 7 months ago

And if i run npm run build on this project (cross-build) it only compiled one result 01-pure-rust.linux-x64-gnu.node but it's expected to compile the results for all compatible platforms, isn't it?

kolserdav commented 7 months ago

It's just needed to add --target to the command:

napi build --platform --target aarch64-pc-windows-msvc --release