https://github.com/czoido/conan-node-module
An example of linking shared libraries from a node module created with node-gyp for later adding to any node app
https://github.com/czoido/conan-node-module
conan gyp node
Last synced: 20 days ago
JSON representation
An example of linking shared libraries from a node module created with node-gyp for later adding to any node app
- Host: GitHub
- URL: https://github.com/czoido/conan-node-module
- Owner: czoido
- Created: 2020-11-04T12:40:10.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-12-07T08:57:33.000Z (over 4 years ago)
- Last Synced: 2025-02-08T21:46:06.779Z (2 months ago)
- Topics: conan, gyp, node
- Language: C++
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# conan-node-module
This project is just a simple example on how a Conan custom generator can be used to handle dependencies when working with native node modules compiled with node-gyp.
Find some more detailed information in [this blogpost](https://czoido.github.io/posts/node-native-module-conan/).
The conan generator for this project is in: https://github.com/czoido/conan-gyp-generator Include the
generated conanbuildinfo.gyp in your project adding the dependencies in the bindings.gyp file:```json
{
"targets": [{
"target_name": "conan_node_module",
"sources": ["main.cpp"],
"dependencies": ["<(module_root_dir)/conan_build/conanbuildinfo.gyp:yaml-cpp"],
"conditions": [[
"OS=='mac'", {
"xcode_settings": {
"GCC_ENABLE_CPP_EXCEPTIONS": "YES"
}
}
]]
}]
}
``````bash
git clone [email protected]:czoido/conan-node-module.git
mkdir conan_build && cd conan_build
conan install .. && cd ..
npm install
source conan_build/activate_run.sh # activate virtualrunenv to set DYLD_LIBRARY_PATH so that it finds dependencies .so
node index.js # simple node application that ouputs the size of the list
```If you are using this module in electron you may want to build for it:
```bash
HOME=~/.electron-gyp node-gyp rebuild --target=10.1.5 --arch=x64 --dist-url=https://electronjs.org/headers
```