aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-06-05 16:17:32 +0200
committerlonkaars <loek@pipeframe.xyz>2022-06-05 16:17:32 +0200
commitfa6af27248ec1fcbfdec433ea16154b7bdae045f (patch)
tree235c9a780abddca59f218d08387e2b7fd1afeb0f
parent1f8a640303976ddcc3605a9b6af8fb398dc7c300 (diff)
fix windows compatibility
-rw-r--r--client/makefile4
-rw-r--r--client/serial_win32.c19
-rw-r--r--client/time_windows.c15
-rw-r--r--scripts/install-mingw-packages.sh2
-rw-r--r--scripts/patch-june-5.sh3
5 files changed, 37 insertions, 6 deletions
diff --git a/client/makefile b/client/makefile
index e48eaeb..a23ce4f 100644
--- a/client/makefile
+++ b/client/makefile
@@ -13,13 +13,15 @@ SOURCES := $(wildcard *.c)
HEADERS := $(wildcard *.h)
include ../shared/makefile
+CFLAGS += $(if $(WIN32),-I/mingw64/include/ncursesw,)
+
OBJECTS := $(patsubst %.c,%.o, $(SOURCES))
.o:
$(CC) -c $(CFLAGS) $<
$(EXECNAME): $(OBJECTS)
- $(CC) $(LDFLAGS) $(OBJECTS) -o $(EXECNAME)
+ $(CC) $(OBJECTS) -o $(EXECNAME) $(LDFLAGS)
clean::
$(RM) $(EXECNAME) *.o
diff --git a/client/serial_win32.c b/client/serial_win32.c
index 9406a34..edc9db1 100644
--- a/client/serial_win32.c
+++ b/client/serial_win32.c
@@ -2,9 +2,20 @@
#include "serial.h"
-bool w2_serial_read(uint8_t *target, uint8_t bytes);
-bool w2_serial_write(uint8_t *target, uint8_t bytes);
-void w2_serial_open();
-void w2_serial_close();
+int w2_serial_read() {
+ return 0x00;
+}
+
+bool w2_serial_write(char *data, uint8_t length) {
+ return true;
+}
+
+bool w2_serial_open(const char *port_name) {
+ return true;
+}
+
+void w2_serial_close() {
+ return;
+}
#endif
diff --git a/client/time_windows.c b/client/time_windows.c
new file mode 100644
index 0000000..f9082d6
--- /dev/null
+++ b/client/time_windows.c
@@ -0,0 +1,15 @@
+#ifdef W2_HOST_WIN32
+
+#include "time.h"
+
+unsigned long w2_get_time() {
+ return 0;
+}
+
+void w2_timer_start(w2_e_client_timers label) { g_w2_client_timers[label] = w2_get_time(); }
+
+unsigned long w2_timer_end(w2_e_client_timers label) {
+ return w2_get_time() - g_w2_client_timers[label];
+}
+
+#endif
diff --git a/scripts/install-mingw-packages.sh b/scripts/install-mingw-packages.sh
index fd82909..e1c000c 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 python3 python3-pip
+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 ncurses mingw-w64-x86_64-ncurses
diff --git a/scripts/patch-june-5.sh b/scripts/patch-june-5.sh
new file mode 100644
index 0000000..cad705a
--- /dev/null
+++ b/scripts/patch-june-5.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pacman --noconfirm -Sy ncurses mingw-w64-x86_64-ncurses