Node.js addons
You should install Conan
first, which manage our third-party C++ dependencies.
Install Conan GYP generator.
git clone https://github.com/czoido/conan-gyp-generator
cd conan-gyp-generator
conan config install gyp-generator.py -tf generators
Generate build info.
mkdir conan_build && cd conan_build
conan install .. && cd ..
npm i
npm run configure
npm run build:dev
Run Electron App with addons: npm run ele
- Friend Link: https://iweiyun.github.io/2019/01/04/node-cpp-addon/
- Create App: https://stackoverflow.com/a/15958586
- Framework Setting: nodejs/node-gyp#682
- Cast NSView: https://github.com/yue/yue/blob/0c4999b5675febe1accbedbaace9d881639c4453/node_yue/chrome_view_mac.mm
- Add Subview: https://stackoverflow.com/questions/12363564/how-to-add-an-nsview-to-nswindow-in-a-cocoa-app
- NSButton setAction with Block: https://gist.github.com/alexdrone/2634534
- Call JS From Obj-C++ thread - https://github.com/kewlbear/NodeBridge
- Call JS From C++ thread - https://github.com/huarunlin/node-ate-tbox
- Conan gyp generator - https://czoido.github.io/posts/node-native-module-conan/
- Configure rpath - nodejs/node-gyp#1397 (comment)
- Use C++17, target macOS 10.15 - nodejs/node-gyp#1662 (comment)