Skip to content

An example of linking shared libraries from a node module created with node-gyp for later adding to any node app

Notifications You must be signed in to change notification settings

czoido/conan-node-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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:

{
    "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"
                }
            }
        ]]
    }]
}
git clone git@github.com: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:

HOME=~/.electron-gyp node-gyp rebuild --target=10.1.5 --arch=x64 --dist-url=https://electronjs.org/headers

About

An example of linking shared libraries from a node module created with node-gyp for later adding to any node app

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published