forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve VS Code with GN build (project-chip#1878)
* Fix VSCode problem matcher for GN GN runs the compiler in the build directory, so add that as the base path for the VSCode task. * Copy Nordic SDK into vscode container This is not currently included in the devcontainer. Add it by copying it from the chip-build-nrf-platform container. * Configure VS Code C/C++ extension to use GN compilation database This fixes include paths & #defines to enable the richer IntelliSense features of VS Code. Usage: - Run Task: Update Compilation Database - Control-Shift-P -> C/C++ - Select a Configuration.
- Loading branch information
Showing
4 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "gcc debug (GN)", | ||
"compileCommands": "${workspaceFolder}/out/debug/compile_commands.gcc.json", | ||
"compilerPath": "/usr/bin/gcc", | ||
"cStandard": "c11", | ||
"cppStandard": "c++11", | ||
"intelliSenseMode": "gcc-x64", | ||
"browse": { | ||
"path": ["${workspaceFolder}/out/debug/"], | ||
"limitSymbolsToIncludedHeaders": true | ||
} | ||
}, | ||
{ | ||
"name": "clang debug (GN)", | ||
"compileCommands": "${workspaceFolder}/out/debug/compile_commands.clang.json", | ||
"compilerPath": "/usr/bin/clang", | ||
"cStandard": "c11", | ||
"cppStandard": "c++11", | ||
"intelliSenseMode": "clang-x64", | ||
"browse": { | ||
"path": ["${workspaceFolder}/out/debug/"], | ||
"limitSymbolsToIncludedHeaders": true | ||
} | ||
}, | ||
{ | ||
"name": "gcc MbedTLS debug (GN)", | ||
"compileCommands": "${workspaceFolder}/out/debug/compile_commands.mbedtls.json", | ||
"compilerPath": "/usr/bin/gcc", | ||
"cStandard": "c11", | ||
"cppStandard": "c++11", | ||
"intelliSenseMode": "gcc-x64", | ||
"browse": { | ||
"path": ["${workspaceFolder}/out/debug/"], | ||
"limitSymbolsToIncludedHeaders": true | ||
} | ||
}, | ||
{ | ||
"name": "nRF5 examples debug (GN)", | ||
"cStandard": "c11", | ||
"cppStandard": "c++11", | ||
"intelliSenseMode": "gcc-x64", | ||
"compileCommands": "${workspaceFolder}/out/debug/compile_commands.nrf5.json", | ||
"compilerPath": "/var/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc", | ||
"browse": { | ||
"path": ["${workspaceFolder}/out/debug/"], | ||
"limitSymbolsToIncludedHeaders": true | ||
} | ||
} | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
ARG VERSION=latest | ||
FROM connectedhomeip/chip-build:${VERSION} | ||
FROM connectedhomeip/chip-build-nrf-platform:${VERSION} | ||
FROM connectedhomeip/chip-build-nrf-platform:${VERSION} AS nrf | ||
FROM connectedhomeip/chip-build-esp32:${VERSION} | ||
FROM connectedhomeip/chip-build-esp32-qemu:${VERSION} | ||
COPY --from=nrf /var/nRF5_tools /var/nRF5_tools | ||
COPY --from=nrf /var/nRF5_SDK_for_Thread_and_Zigbee /var/nRF5_SDK_for_Thread_and_Zigbee | ||
COPY --from=nrf /var/gcc-arm-none-eabi-9-2019-q4-major /var/gcc-arm-none-eabi-9-2019-q4-major | ||
ENV NRF5_SDK_ROOT=/var/nRF5_SDK_for_Thread_and_Zigbee | ||
ENV NRF5_TOOLS_ROOT=/var/nRF5_tools | ||
ENV ARM_GCC_INSTALL_ROOT=/var/gcc-arm-none-eabi-9-2019-q4-major/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright (c) 2020 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# Update compilation database in VS Code devcontainer. | ||
|
||
set -e | ||
|
||
CHIP_ROOT="$(dirname "$0")/../.." | ||
|
||
set +e | ||
source "$CHIP_ROOT/scripts/activate.sh" | ||
set -e | ||
|
||
gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --export-compile-commands=all_host_gcc | ||
mv "$CHIP_ROOT/out/debug/compile_commands.json" "$CHIP_ROOT/out/debug/compile_commands.gcc.json" | ||
|
||
gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --export-compile-commands=all_host_clang | ||
mv "$CHIP_ROOT/out/debug/compile_commands.json" "$CHIP_ROOT/out/debug/compile_commands.clang.json" | ||
|
||
gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --export-compile-commands=all_host_gcc_mbedtls | ||
mv "$CHIP_ROOT/out/debug/compile_commands.json" "$CHIP_ROOT/out/debug/compile_commands.mbedtls.json" | ||
|
||
gn --root="$CHIP_ROOT" gen "$CHIP_ROOT/out/debug" --export-compile-commands=nrf5_lock_app,nrf5_lighting_app | ||
mv "$CHIP_ROOT/out/debug/compile_commands.json" "$CHIP_ROOT/out/debug/compile_commands.nrf5.json" |