-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add c_cpp_properties.json and its checker
- Loading branch information
Showing
4 changed files
with
212 additions
and
1 deletion.
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
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,144 @@ | ||
{ | ||
// https://support.arduino.cc/hc/en-us/articles/4415103213714-Find-sketches-libraries-board-cores-and-other-files-on-your-computer# | ||
"env": { | ||
"coreVersion": "2.0.11" | ||
}, | ||
"configurations": [ | ||
{ | ||
"name": "Linux", | ||
"includePath": [ | ||
"~/Arduino/libraries/**", | ||
"~/.arduino15/packages/esp32/hardware/esp32/${coreVersion}/variants/d1_mini32", | ||
"~/.arduino15/packages/esp32/hardware/esp32/${coreVersion}/libraries/**", | ||
"~/.arduino15/packages/esp32/hardware/esp32/${coreVersion}/cores/**", | ||
"~/.arduino15/packages/esp32/hardware/esp32/${coreVersion}/tools/sdk/esp32/**", | ||
"${workspaceFolder}/flix" | ||
], | ||
"forcedInclude": [ | ||
"${workspaceFolder}/.vscode/intellisense.h", | ||
"~/.arduino15/packages/esp32/hardware/esp32/${coreVersion}/cores/esp32/Arduino.h", | ||
"~/.arduino15/packages/esp32/hardware/esp32/${coreVersion}/variants/d1_mini32/pins_arduino.h", | ||
"${workspaceFolder}/flix/cli.ino", | ||
"${workspaceFolder}/flix/control.ino", | ||
"${workspaceFolder}/flix/estimate.ino", | ||
"${workspaceFolder}/flix/flix.ino", | ||
"${workspaceFolder}/flix/imu.ino", | ||
"${workspaceFolder}/flix/led.ino", | ||
"${workspaceFolder}/flix/log.ino", | ||
"${workspaceFolder}/flix/mavlink.ino", | ||
"${workspaceFolder}/flix/motors.ino", | ||
"${workspaceFolder}/flix/rc.ino", | ||
"${workspaceFolder}/flix/time.ino", | ||
"${workspaceFolder}/flix/util.ino", | ||
"${workspaceFolder}/flix/wifi.ino" | ||
], | ||
"browse": { | ||
"path": [ | ||
"~/.arduino15/packages/esp32/hardware/esp32/${coreVersion}/cores/esp32/", | ||
"~/.arduino15/packages/esp32/hardware/esp32/${coreVersion}/libraries", | ||
"~/cloned/FreeRTOS-Kernel" | ||
] | ||
}, | ||
"compilerPath": "~/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/xtensa-esp32-elf-g++", | ||
"cStandard": "c11", | ||
"cppStandard": "c++17", | ||
"defines": [ | ||
"ARDUINO=10812", | ||
"ARDUINO_D1_MINI32", | ||
"ESP32", | ||
"F_CPU=240000000L" | ||
] | ||
}, | ||
{ | ||
"name": "macOS", | ||
"includePath": [ | ||
"~/Documents/Arduino/libraries/**", | ||
"~/Library/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/variants/d1_mini32", | ||
"~/Library/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/libraries/**", | ||
"~/Library/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/cores/**", | ||
"~/Library/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/tools/sdk/esp32/**", | ||
"${workspaceFolder}/flix" | ||
], | ||
"forcedInclude": [ | ||
"${workspaceFolder}/.vscode/intellisense.h", | ||
"~/Library/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/cores/esp32/Arduino.h", | ||
"~/Library/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/variants/d1_mini32/pins_arduino.h", | ||
"${workspaceFolder}/flix/cli.ino", | ||
"${workspaceFolder}/flix/control.ino", | ||
"${workspaceFolder}/flix/estimate.ino", | ||
"${workspaceFolder}/flix/flix.ino", | ||
"${workspaceFolder}/flix/imu.ino", | ||
"${workspaceFolder}/flix/led.ino", | ||
"${workspaceFolder}/flix/log.ino", | ||
"${workspaceFolder}/flix/mavlink.ino", | ||
"${workspaceFolder}/flix/motors.ino", | ||
"${workspaceFolder}/flix/rc.ino", | ||
"${workspaceFolder}/flix/time.ino", | ||
"${workspaceFolder}/flix/util.ino", | ||
"${workspaceFolder}/flix/wifi.ino" | ||
], | ||
"browse": { | ||
"path": [ | ||
"~/Library/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/cores/esp32/", | ||
"~/Library/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/libraries", | ||
"~/cloned/FreeRTOS-Kernel" | ||
] | ||
}, | ||
"compilerPath": "~/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/xtensa-esp32-elf-g++", | ||
"cStandard": "c11", | ||
"cppStandard": "c++17", | ||
"defines": [ | ||
"ARDUINO=10812", | ||
"ARDUINO_D1_MINI32", | ||
"ESP32", | ||
"F_CPU=240000000L" | ||
] | ||
}, | ||
{ | ||
"name": "Windows", | ||
"includePath": [ | ||
"~/Documents/Arduino/libraries/**", | ||
"~/AppData/Local/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/variants/d1_mini32", | ||
"~/AppData/Local/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/libraries/**", | ||
"~/AppData/Local/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/cores/**", | ||
"~/AppData/Local/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/tools/sdk/esp32/**", | ||
"${workspaceFolder}/flix" | ||
], | ||
"forcedInclude": [ | ||
"${workspaceFolder}/.vscode/intellisense.h", | ||
"~/AppData/Local/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/cores/esp32/Arduino.h", | ||
"~/AppData/Local/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/variants/d1_mini32/pins_arduino.h", | ||
"${workspaceFolder}/flix/cli.ino", | ||
"${workspaceFolder}/flix/control.ino", | ||
"${workspaceFolder}/flix/estimate.ino", | ||
"${workspaceFolder}/flix/flix.ino", | ||
"${workspaceFolder}/flix/imu.ino", | ||
"${workspaceFolder}/flix/led.ino", | ||
"${workspaceFolder}/flix/log.ino", | ||
"${workspaceFolder}/flix/mavlink.ino", | ||
"${workspaceFolder}/flix/motors.ino", | ||
"${workspaceFolder}/flix/rc.ino", | ||
"${workspaceFolder}/flix/time.ino", | ||
"${workspaceFolder}/flix/util.ino", | ||
"${workspaceFolder}/flix/wifi.ino" | ||
], | ||
"browse": { | ||
"path": [ | ||
"~/AppData/Local/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/cores/esp32/", | ||
"~/AppData/Local/Arduino15/packages/esp32/hardware/esp32/${coreVersion}/libraries", | ||
"~/cloned/FreeRTOS-Kernel" | ||
] | ||
}, | ||
"compilerPath": "~/AppData/Local/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0/bin/xtensa-esp32-elf-g++.exe", | ||
"cStandard": "c11", | ||
"cppStandard": "c++17", | ||
"defines": [ | ||
"ARDUINO=10812", | ||
"ARDUINO_D1_MINI32", | ||
"ESP32", | ||
"F_CPU=240000000L" | ||
] | ||
} | ||
], | ||
"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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#ifdef __INTELLISENSE__ | ||
#pragma diag_suppress 144, 513 | ||
// diag 144: a value of type "enum <unnamed>" cannot be used to initialize an entity of type "enum <unnamed>"C/C++ | ||
// diag 513: a value of type "enum <unnamed>" cannot be assigned to an entity of type "enum <unnamed>"C/C++ | ||
#endif |
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,49 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import platform | ||
import json5 | ||
|
||
|
||
props = json5.load(open('.vscode/c_cpp_properties.git.json')) | ||
|
||
env = props.get('env', {}) | ||
env['workspaceFolder'] = '.' | ||
|
||
def abspath(s): | ||
# replace env | ||
for key, value in env.items(): | ||
s = s.replace('${' + key + '}', value) | ||
# remove globs from the end | ||
if s.endswith('**'): | ||
s = s[:-2] | ||
elif s.endswith('*'): | ||
s = s[:-1] | ||
return os.path.expanduser(s) | ||
|
||
# linux, macos or windows: | ||
platform = platform.system().lower() | ||
if platform == 'darwin': | ||
platform = 'macos' | ||
elif platform == 'linux' or platform == 'windows': | ||
pass | ||
else: | ||
raise Exception('Unknown platform: ' + platform) | ||
|
||
for configuration in props['configurations']: | ||
if platform not in configuration['name'].lower(): | ||
print('Skip', configuration['name']) | ||
continue | ||
|
||
print('Check configuration', configuration['name']) | ||
|
||
for include_path in configuration.get('includePath', []): | ||
assert os.path.exists(abspath(include_path)), include_path | ||
|
||
for forced_include in configuration.get('forcedInclude', []): | ||
assert os.path.exists(abspath(forced_include)), forced_include | ||
|
||
for browse in configuration.get('browse', {}).get('path', []): | ||
assert os.path.exists(abspath(browse)), browse | ||
|
||
assert os.path.exists(abspath(configuration.get('compilerPath', '~'))), configuration.get('compilerPath') |