Skip to content

build: fix waf generation of compile_commands.json#37

Closed
BogdanOlar wants to merge 0 commit intopebble-dev:mainfrom
BogdanOlar:main
Closed

build: fix waf generation of compile_commands.json#37
BogdanOlar wants to merge 0 commit intopebble-dev:mainfrom
BogdanOlar:main

Conversation

@BogdanOlar
Copy link

@BogdanOlar BogdanOlar commented Feb 14, 2025

Fix waf generation of compile_commands.json when the --compile_commands config option is specified. For example, when configuring and then building with:

./waf configure --board asterix_vla_dvb1 --nojs --compile_commands
./waf build

I've adapted the workaround already used in sdk/waf/waflib/extras/clang_compilation_database.py, which runs each task with a temporarily disabled exec_command in order to obtain the task's last_cmd.

When generating the compile_commands.json the commands field has been replaced with arguments, since the database documentation mentions that it is preferred.

Either arguments or command is required. arguments is preferred, as shell (un)escaping is a possible source of errors.

Tested on Fedora 41, in VSCode, using the following c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Linux",
            "compilerPath": "/home/bogdan/Programs/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc",
            "compileCommands": [
                "${workspaceFolder}/compile_commands.json"
            ],
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-arm"
        }
    ],
    "version": 4
}

@gmarull
Copy link
Collaborator

gmarull commented Feb 17, 2025

Please make sure to adjust commits following requirements in .gitlint. See #20

@BogdanOlar BogdanOlar changed the title Fix waf generation of compile_commands.json build: fix waf generation of compile_commands.json Feb 17, 2025
@BogdanOlar BogdanOlar closed this Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants