This is specifically tailored to Node.js binding projects in which case the C++ layer is always a library.
Clone gyp:
git clone --depth 1 https://chromium.googlesource.com/external/gyp.git gyp
Add the below common.gypi
file in the root of the project.
Copy the binding.gyp
file to myapp.gyp
and add target.type
, include common.gypi
and include dirs to v8 and node header files:
{
"includes": [
"common.gypi"
],
"targets": [{
[..]
'type': '<(library)',
"include_dirs" : [
[..]
"/path-to-node/deps/v8/include",
"/path-to-node/deps/v8/src",
"/path-to-node/deps/uv/include",
"/path-to-node/deps/uv/src",
"/path-to-node/src"
]
}]
}
Finally run gyp
against that file:
./gyp/gyp myapp.gyp -Dlibrary=static_library --depth=. -f xcode --generator-output=./build
Now you can open ./build/myapp.xcodeproj
and inspect the code and/or attach to a Node.js process running with that library in order to debug it.