I want to be able to step though my C++ code for a Node.js addon that I am making. I understand that CMake.js has the --debug
option, but there is no documentation about it.
I am using the node-addon-api module, in CLion.
I want to be able to step though my C++ code for a Node.js addon that I am making. I understand that CMake.js has the --debug
option, but there is no documentation about it.
I am using the node-addon-api module, in CLion.
After months of blind debugging though the use of Errors to print variables, I have finally figured out how to attach the CLion debugger to a Node.js addon.
which node
or where.exe node
on Windows to get the path)I recently stumbled on the same problem and had success creating a custom toolchain in CLion 2020.3 with CMake.js on a Linux system.
Reproducible steps:
npm install -g cmake-js
. Make sure to install the package globally, so that your toolchain becomes available across multiple projects.mkdir my-project && cd my-project && npm init
.npm install bindings && npm install node-addon-api
(For the C++ wrapper).CMakeLists.txt
in the root directory and paste this. Make sure to replace file(GLOB SOURCE_FILES hello.cpp)
with your addon-specific cpp and header files.my-project
in CLion.cmake-js
binary that you downloaded in the npm directory where you keep your global packages.compile -D
and set the working directory to the root directory of my-project
.cmake-js
binary. Set the arguments to clean
and set the working directory to your project's root directory.Custom Build Application
. –
Barrow Before Launch > Build
because cmake-js
is going to build for us instead of CLion. –
Barrow © 2022 - 2024 — McMap. All rights reserved.
cmake-js build -debug
stays in Release, butcmake-js rebuild -debug
rebuilds with debug. – Towering