From 6bae80bdf97eb1a23f1a818f6428af65cf2cfac5 Mon Sep 17 00:00:00 2001 From: Bart Trzynadlowski Date: Fri, 9 Aug 2024 22:30:50 -0700 Subject: [PATCH] Makefile.Win32: Fixed SDL2 flags when building in MSYS --- Makefiles/Makefile.Win32 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefiles/Makefile.Win32 b/Makefiles/Makefile.Win32 index f86b6e4..5ece182 100644 --- a/Makefiles/Makefile.Win32 +++ b/Makefiles/Makefile.Win32 @@ -83,15 +83,16 @@ endif # SDL2 # ifneq (,$(findstring cmd.exe,$(shell echo %COMSPEC%))) - # When building in Command Prompt, we don't have sdl2-config and must hard-code the SDL2 include - # and library directories - SDL2_INCLUDE_DIR = \msys64\mingw64\include\SDL2 - SDL2_LIB_DIR = \msys64\mingw64\lib - SDL2_LIBS = -lmingw32 -lSDL2main -lSDL2 -Wl,--no-undefined -lshell32 -lsetupapi -ladvapi32 -luuid -lversion -limm32 -lwinmm -lgdi32 -luser32 -lm -pipe - SDL2_CFLAGS = + # When building in Command Prompt, we don't have sdl2-config and must hard-code the SDL2 include + # and library directories + SDL2_INCLUDE_DIR = \msys64\mingw64\include\SDL2 + SDL2_LIB_DIR = \msys64\mingw64\lib + SDL2_LIBS = -lmingw32 -lSDL2main -lSDL2 -Wl,--no-undefined -lshell32 -lsetupapi -ladvapi32 -luuid -lversion -limm32 -lwinmm -lgdi32 -luser32 -lm -pipe + SDL2_CFLAGS = else - SDL2_LIBS = `sdl2-config --static-libs` - SDL2_CFLAGS = `sdl2-config --cflags | sed 's/-Dmain=SDL_main//'` + # Must strip out -mwindows so we don't create a GUI app (will not work in Command Prompt) + SDL2_LIBS = $(shell sdl2-config --static-libs | sed 's/-mwindows//g') + SDL2_CFLAGS = $(shell sdl2-config --cflags) endif ifeq ($(strip $(NET_BOARD)),1) SDL2_LIBS += -lSDL2_net -liphlpapi @@ -134,4 +135,4 @@ clean: $(OBJ_DIR)/SupermodelResources.o: Src/OSD/Windows/SupermodelResources.rc Src/OSD/Windows/SupermodelManifest.xml | $(OBJ_DIR) $(info Compiling : $< -> $@) - $(SILENT)windres -i Src/OSD/Windows/SupermodelResources.rc -o $@ \ No newline at end of file + $(SILENT)windres -i Src/OSD/Windows/SupermodelResources.rc -o $@