Skip to content

Commit

Permalink
[tools]: fix the issue of missing commands in compile_commands.json
Browse files Browse the repository at this point in the history
  • Loading branch information
aka-adi committed Jan 2, 2025
1 parent d57b7cb commit 7a4ec25
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,11 @@ def local_group(group, objects):

break
else:
# generate build/compile_commands.json
if GetOption('cdb') and utils.VerTuple(SCons.__version__) >= (4, 0, 0):
Env.Tool("compilation_db")
Env.CompilationDatabase('build/compile_commands.json')

# remove source files with local flags setting
for group in Projects:
if 'LOCAL_CFLAGS' in group or 'LOCAL_CXXFLAGS' in group or 'LOCAL_CCFLAGS' in group or 'LOCAL_CPPPATH' in group or 'LOCAL_CPPDEFINES' in group:
Expand All @@ -843,11 +848,6 @@ def local_group(group, objects):
objects = sorted(objects)
objects.append(objects_in_group)

# generate build/compile_commands.json
if GetOption('cdb') and utils.VerTuple(SCons.__version__) >= (4, 0, 0):
Env.Tool("compilation_db")
Env.CompilationDatabase('build/compile_commands.json')

program = Env.Program(target, objects)

EndBuilding(target, program)
Expand Down

0 comments on commit 7a4ec25

Please sign in to comment.