-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
How to generate compile_commands.json file? #1526
Comments
AFAIK we don't have a nice
example interesting node-gyp output part (with
|
P.S. if you feel like implementing that and submitting a PR that would be greatly appreciated. Line 327 in bac9e44
|
Btw I got this working, but I don't think it's correct in the repo. The generator was added to |
The command to run is something like Problem is that I cannot find a way to access the module in Either add |
It isn't possible to access `tools/gyp/pylib/gyp/generator/compile_commands_json.py` using the `--format` option. This commit moves the file in a place where it can be accessed. Fixes: nodejs#1526 Signed-off-by: Paul Maréchal <[email protected]>
It isn't possible to access `tools/gyp/pylib/gyp/generator/compile_commands_json.py` using the `--format` option. This commit moves the file in a place where it can be accessed. Fixes: #1526 PR-URL: #1661 Reviewed-By: Ben Noordhuis <[email protected]> Signed-off-by: Paul Maréchal <[email protected]>
For those who found this in Google, I had to add the .py suffix to the format argument, otherwise I received the error: "ImportError: No module named gyp.generator.compile_commands_json".
Here is my wrapper script which cleans up the extra compile_flags.json that are generated for each configuration (Debug, etc) and injects system header locations. It also bounces clangd to pull in the new manifest. #!/bin/sh
node-gyp configure --release -- -f gyp.generator.compile_commands_json.py
mv Release/compile_commands.json ./
rmdir Release
EXTRA=$(ls */compile_commands.json)
echo "$EXTRA" | xargs rm
echo "$EXTRA" | xargs -n1 dirname | xargs rmdir
ESCAPED_FLAGS=$(echo | cc -Wp,-v -x c++ - -fsyntax-only 2>&1 | \
egrep '^ /' | sed 's/(framework directory)//' | \
sed 's/^ /-isystem/' | perl -pe 's/\//\\\//g' | tr '\n' ' ')
perl -i -pe 's/ -c / '"$ESCAPED_FLAGS"' -c /;' compile_commands.json
killall clangd |
Running
|
I somehow keep ending up here through Google. A command that actually works with the latest node-gyp is:
|
This is more of a question than an issue, so, sorry if this is not the correct place to ask
I'm trying to configure VsCode for intelliSense while creating a Node.js native module, and for that it's interesting to have a
compile_commands.json
file (from official cpp extension documentation), I saw that a generator for that was added some days ago, here 5c2aad8So my question is, how I can use it?
The text was updated successfully, but these errors were encountered: