Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
The cmake-js npm package is a tool that simplifies the process of building native C++ addons for Node.js using CMake. It provides a seamless integration between Node.js and CMake, allowing developers to leverage the powerful build system of CMake while working within the Node.js ecosystem.
Building Native Addons
This feature allows you to build native C++ addons for Node.js using CMake. The code sample demonstrates how to use cmake-js to build a target named 'myAddon' in debug mode.
const cmake = require('cmake-js');
cmake.build({
target: 'myAddon',
debug: true
}).then(() => {
console.log('Build complete');
}).catch(err => {
console.error('Build failed', err);
});
Configuring Build Options
This feature allows you to configure various build options for your CMake project. The code sample shows how to set the build type to 'Release' and specify an installation prefix.
const cmake = require('cmake-js');
cmake.configure({
CMAKE_BUILD_TYPE: 'Release',
CMAKE_INSTALL_PREFIX: '/usr/local'
}).then(() => {
console.log('Configuration complete');
}).catch(err => {
console.error('Configuration failed', err);
});
Running CMake Commands
This feature allows you to run arbitrary CMake commands. The code sample demonstrates how to run a CMake build command to install the target.
const cmake = require('cmake-js');
cmake.run(['--build', '.', '--target', 'install']).then(() => {
console.log('CMake command executed successfully');
}).catch(err => {
console.error('CMake command failed', err);
});
node-gyp is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js. It uses the gyp build system instead of CMake. While node-gyp is widely used and well-supported, it lacks the flexibility and advanced features of CMake, which cmake-js leverages.
node-pre-gyp is a tool that makes it easy to publish and install Node.js C++ addons from binaries. It is built on top of node-gyp and provides additional features like binary hosting and pre-built binary distribution. However, it does not offer the same level of integration with CMake as cmake-js.
neon-cli is a tool for building fast and safe native Node.js modules using Rust instead of C++. It provides a high-level abstraction over the Node.js C++ API and offers a more modern and safer language for writing native modules. While it is not directly comparable to cmake-js, it serves a similar purpose of enabling native module development for Node.js.
CMake.js - a Node.js/io.js native addon build tool.
Readme and tutorials are gonna be available soon. Until then please refer the help and take a look at the example projects in the tests directory.
Install:
npm install -g cmake-js
Help:
cmake-js --help
FAQs
CMake.js - a Node.js native addon build tool
The npm package cmake-js receives a total of 103,838 weekly downloads. As such, cmake-js popularity was classified as popular.
We found that cmake-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.