commit 83254a80f36fb81d3a2077bb6eccc71902e55349
parent 62cca89a2cd03937a6ab058d4740c208e09a9927
Author: bsandro on windows <email@bsandro.tech>
Date: Sun, 31 Aug 2025 14:32:00 +0100
windows and debug build nuances added
Diffstat:
3 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/gui/Makefile b/gui/Makefile
@@ -2,9 +2,26 @@ NAME:=emote2ss_gui
SRC:=$(wildcard *.c)
DEPS:=$(wildcard ../include/*.h)
OBJ:=$(SRC:.c=.o)
-LIBS:=libwebp libwebpdemux x11 #freetype2
-CFLAGS=-O0 -g -std=c99 -DUI_LINUX -ffast-math -I. -I../include/ ${shell pkg-config --cflags $(LIBS)}
+LIBS:=libwebp libwebpdemux
+ifeq ($(OS),Windows_NT)
+else
+LIBS+=x11
+endif
+CFLAGS=-std=c99 -ffast-math -I. -I../include/ ${shell pkg-config --cflags $(LIBS)}
+ifeq ($(DEBUG),1)
+CFLAGS+=-O0 -g
+else
+CFLAGS+=-O2
+endif
LDFLAGS=-lc -lm ${shell pkg-config --libs $(LIBS)}
+ifeq ($(OS),Windows_NT)
+CFLAGS+=-DUI_WINDOWS
+LDFLAGS+=-lgdi32 -luser32 -lshell32
+else
+CFLAGS+=-DUI_LINUX
+endif
+
+$(info OS is $(OS))
all: $(NAME)
diff --git a/gui/animation.c b/gui/animation.c
@@ -11,6 +11,11 @@
#include "webp/decode.h"
#include "webp/demux.h"
+#ifdef UI_WINDOWS
+#include <windows.h>
+#include <limits.h>
+#endif
+
#ifdef __OpenBSD__
#include <sys/syslimits.h>
#endif
diff --git a/gui/main.c b/gui/main.c
@@ -4,13 +4,10 @@
#define _DEFAULT_SOURCE
-// moved into the compiler command line arguments
-// #define UI_LINUX
-
#define UI_IMPLEMENTATION
#include <stdio.h>
-#ifndef __NetBSD__
+#ifdef __linux__
#include <sys/prctl.h>
#endif
#include "webp/decode.h"
@@ -19,6 +16,10 @@
#include "animation.h"
#include "ui.h"
+#ifdef UI_WINDOWS
+#include <windows.h>
+#endif
+
#ifdef __OpenBSD__
#include <sys/syslimits.h>
#endif
@@ -47,8 +48,8 @@ int main(int argc, const char **argv) {
#else
int WinMain(HINSTANCE instance, HINSTANCE previousInstance, LPSTR commandLine, int showCommand) {
#endif
+#ifdef __linux__
// just some silly stuff, always wanted to try that
-#ifndef __NetBSD__
prctl(PR_SET_NAME, "webp-anim-to-spritesheet");
#endif
atexit(print_webp_version);