8 cd "$(dirname "$0")"/../.. ||
9 die "Could not cd to top-level directory"
12 die "Could not create .vscode/"
16 cat >.vscode/settings.json <<\EOF ||
18 "C_Cpp.intelliSenseEngine": "Default",
19 "C_Cpp.intelliSenseEngineFallback": "Disabled",
20 "files.associations": {
26 die "Could not write settings.json"
28 # Infer some setup-specific locations/names
30 GCCPATH="$(which gcc)"
31 GDBPATH="$(which gdb)"
32 MAKECOMMAND="make -j5 DEVELOPER=1"
37 GCCPATH="$(cygpath -am "$GCCPATH")"
38 GDBPATH="$(cygpath -am "$GDBPATH")"
39 MAKE_BASH="$(cygpath -am /git-cmd.exe) --command=usr\\\\bin\\\\bash.exe"
40 MAKECOMMAND="$MAKE_BASH -lc \\\"$MAKECOMMAND\\\""
54 cat >.vscode/tasks.json <<EOF ||
56 // See https://go.microsoft.com/fwlink/?LinkId=733558
57 // for the documentation about the tasks.json format
63 "command": "$MAKECOMMAND",
72 die "Could not install default build task"
76 cat >.vscode/launch.json <<EOF ||
78 // Use IntelliSense to learn about possible attributes.
79 // Hover to view descriptions of existing attributes.
80 // For more information, visit:
81 // https://go.microsoft.com/fwlink/?linkid=830387
85 "name": "(gdb) Launch",
88 "program": "\${workspaceFolder}/git$X",
91 "cwd": "\${workspaceFolder}",
93 "externalConsole": true,
95 "miDebuggerPath": "$GDBPATH",
98 "description": "Enable pretty-printing for gdb",
99 "text": "-enable-pretty-printing",
100 "ignoreFailures": true
107 die "Could not write launch configuration"
109 # C/C++ extension settings
111 make -f - OSNAME=$OSNAME GCCPATH="$GCCPATH" vscode-init \
112 >.vscode/c_cpp_properties.json <<\EOF ||
116 @mkdir -p .vscode && \
118 for e in $(ALL_CFLAGS); do \
121 incs="$$(printf '% 16s"$${workspaceRoot}",\n%s' \
125 incs="$$(printf '% 16s"%s",\n%s' \
126 "" "$${e#-I}" "$$incs")" \
129 incs="$$(printf '% 16s"$${workspaceRoot}/%s",\n%s' \
130 "" "$${e#-I}" "$$incs")" \
133 defs="$$(printf '% 16s"%s",\n%s' \
134 "" "$$(echo "$${e#-D}" | sed 's/"/\\&/g')" \
140 echo ' "configurations": [' && \
142 echo ' "name": "$(OSNAME)",' && \
143 echo ' "intelliSenseMode": "clang-x64",' && \
144 echo ' "includePath": [' && \
145 echo "$$incs" | sort | sed '$$s/,$$//' && \
147 echo ' "defines": [' && \
148 echo "$$defs" | sort | sed '$$s/,$$//' && \
150 echo ' "browse": {' && \
151 echo ' "limitSymbolsToIncludedHeaders": true,' && \
152 echo ' "databaseFilename": "",' && \
153 echo ' "path": [' && \
154 echo ' "$${workspaceRoot}"' && \
157 echo ' "cStandard": "c11",' && \
158 echo ' "cppStandard": "c++17",' && \
159 echo ' "compilerPath": "$(GCCPATH)"' && \
162 echo ' "version": 4' && \
165 die "Could not write settings for the C/C++ extension"