update for PLATFORM_WEB_RGFW

This commit is contained in:
ColleagueRiley 2024-11-10 17:57:45 -05:00
parent 5a4a81b961
commit 002bb81b88
2 changed files with 26 additions and 20 deletions

View File

@ -102,7 +102,7 @@ BUILD_WEB_RESOURCES ?= TRUE
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
# Determine PLATFORM_OS when required # Determine PLATFORM_OS when required
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB)) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB PLATFORM_WEB_RGFW))
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows # ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
@ -153,7 +153,7 @@ endif
# Define raylib release directory for compiled library # Define raylib release directory for compiled library
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH ?= C:/emsdk EMSDK_PATH ?= C:/emsdk
@ -179,7 +179,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
CC = clang CC = clang
endif endif
endif endif
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM), $(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
# HTML5 emscripten compiler # HTML5 emscripten compiler
# WARNING: To compile to HTML5, code must be redesigned # WARNING: To compile to HTML5, code must be redesigned
# to use emscripten.h and emscripten_set_main_loop() # to use emscripten.h and emscripten_set_main_loop()
@ -198,7 +198,7 @@ endif
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
MAKE = mingw32-make MAKE = mingw32-make
endif endif
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
MAKE = mingw32-make MAKE = mingw32-make
else else
@ -226,11 +226,11 @@ CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
ifeq ($(BUILD_MODE),DEBUG) ifeq ($(BUILD_MODE),DEBUG)
CFLAGS += -g -D_DEBUG CFLAGS += -g -D_DEBUG
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
CFLAGS += -sASSERTIONS=1 --profiling CFLAGS += -sASSERTIONS=1 --profiling
endif endif
else else
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE) ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
CFLAGS += -O3 CFLAGS += -O3
else else
@ -320,7 +320,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
endif endif
LDFLAGS += -L$(SDL_LIBRARY_PATH) LDFLAGS += -L$(SDL_LIBRARY_PATH)
endif endif
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
# -Os # size optimization # -Os # size optimization
# -O2 # optimization level 2, if used, also set --memory-init-file 0 # -O2 # optimization level 2, if used, also set --memory-init-file 0
# -sUSE_GLFW=3 # Use glfw3 library (context/input management) # -sUSE_GLFW=3 # Use glfw3 library (context/input management)
@ -475,7 +475,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
# NOTE: Required packages: libasound2-dev (ALSA) # NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
endif endif
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
# Libraries for web (HTML5) compiling # Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
endif endif
@ -676,7 +676,7 @@ others: $(OTHERS)
%: %.c %: %.c
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
$(MAKE) -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$< $(MAKE) -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$<
else ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) else ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
$(MAKE) -f Makefile.Web $@ $(MAKE) -f Makefile.Web $@
else else
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -D$(TARGET_PLATFORM) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -D$(TARGET_PLATFORM)
@ -705,7 +705,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
find . -type f -executable -delete find . -type f -executable -delete
rm -fv *.o rm -fv *.o
endif endif
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
del *.wasm *.html *.js *.data del *.wasm *.html *.js *.data
else else

View File

@ -65,7 +65,7 @@ BUILD_WEB_HEAP_SIZE ?= 134217728
USE_WEBGL2 ?= FALSE USE_WEBGL2 ?= FALSE
# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected # Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB)) ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB, PLATFORM_WEB_RGFW))
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows # ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
@ -116,7 +116,7 @@ endif
# Define raylib release directory for compiled library # Define raylib release directory for compiled library
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH ?= C:/emsdk EMSDK_PATH ?= C:/emsdk
@ -142,7 +142,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
CC = clang CC = clang
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
# HTML5 emscripten compiler # HTML5 emscripten compiler
# WARNING: To compile to HTML5, code must be redesigned # WARNING: To compile to HTML5, code must be redesigned
# to use emscripten.h and emscripten_set_main_loop() # to use emscripten.h and emscripten_set_main_loop()
@ -161,7 +161,7 @@ endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
MAKE = mingw32-make MAKE = mingw32-make
endif endif
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
MAKE = mingw32-make MAKE = mingw32-make
else else
@ -193,7 +193,7 @@ ifeq ($(BUILD_MODE),DEBUG)
CFLAGS += -sASSERTIONS=1 --profiling CFLAGS += -sASSERTIONS=1 --profiling
endif endif
else else
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE) ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
CFLAGS += -O3 CFLAGS += -O3
else else
@ -263,7 +263,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
LDFLAGS += -Lsrc -L$(RAYLIB_LIB_PATH) LDFLAGS += -Lsrc -L$(RAYLIB_LIB_PATH)
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
# -Os # size optimization # -Os # size optimization
# -O2 # optimization level 2, if used, also set --memory-init-file 0 # -O2 # optimization level 2, if used, also set --memory-init-file 0
# -sUSE_GLFW=3 # Use glfw3 library (context/input management) # -sUSE_GLFW=3 # Use glfw3 library (context/input management)
@ -279,9 +279,15 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# --preload-file resources # specify a resources folder for data compilation # --preload-file resources # specify a resources folder for data compilation
# --source-map-base # allow debugging in browser with source map # --source-map-base # allow debugging in browser with source map
LDFLAGS += -sUSE_GLFW=3 -sEXPORTED_RUNTIME_METHODS=ccall
# Build using asyncify ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
LDFLAGS += -sUSE_GLFW=3
endif
LDFLAGS += -sEXPORTED_RUNTIME_METHODS=ccall
# Build using asyncify
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE) ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
LDFLAGS += -sASYNCIFY LDFLAGS += -sASYNCIFY
endif endif
@ -363,7 +369,7 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
# NOTE: Required packages: libasound2-dev (ALSA) # NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
# Libraries for web (HTML5) compiling # Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
endif endif
@ -1171,7 +1177,7 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
find . -type f -executable -delete find . -type f -executable -delete
rm -fv *.o rm -fv *.o
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM), PLATFORM_WEB PLATFORM_WEB_RGFW))
del *.o *.html *.js del *.o *.html *.js
endif endif
@echo Cleaning done @echo Cleaning done