-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup-vscode
More file actions
executable file
·77 lines (69 loc) · 1.59 KB
/
setup-vscode
File metadata and controls
executable file
·77 lines (69 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
set -eu
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
cd "$SCRIPT_DIR"
require() {
if ! command -v "$1" >/dev/null 2>&1; then
echo "Error: required tool '$1' not found in PATH" >&2
exit 1
fi
}
require gdb-multiarch
require clang-format
require cmake
require ninja
require clang
require gcc
VSCODEDIR=.vscode
if [ ! -d "$VSCODEDIR" ]; then
mkdir -p "$VSCODEDIR"
cat <<EOMextensions > "$VSCODEDIR/extensions.json"
{
"recommendations": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode-remote.vscode-remote-extensionpack",
"github.vscode-pull-request-github"
]
}
EOMextensions
cat <<EOMsettings > "$VSCODEDIR/settings.json"
{
"editor.formatOnSave": true,
"C_Cpp.clang_format_path": "/usr/bin/clang-format",
"cmake.useCMakePresets": "always",
"cmake.buildBeforeRun": false,
"cmake.debugConfig": {
"stopAtEntry": false,
"cwd": "\${command:cmake.launchTargetDirectory}",
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "\${env:HOME}/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
"files.exclude": {
"**/.git/**": true,
"**/build/**": true
},
"files.watcherExclude": {
"**/.git/**": true,
"**/build/**": true
}
}
EOMsettings
fi
GDB_WRAPPER="$HOME/bin/gdb"
if [ ! -f "$GDB_WRAPPER" ]; then
mkdir -p "$HOME/bin"
cat <<EOMgdb > "$GDB_WRAPPER"
#!/bin/bash
sudo gdb-multiarch "\$@"
EOMgdb
chmod +x "$GDB_WRAPPER"
fi