shithub: wipeout

Download patch

ref: 6fcd6697335c8180e4571e435eb68d9fc22540e7
parent: 9f0e6454bf0959bcf654a06c7d6a8cdc014ce436
author: Juan Lopez <juanantonio.lopez@gameloft.com>
date: Mon Aug 21 18:14:59 EDT 2023

Added support build on Windows under the MSYS2 enviroment.

--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,13 @@
 CC ?= gcc
 EMCC ?= emcc
 UNAME_S := $(shell uname -s)
+UNAME_O := $(shell uname -o)
 RENDERER ?= GL
 USE_GLX ?= false
 DEBUG ?= false
 
-L_FLAGS ?= -lm -rdynamic
+#L_FLAGS ?= -lm -rdynamic
+L_FLAGS ?= -lm
 C_FLAGS ?= -std=gnu99 -Wall -Wno-unused-variable
 
 ifeq ($(DEBUG), true)
@@ -36,6 +38,7 @@
 # macOS ------------------------------------------------------------------------
 
 ifeq ($(UNAME_S), Darwin)
+	C_FLAGS := $(C_FLAGS) -rdynamic
 	C_FLAGS := $(C_FLAGS) -x objective-c -I/opt/homebrew/include -D_THREAD_SAFE -w
 	L_FLAGS := $(L_FLAGS) -L/opt/homebrew/lib -framework Foundation
 
@@ -50,6 +53,7 @@
 # Linux ------------------------------------------------------------------------
 
 else ifeq ($(UNAME_S), Linux)
+	C_FLAGS := $(C_FLAGS) -rdynamic
 	ifeq ($(RENDERER), GL)
 		L_FLAGS := $(L_FLAGS) -lGLEW
 
@@ -65,12 +69,21 @@
 	L_FLAGS_SOKOL = -lX11 -lXcursor -pthread -lXi -ldl -lasound
 
 
-# Windows ----------------------------------------------------------------------
+# Windows MSYS ------------------------------------------------------------------
+else ifeq ($(UNAME_O), Msys)
+	# MSYS2 enviroment
+	ifeq ($(RENDERER), GL)
+		L_FLAGS := $(L_FLAGS) -lglew32 -lopengl32
+	endif
 
-else ifeq ($(OS), Windows_NT)
-$(error TODO: FLAGS for windows have not been set up. Please modify this makefile and send a PR!)
+	C_FLAGS := $(C_FLAGS) -DSDL_MAIN_HANDLED -D__MSYS__
+	L_FLAGS_SDL = -lSDL2 -lSDL2main
+	L_FLAGS_SOKOL = --pthread -ldl -lasound
 
 
+# Windows NON-MSYS ---------------------------------------------------------------
+else ifeq ($(OS), Windows_NT)
+	$(error TODO: FLAGS for windows have not been set up. Please modify this makefile and send a PR!)
 
 else
 $(error Unknown environment)
@@ -167,7 +180,7 @@
 		--preload-file wipeout \
 		--exclude-file wipeout/music \
 		--exclude-file wipeout/intro.mpeg
-	
+
 $(BUILD_DIR_WASM):
 	mkdir -p $(BUILD_DIR_WASM)
 
--- a/src/render_gl.c
+++ b/src/render_gl.c
@@ -11,7 +11,8 @@
 // Linux
 #elif defined(__unix__)
 	#include <GL/glew.h>
-	
+#elif defined(__MSYS__)
+	#include <GL/glew.h>
 // WINDOWS
 #else
 	#include <windows.h>