Skip to content
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

build: Add the option to generate compile_commands.json on Windows via vcbuild.bat #52279

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2308,8 +2308,9 @@ def make_bin_override():

if options.compile_commands_json:
gyp_args += ['-f', 'compile_commands_json']
os.path.islink('./compile_commands.json') and os.unlink('./compile_commands.json')
os.symlink('./out/' + config['BUILDTYPE'] + '/compile_commands.json', './compile_commands.json')
if sys.platform != 'win32':
os.path.lexists('./compile_commands.json') and os.unlink('./compile_commands.json')
os.symlink('./out/' + config['BUILDTYPE'] + '/compile_commands.json', './compile_commands.json')

# pass the leftover non-whitespace positional arguments to GYP
gyp_args += [arg for arg in args if not str.isspace(arg)]
Expand All @@ -2319,4 +2320,7 @@ def make_bin_override():

print_verbose("running: \n " + " ".join(['python', 'tools/gyp_node.py'] + gyp_args))
run_gyp(gyp_args)
if options.compile_commands_json and sys.platform == 'win32':
os.path.isfile('./compile_commands.json') and os.unlink('./compile_commands.json')
shutil.copy2('./out/' + config['BUILDTYPE'] + '/compile_commands.json', './compile_commands.json')
anonrig marked this conversation as resolved.
Show resolved Hide resolved
anonrig marked this conversation as resolved.
Show resolved Hide resolved
info('configure completed successfully')
3 changes: 3 additions & 0 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ set openssl_no_asm=
set no_shared_roheap=
set doc=
set extra_msbuild_args=
set compile_commands=
set exit_code=0

:next-arg
Expand Down Expand Up @@ -145,6 +146,7 @@ if /i "%1"=="openssl-no-asm" set openssl_no_asm=1&goto arg-ok
if /i "%1"=="no-shared-roheap" set no_shared_roheap=1&goto arg-ok
if /i "%1"=="doc" set doc=1&goto arg-ok
if /i "%1"=="binlog" set extra_msbuild_args=/binaryLogger:out\%config%\node.binlog&goto arg-ok
if /i "%1"=="compile-commands" set compile_commands=1&goto arg-ok

echo Error: invalid command line option `%1`.
exit /b 1
Expand Down Expand Up @@ -203,6 +205,7 @@ if defined debug_nghttp2 set configure_flags=%configure_flags% --debug-nghttp
if defined openssl_no_asm set configure_flags=%configure_flags% --openssl-no-asm
if defined no_shared_roheap set configure_flags=%configure_flags% --disable-shared-readonly-heap
if defined DEBUG_HELPER set configure_flags=%configure_flags% --verbose
if defined compile_commands set configure_flags=%configure_flags% -C

if "%target_arch%"=="x86" (
echo "32-bit Windows builds are not supported anymore."
Expand Down
Loading