-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CMake + Vcpkg example #575
base: main
Are you sure you want to change the base?
Conversation
@Pospelove thanks for the examples! Is there a reason build_with_cmake is being replaced with build_with_cmakejs rather than being shown as an example in addition to build_with_cmake? |
Hello everyone, and thanks for the interest! I’m planning to finish this PR by adding a C++ example and running the necessary tests. There are a few points I’d like to discuss further, as they might need some consensus:
I updated the CMake.js section of the docs because the mismatch between CMake and CMake.js can be confusing for developers who are coming from a C++ background. To provide some context, the node-api-headers and node-addon-api vcpkg ports are quite handy for building native addons without needing CMake.js or npm at all. Here’s why they might be a good fit for many projects:
|
P.S. I'll be able to get back to this PR once examples land P.S.S. I use the node-addon-api in https://github.com/skyrim-multiplayer/skymp for a long time and it works so much better than anything else like node-gyp or cmake.js. The mix of C++ and TypeScript code is being built by CMake build system. In the past the project was invoking cmake.js via npm as a subprocess from root CMake build system. Imagine what a rabbithole there was! |
git submodules cannot work if the package is published and used as a dependency. |
Good point. CMake-based filesystem isn't good in terms of publishing npm packages anyways. This will be another topic: how do one publish a vcpkg+cmake backed Node addon. For now, I didn't publish any and there are no established best practices. vcpkg submodule is logically a dev-dependency, it's not needed once your Node addon built since it's only ensures dependencies compiled. |
WIP, will extend docs and add node-addon-api example