Skip to content

Commit 9805fe0

Browse files
make RGFW a custom platform (#3941)
* fix minor bugs and errors (x86) for the RGFW platform, update RGFW platform license, update makefile info for RGFW platform * revert * (RGFW) (winapi) fix mouse hide bug when cursor changes * ensure PLATFORM_SHELL is defined (PLATFORM_RGFW) --------- Co-authored-by: ColleagueRiley <ColleagueRiley@gmail.com>
1 parent fa2b1c8 commit 9805fe0

File tree

5 files changed

+7948
-7
lines changed

5 files changed

+7948
-7
lines changed

examples/Makefile

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
# - Windows (Win32, Win64)
1414
# - Linux (X11/Wayland desktop mode)
1515
# - Others (not tested)
16+
# > PLATFORM_DESKTOP_RGFW (RGFW backend):
17+
# - Windows (Win32, Win64)
18+
# - Linux (X11 desktop mode)
19+
# - macOS/OSX (x64, arm64 (not tested))
20+
# - Others (not tested)
1621
# > PLATFORM_WEB:
1722
# - HTML5 (WebAssembly)
1823
# > PLATFORM_DRM:
@@ -45,7 +50,7 @@
4550
# Define required environment variables
4651
#------------------------------------------------------------------------------------------------
4752
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DESKTOP_SDL, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
48-
PLATFORM ?= PLATFORM_DESKTOP
53+
PLATFORM ?= PLATFORM_DESKTOP_RGFW
4954

5055
# Define required raylib variables
5156
PROJECT_NAME ?= raylib_examples
@@ -86,7 +91,7 @@ BUILD_WEB_RESOURCES ?= TRUE
8691
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
8792

8893
# Determine PLATFORM_OS when required
89-
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB))
94+
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB PLATFORM_DESKTOP_RGFW))
9095
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
9196
# ifeq ($(UNAME),Msys) -> Windows
9297
ifeq ($(OS),Windows_NT)
@@ -416,6 +421,31 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
416421
LDLIBS += -latomic
417422
endif
418423
endif
424+
ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
425+
ifeq ($(PLATFORM_OS),WINDOWS)
426+
# Libraries for Windows desktop compilation
427+
LDLIBS = ..\src\libraylib.a -lgdi32 -lwinmm -lopengl32
428+
endif
429+
ifeq ($(PLATFORM_OS),LINUX)
430+
# Libraries for Debian GNU/Linux desktop compipling
431+
# NOTE: Required packages: libegl1-mesa-dev
432+
LDLIBS = ../src/libraylib.a -lGL -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -lpthread -ldl -lrt
433+
434+
# Explicit link to libc
435+
ifeq ($(RAYLIB_LIBTYPE),SHARED)
436+
LDLIBS += -lc
437+
endif
438+
439+
# NOTE: On ARM 32bit arch, miniaudio requires atomics library
440+
LDLIBS += -latomic
441+
endif
442+
ifeq ($(PLATFORM_OS),OSX)
443+
# Libraries for Debian GNU/Linux desktop compiling
444+
# NOTE: Required packages: libegl1-mesa-dev
445+
LDLIBS = ../src/libraylib.a -lm
446+
LDLIBS += -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo
447+
endif
448+
endif
419449
ifeq ($(PLATFORM),PLATFORM_DRM)
420450
# Libraries for DRM compiling
421451
# NOTE: Required packages: libasound2-dev (ALSA)

src/Makefile

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
# - Windows (Win32, Win64)
1414
# - Linux (X11/Wayland desktop mode)
1515
# - Others (not tested)
16+
# > PLATFORM_DESKTOP_RGFW (RGFW backend):
17+
# - Windows (Win32, Win64)
18+
# - Linux (X11 desktop mode)
19+
# - macOS/OSX (x64, arm64 (not tested))
20+
# - Others (not tested)
1621
# > PLATFORM_WEB:
1722
# - HTML5 (WebAssembly)
1823
# > PLATFORM_DRM:
@@ -114,7 +119,7 @@ HOST_PLATFORM_OS ?= WINDOWS
114119
PLATFORM_OS ?= WINDOWS
115120

116121
# Determine PLATFORM_OS when required
117-
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB PLATFORM_ANDROID))
122+
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB PLATFORM_ANDROID PLATFORM_DESKTOP_RGFW))
118123
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
119124
# ifeq ($(UNAME),Msys) -> Windows
120125
ifeq ($(OS),Windows_NT)
@@ -224,6 +229,14 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
224229
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
225230
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
226231
endif
232+
ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
233+
# By default use OpenGL 3.3 on desktop platforms
234+
GRAPHICS ?= GRAPHICS_API_OPENGL_33
235+
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
236+
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
237+
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
238+
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
239+
endif
227240
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
228241
# By default use OpenGL 3.3 on desktop platform with SDL backend
229242
GRAPHICS ?= GRAPHICS_API_OPENGL_33
@@ -576,14 +589,40 @@ endif
576589
ifeq ($(PLATFORM),PLATFORM_ANDROID)
577590
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
578591
endif
592+
ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
593+
ifeq ($(PLATFORM_OS),WINDOWS)
594+
# Libraries for Windows desktop compilation
595+
LDLIBS = ..\src\libraylib.a -lgdi32 -lwinmm -lopengl32
596+
endif
597+
ifeq ($(PLATFORM_OS),LINUX)
598+
# Libraries for Debian GNU/Linux desktop compipling
599+
# NOTE: Required packages: libegl1-mesa-dev
600+
LDLIBS = ../src/libraylib.a -lGL -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -lpthread -ldl -lrt
601+
602+
# Explicit link to libc
603+
ifeq ($(RAYLIB_LIBTYPE),SHARED)
604+
LDLIBS += -lc
605+
endif
606+
607+
# NOTE: On ARM 32bit arch, miniaudio requires atomics library
608+
LDLIBS += -latomic
609+
endif
610+
ifeq ($(PLATFORM_OS),OSX)
611+
# Libraries for Debian GNU/Linux desktop compiling
612+
# NOTE: Required packages: libegl1-mesa-dev
613+
LDLIBS = ../src/libraylib.a -lm
614+
LDLIBS += -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo
615+
endif
616+
endif
579617

580618
# Define source code object files required
581619
#------------------------------------------------------------------------------------------------
582620
OBJS = rcore.o \
583621
rshapes.o \
584622
rtextures.o \
585623
rtext.o \
586-
utils.o
624+
utils.o
625+
587626

588627
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
589628
ifeq ($(USE_EXTERNAL_GLFW),FALSE)
@@ -619,7 +658,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
619658
@echo "raylib library generated (lib$(RAYLIB_LIB_NAME).a)!"
620659
else
621660
ifeq ($(RAYLIB_LIBTYPE),SHARED)
622-
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL))
661+
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
623662
ifeq ($(PLATFORM_OS),WINDOWS)
624663
# NOTE: Linking with provided resource file
625664
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/$(RAYLIB_LIB_NAME).dll $(OBJS) $(RAYLIB_RES_FILE) $(LDFLAGS) $(LDLIBS)

0 commit comments

Comments
 (0)