summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-26 21:52:30 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-26 21:52:30 +0200
commitedfa25fcd8edad43998f50a2144d30a6f966c1c8 (patch)
treee820241e6983bf314ba312c7fb3ed8d6ae55cbbb
parent266fd5ef0c45315fc0bf281a15630a9b4765e68c (diff)
fix configuration on windows
-rw-r--r--.vscode/c_cpp_properties.json21
-rw-r--r--.vscode/tasks.json43
-rw-r--r--client/makefile2
-rw-r--r--robot/makefile6
-rw-r--r--scripts/install-mingw-packages.sh2
-rwxr-xr-xscripts/install-sdk.sh2
-rw-r--r--scripts/patch-may-26.sh4
-rw-r--r--shared/consts.h5
-rw-r--r--shared/makefile13
9 files changed, 78 insertions, 20 deletions
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
new file mode 100644
index 0000000..0415e98
--- /dev/null
+++ b/.vscode/c_cpp_properties.json
@@ -0,0 +1,21 @@
+{
+ "configurations": [
+ {
+ "name": "Win32",
+ "includePath": [
+ "${workspaceFolder}/**",
+ "C:/msys64/mingw64/avr/include"
+ ],
+ "defines": [
+ "_DEBUG",
+ "UNICODE",
+ "_UNICODE"
+ ],
+ "compilerPath": "C:\\msys64\\mingw64\\bin\\gcc.exe",
+ "cStandard": "gnu17",
+ "cppStandard": "gnu++17",
+ "intelliSenseMode": "windows-gcc-x64"
+ }
+ ],
+ "version": 4
+} \ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 251c67d..52ccd17 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -1,8 +1,12 @@
{
"version": "2.0.0",
- "command": "C:/msys64/usr/bin/sh.exe",
- "options": { "cwd": "${workspaceFolder}" },
- "args": [ "-c" ],
+ "options": {
+ "cwd": "${workspaceFolder}",
+ "shell": {
+ "executable": "C:/msys64/msys2_shell.cmd",
+ "args": [ "-defterm", "-no-start", "-mingw64", "-shell", "sh", "-here", "-c" ],
+ }
+ },
"tasks": [
{
"label": "build client",
@@ -10,8 +14,9 @@
"isDefault": false,
"kind": "build"
},
- "args": [ "make", "-C", "client" ],
- "command": "",
+ "command": "make",
+ "args": [ "" ],
+ "options": { "cwd": "${workspaceFolder}/client" },
"type": "shell"
},
{
@@ -20,8 +25,9 @@
"isDefault": false,
"kind": "build"
},
- "args": [ "make", "-C", "robot" ],
- "command": "",
+ "options": { "cwd": "${workspaceFolder}/robot" },
+ "command": "make",
+ "args": [ "" ],
"type": "shell"
},
{
@@ -30,8 +36,9 @@
"isDefault": false,
"kind": "test"
},
- "args": [ "make", "flash", "-C", "robot" ],
- "command": "",
+ "options": { "cwd": "${workspaceFolder}/robot" },
+ "command": "make flash",
+ "args": [ "" ],
"type": "shell"
},
{
@@ -40,8 +47,8 @@
"isDefault": false,
"kind": "none"
},
- "args": [ "make", "clean" ],
- "command": "",
+ "command": "make clean",
+ "args": [ "" ],
"type": "shell"
},
{
@@ -50,8 +57,18 @@
"isDefault": false,
"kind": "none"
},
- "args": [ "make", "format" ],
- "command": "",
+ "command": "make format",
+ "args": [ "" ],
+ "type": "shell"
+ },
+ {
+ "label": "generate compilation db (needed for autocomplete)",
+ "group": {
+ "isDefault": false,
+ "kind": "build"
+ },
+ "command": "make compile_commands",
+ "args": [ "" ],
"type": "shell"
},
]
diff --git a/client/makefile b/client/makefile
index 4cca15a..f79dd11 100644
--- a/client/makefile
+++ b/client/makefile
@@ -25,5 +25,5 @@ format:
clang-tidy --fix-errors $(SOURCES) $(HEADERS)
compile_commands: clean
- bear -- make
+ compiledb make
diff --git a/robot/makefile b/robot/makefile
index 4039ae3..85ed2e3 100644
--- a/robot/makefile
+++ b/robot/makefile
@@ -30,10 +30,6 @@ AVRDUDE=avrdude
CC=$(PREFIX)gcc
OBJ2HEX=$(PREFIX)objcopy
-# debug build info string
-BUILD_STR=$(shell git update-index -q --refresh; git describe --tags --dirty='*' --broken='x' | cut -c1-20)
-CFLAGS += -DW2_BUILD_STR=\"$(BUILD_STR)\"
-
clean::
rm -f *.o out.hex a.out
@@ -57,4 +53,4 @@ format:
clang-tidy --fix-errors $(SOURCES) $(HEADERS)
compile_commands: clean
- bear -- make
+ compiledb make
diff --git a/scripts/install-mingw-packages.sh b/scripts/install-mingw-packages.sh
index c847e4e..fd82909 100644
--- a/scripts/install-mingw-packages.sh
+++ b/scripts/install-mingw-packages.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-pacman --noconfirm -Sy make git unzip mingw-w64-x86_64-avr-toolchain mingw-w64-x86_64-toolchain mingw-w64-clang-x86_64-clang mingw-w64-x86_64-avrdude
+pacman --noconfirm -Sy make git unzip mingw-w64-x86_64-avr-toolchain mingw-w64-x86_64-toolchain mingw-w64-clang-x86_64-clang mingw-w64-x86_64-avrdude python3 python3-pip
diff --git a/scripts/install-sdk.sh b/scripts/install-sdk.sh
index 4773186..0cc651a 100755
--- a/scripts/install-sdk.sh
+++ b/scripts/install-sdk.sh
@@ -36,3 +36,5 @@ fi
cd ..
rm -rf temp
+
+pip3 install compiledb
diff --git a/scripts/patch-may-26.sh b/scripts/patch-may-26.sh
new file mode 100644
index 0000000..d5b41c7
--- /dev/null
+++ b/scripts/patch-may-26.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+pacman --noconfirm -Sy python3 python3-pip
+pip3 install compiledb
diff --git a/shared/consts.h b/shared/consts.h
index c65e50f..70ab5b2 100644
--- a/shared/consts.h
+++ b/shared/consts.h
@@ -5,6 +5,11 @@
#define W2_BUILD_STR ("????????")
#endif
+#if !defined W2_HOST_WIN32 && !defined W2_HOST_LINUX
+#define W2_HOST_UNKNOWN
+#warning "host operating system unknown"
+#endif
+
/** max logic module execution time in milliseconds */
#define W2_MAX_MODULE_CYCLE_MS (20)
/** serial baud rate (bit/s) */
diff --git a/shared/makefile b/shared/makefile
index cfdf8ac..7f0ceb9 100644
--- a/shared/makefile
+++ b/shared/makefile
@@ -1,5 +1,18 @@
SOURCES += $(wildcard ../shared/*.c)
HEADERS += $(wildcard ../shared/*.h)
+# debug build info string
+BUILD_STR=$(shell git update-index -q --refresh; git describe --tags --dirty='*' --broken='x' | cut -c1-20)
+CFLAGS += -DW2_BUILD_STR=\"$(BUILD_STR)\"
+
+# os info
+OS=$(strip $(shell uname -o))
+ifeq ($(OS),GNU/Linux)
+CFLAGS += -DW2_HOST_LINUX
+endif
+ifeq ($(OS),Msys)
+CFLAGS += -DW2_HOST_WIN32
+endif
+
clean::
rm -f ../shared/*.o