Pārlūkot izejas kodu

WARNING: BREAKING: Renamed `PLATFORM_DESKTOP` to `PLATFORM_DESKTOP_GLFW`

This could potentially be a breaking change, for consistency, now every possible desktop backend has the proper name assigned: GLFW, SDL, RGFW
raylib build system has been reviewed to fallback to `PLATFORM_DESKTOP_GLFW` by default when `PLATFORM_DESKTOP` defined
pull/4127/head
Ray pirms 11 mēnešiem
vecāks
revīzija
d243094ede
6 mainītis faili ar 119 papildinājumiem un 99 dzēšanām
  1. +40
    -32
      examples/Makefile
  2. +1
    -1
      projects/CMake/CMakeLists.txt
  3. +2
    -2
      src/CMakeLists.txt
  4. +66
    -60
      src/Makefile
  5. +0
    -0
      src/platforms/rcore_desktop_glfw.c
  6. +10
    -4
      src/rcore.c

+ 40
- 32
examples/Makefile Parādīt failu

@ -4,7 +4,9 @@
# #
# This file supports building raylib examples for the following platforms: # This file supports building raylib examples for the following platforms:
# #
# > PLATFORM_DESKTOP (GLFW backend):
# > PLATFORM_DESKTOP
# - Defaults to PLATFORM_DESKTOP_GLFW
# > PLATFORM_DESKTOP_GFLW (GLFW backend):
# - Windows (Win32, Win64) # - Windows (Win32, Win64)
# - Linux (X11/Wayland desktop mode) # - Linux (X11/Wayland desktop mode)
# - macOS/OSX (x64, arm64) # - macOS/OSX (x64, arm64)
@ -52,6 +54,12 @@
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DESKTOP_SDL, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB # Define target platform: PLATFORM_DESKTOP, PLATFORM_DESKTOP_SDL, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
PLATFORM ?= PLATFORM_DESKTOP PLATFORM ?= PLATFORM_DESKTOP
ifeq ($(PLATFORM), PLATFORM_DESKTOP)
TARGET_PLATFORM = PLATFORM_DESKTOP_GLFW
else
TARGET_PLATFORM = $(PLATFORM)
endif
# Define required raylib variables # Define required raylib variables
PROJECT_NAME ?= raylib_examples PROJECT_NAME ?= raylib_examples
RAYLIB_VERSION ?= 5.0.0 RAYLIB_VERSION ?= 5.0.0
@ -91,7 +99,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 ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB PLATFORM_DESKTOP_RGFW))
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB PLATFORM_DESKTOP_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)
@ -118,7 +126,7 @@ ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLA
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
UNAMEOS = $(shell uname) UNAMEOS = $(shell uname)
ifeq ($(UNAMEOS),Linux) ifeq ($(UNAMEOS),Linux)
PLATFORM_OS = LINUX PLATFORM_OS = LINUX
@ -127,7 +135,7 @@ endif
# RAYLIB_PATH adjustment for LINUX platform # RAYLIB_PATH adjustment for LINUX platform
# TODO: Do we really need this? # TODO: Do we really need this?
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_PREFIX ?= .. RAYLIB_PREFIX ?= ..
RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX)) RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX))
@ -135,14 +143,14 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif endif
# Default path for raylib on Raspberry Pi # Default path for raylib on Raspberry Pi
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
RAYLIB_PATH ?= /home/pi/raylib RAYLIB_PATH ?= /home/pi/raylib
endif 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),PLATFORM_WEB)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH ?= C:/emsdk EMSDK_PATH ?= C:/emsdk
@ -158,7 +166,7 @@ endif
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
CC = gcc CC = gcc
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# OSX default compiler # OSX default compiler
CC = clang CC = clang
@ -168,7 +176,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
CC = clang CC = clang
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
# 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()
@ -179,15 +187,15 @@ endif
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
MAKE ?= make MAKE ?= make
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
MAKE = mingw32-make MAKE = mingw32-make
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
MAKE = mingw32-make MAKE = mingw32-make
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
MAKE = emmake make MAKE = emmake make
endif endif
@ -206,11 +214,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 ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
CFLAGS += -sASSERTIONS=1 --profiling CFLAGS += -sASSERTIONS=1 --profiling
endif endif
else else
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE) ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
CFLAGS += -O3 CFLAGS += -O3
else else
@ -227,7 +235,7 @@ endif
# -Wstrict-prototypes warn if a function is declared or defined without specifying the argument types # -Wstrict-prototypes warn if a function is declared or defined without specifying the argument types
# -Werror=implicit-function-declaration catch function calls without prior declaration # -Werror=implicit-function-declaration catch function calls without prior declaration
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
ifeq ($(RAYLIB_LIBTYPE),STATIC) ifeq ($(RAYLIB_LIBTYPE),STATIC)
CFLAGS += -D_DEFAULT_SOURCE CFLAGS += -D_DEFAULT_SOURCE
@ -238,7 +246,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
CFLAGS += -std=gnu99 -DEGL_NO_X11 CFLAGS += -std=gnu99 -DEGL_NO_X11
endif endif
@ -248,7 +256,7 @@ endif
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
# Define additional directories containing required header files # Define additional directories containing required header files
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),BSD) ifeq ($(PLATFORM_OS),BSD)
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH) INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
endif endif
@ -256,10 +264,10 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH) INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
INCLUDE_PATHS += -I$(SDL_INCLUDE_PATH) INCLUDE_PATHS += -I$(SDL_INCLUDE_PATH)
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH) INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
INCLUDE_PATHS += -I/usr/include/libdrm INCLUDE_PATHS += -I/usr/include/libdrm
endif endif
@ -273,7 +281,7 @@ endif
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# NOTE: The resource .rc file contains windows executable icon and properties # NOTE: The resource .rc file contains windows executable icon and properties
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
@ -289,7 +297,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
LDFLAGS += -Lsrc -L$(RAYLIB_LIB_PATH) LDFLAGS += -Lsrc -L$(RAYLIB_LIB_PATH)
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# NOTE: The resource .rc file contains windows executable icon and properties # NOTE: The resource .rc file contains windows executable icon and properties
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
@ -300,7 +308,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
endif endif
LDFLAGS += -L$(SDL_LIBRARY_PATH) LDFLAGS += -L$(SDL_LIBRARY_PATH)
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
# -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)
@ -347,7 +355,7 @@ endif
# Define libraries required on linking: LDLIBS # Define libraries required on linking: LDLIBS
# NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name> # NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name>
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compilation # Libraries for Windows desktop compilation
# NOTE: WinMM library required to set high-res timer resolution # NOTE: WinMM library required to set high-res timer resolution
@ -393,7 +401,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
LDLIBS += -lglfw LDLIBS += -lglfw
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compilation # Libraries for Windows desktop compilation
LDLIBS = -lraylib -lSDL2 -lSDL2main -lopengl32 -lgdi32 LDLIBS = -lraylib -lSDL2 -lSDL2main -lopengl32 -lgdi32
@ -421,7 +429,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
LDLIBS += -latomic LDLIBS += -latomic
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compilation # Libraries for Windows desktop compilation
LDLIBS = ..\src\libraylib.a -lgdi32 -lwinmm -lopengl32 LDLIBS = ..\src\libraylib.a -lgdi32 -lwinmm -lopengl32
@ -446,12 +454,12 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
LDLIBS += -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo LDLIBS += -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
# Libraries for DRM compiling # Libraries for DRM compiling
# 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),PLATFORM_WEB)
# Libraries for web (HTML5) compiling # Libraries for web (HTML5) compiling
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
endif endif
@ -638,17 +646,17 @@ others: $(OTHERS)
# Generic compilation pattern # Generic compilation pattern
# NOTE: Examples must be ready for Android compilation! # NOTE: Examples must be ready for Android compilation!
%: %.c %: %.c
ifeq ($(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 ($(PLATFORM),PLATFORM_WEB)
else ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
$(MAKE) -f Makefile.Web $@ $(MAKE) -f Makefile.Web $@
else else
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(TARGET_PLATFORM)
endif endif
# Clean everything # Clean everything
clean: clean:
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
del *.o *.exe /s del *.o *.exe /s
endif endif
@ -661,11 +669,11 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
rm -f *.o rm -f *.o
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_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),PLATFORM_WEB)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
del *.wasm *.html *.js *.data del *.wasm *.html *.js *.data
else else

+ 1
- 1
projects/CMake/CMakeLists.txt Parādīt failu

@ -5,7 +5,7 @@ project(example)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Dependencies # Dependencies
set(RAYLIB_VERSION 5.0)
set(RAYLIB_VERSION 5.5)
find_package(raylib ${RAYLIB_VERSION} QUIET) # QUIET or REQUIRED find_package(raylib ${RAYLIB_VERSION} QUIET) # QUIET or REQUIRED
if (NOT raylib_FOUND) # If there's none, fetch and build raylib if (NOT raylib_FOUND) # If there's none, fetch and build raylib
include(FetchContent) include(FetchContent)

+ 2
- 2
src/CMakeLists.txt Parādīt failu

@ -1,7 +1,7 @@
# Setup the project and settings # Setup the project and settings
project(raylib C) project(raylib C)
set(PROJECT_VERSION 5.0.0)
set(API_VERSION 500)
set(PROJECT_VERSION 5.5.0)
set(API_VERSION 550)
include(GNUInstallDirs) include(GNUInstallDirs)
include(JoinPaths) include(JoinPaths)

+ 66
- 60
src/Makefile Parādīt failu

@ -4,7 +4,9 @@
# #
# This file supports building raylib library for the following platforms: # This file supports building raylib library for the following platforms:
# #
# > PLATFORM_DESKTOP (GLFW backend):
# > PLATFORM_DESKTOP
# - Defaults to PLATFORM_DESKTOP_GLFW
# > PLATFORM_DESKTOP_GLFW (GLFW backend):
# - Windows (Win32, Win64) # - Windows (Win32, Win64)
# - Linux (X11/Wayland desktop mode) # - Linux (X11/Wayland desktop mode)
# - macOS/OSX (x64, arm64) # - macOS/OSX (x64, arm64)
@ -55,9 +57,15 @@
# Define required environment variables # Define required environment variables
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
# Define target platform
PLATFORM ?= PLATFORM_DESKTOP PLATFORM ?= PLATFORM_DESKTOP
ifeq ($(PLATFORM), PLATFORM_DESKTOP)
TARGET_PLATFORM = PLATFORM_DESKTOP_GLFW
else
TARGET_PLATFORM = $(PLATFORM)
endif
# Define required raylib variables # Define required raylib variables
RAYLIB_VERSION = 5.0.0 RAYLIB_VERSION = 5.0.0
RAYLIB_API_VERSION = 500 RAYLIB_API_VERSION = 500
@ -119,7 +127,7 @@ HOST_PLATFORM_OS ?= WINDOWS
PLATFORM_OS ?= WINDOWS PLATFORM_OS ?= WINDOWS
# Determine PLATFORM_OS when required # Determine PLATFORM_OS when required
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB PLATFORM_ANDROID PLATFORM_DESKTOP_RGFW))
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB PLATFORM_ANDROID))
# 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)
@ -152,7 +160,7 @@ ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLA
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
UNAMEOS = $(shell uname) UNAMEOS = $(shell uname)
ifeq ($(UNAMEOS),Linux) ifeq ($(UNAMEOS),Linux)
PLATFORM_OS = LINUX PLATFORM_OS = LINUX
@ -161,7 +169,7 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
PLATFORM_SHELL = sh PLATFORM_SHELL = sh
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
ifndef PLATFORM_SHELL ifndef PLATFORM_SHELL
PLATFORM_SHELL = sh PLATFORM_SHELL = sh
@ -169,7 +177,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(PLATFORM_OS), WINDOWS) ifeq ($(PLATFORM_OS), WINDOWS)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH ?= C:/emsdk EMSDK_PATH ?= C:/emsdk
@ -181,7 +189,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
# Android architecture # Android architecture
# Starting at 2019 using arm64 is mandatory for published apps, # Starting at 2019 using arm64 is mandatory for published apps,
# Starting on August 2020, minimum required target API is Android 10 (API level 29) # Starting on August 2020, minimum required target API is Android 10 (API level 29)
@ -221,7 +229,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
endif endif
# Define raylib graphics api depending on selected platform # Define raylib graphics api depending on selected platform
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
# By default use OpenGL 3.3 on desktop platforms # By default use OpenGL 3.3 on desktop platforms
GRAPHICS ?= GRAPHICS_API_OPENGL_33 GRAPHICS ?= GRAPHICS_API_OPENGL_33
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1 #GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
@ -229,7 +237,11 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3 #GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE) #GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
# By default use OpenGL 3.3 on desktop platform with SDL backend
GRAPHICS ?= GRAPHICS_API_OPENGL_33
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
# By default use OpenGL 3.3 on desktop platforms # By default use OpenGL 3.3 on desktop platforms
GRAPHICS ?= GRAPHICS_API_OPENGL_33 GRAPHICS ?= GRAPHICS_API_OPENGL_33
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1 #GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
@ -237,20 +249,16 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3 #GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE) #GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
# By default use OpenGL 3.3 on desktop platform with SDL backend
GRAPHICS ?= GRAPHICS_API_OPENGL_33
endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
# On DRM OpenGL ES 2.0 must be used # On DRM OpenGL ES 2.0 must be used
GRAPHICS = GRAPHICS_API_OPENGL_ES2 GRAPHICS = GRAPHICS_API_OPENGL_ES2
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
# On HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0 # On HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0
GRAPHICS = GRAPHICS_API_OPENGL_ES2 GRAPHICS = GRAPHICS_API_OPENGL_ES2
#GRAPHICS = GRAPHICS_API_OPENGL_ES3 # Uncomment to use ES3/WebGL2 (preliminary support). #GRAPHICS = GRAPHICS_API_OPENGL_ES3 # Uncomment to use ES3/WebGL2 (preliminary support).
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
# By default use OpenGL ES 2.0 on Android # By default use OpenGL ES 2.0 on Android
GRAPHICS = GRAPHICS_API_OPENGL_ES2 GRAPHICS = GRAPHICS_API_OPENGL_ES2
endif endif
@ -260,7 +268,7 @@ endif
CC = gcc CC = gcc
AR = ar AR = ar
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# OSX default compiler # OSX default compiler
CC = clang CC = clang
@ -271,7 +279,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
CC = clang CC = clang
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
# Define RPI cross-compiler # Define RPI cross-compiler
#CC = armv6j-hardfloat-linux-gnueabi-gcc #CC = armv6j-hardfloat-linux-gnueabi-gcc
@ -279,12 +287,12 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
# HTML5 emscripten compiler # HTML5 emscripten compiler
CC = emcc CC = emcc
AR = emar AR = emar
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
# Android toolchain (must be provided for desired architecture and compiler) # Android toolchain (must be provided for desired architecture and compiler)
ifeq ($(ANDROID_ARCH),arm) ifeq ($(ANDROID_ARCH),arm)
CC = $(ANDROID_TOOLCHAIN)/bin/$(ANDROID_COMPILER_ARCH)-linux-androideabi$(ANDROID_API_VERSION)-clang CC = $(ANDROID_TOOLCHAIN)/bin/$(ANDROID_COMPILER_ARCH)-linux-androideabi$(ANDROID_API_VERSION)-clang
@ -316,13 +324,13 @@ endif
# -D_GNU_SOURCE access to lots of nonstandard GNU/Linux extension functions # -D_GNU_SOURCE access to lots of nonstandard GNU/Linux extension functions
# -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers # -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers
# -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing) # -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing)
CFLAGS = -Wall -D_GNU_SOURCE -D$(PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing
CFLAGS = -Wall -D_GNU_SOURCE -D$(TARGET_PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing
ifneq ($(RAYLIB_CONFIG_FLAGS), NONE) ifneq ($(RAYLIB_CONFIG_FLAGS), NONE)
CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS) CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS)
endif endif
ifeq ($(PLATFORM), PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM), PLATFORM_WEB)
# NOTE: When using multi-threading in the user code, it requires -pthread enabled # NOTE: When using multi-threading in the user code, it requires -pthread enabled
CFLAGS += -std=gnu99 CFLAGS += -std=gnu99
else else
@ -338,13 +346,13 @@ ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
endif endif
ifeq ($(RAYLIB_BUILD_MODE),RELEASE) ifeq ($(RAYLIB_BUILD_MODE),RELEASE)
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
CFLAGS += -Os CFLAGS += -Os
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
CFLAGS += -O1 CFLAGS += -O1
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
CFLAGS += -O2 CFLAGS += -O2
endif endif
endif endif
@ -354,10 +362,10 @@ endif
# -Wmissing-prototypes warn if a global function is defined without a previous prototype declaration # -Wmissing-prototypes warn if a global function is defined without a previous prototype declaration
# -Wstrict-prototypes warn if a function is declared or defined without specifying the argument types # -Wstrict-prototypes warn if a function is declared or defined without specifying the argument types
# -Werror=implicit-function-declaration catch function calls without prior declaration # -Werror=implicit-function-declaration catch function calls without prior declaration
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
CFLAGS += -Werror=implicit-function-declaration CFLAGS += -Werror=implicit-function-declaration
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
# -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) -> Only for linker! # -sUSE_GLFW=3 # Use glfw3 library (context/input management) -> Only for linker!
@ -375,7 +383,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
#CFLAGS += -sGL_ENABLE_GET_PROC_ADDRESS #CFLAGS += -sGL_ENABLE_GET_PROC_ADDRESS
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
# Compiler flags for arquitecture # Compiler flags for arquitecture
ifeq ($(ANDROID_ARCH),arm) ifeq ($(ANDROID_ARCH),arm)
CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
@ -411,19 +419,18 @@ ifeq ($(RAYLIB_LIBTYPE),SHARED)
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
# without EGL_NO_X11 eglplatform.h tears Xlib.h in which tears X.h in # without EGL_NO_X11 eglplatform.h tears Xlib.h in which tears X.h in
# which contains a conflicting type Font # which contains a conflicting type Font
CFLAGS += -DEGL_NO_X11 CFLAGS += -DEGL_NO_X11
CFLAGS += -Werror=implicit-function-declaration CFLAGS += -Werror=implicit-function-declaration
endif endif
# Use Wayland display on Linux desktop # Use Wayland display on Linux desktop
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS), LINUX) ifeq ($(PLATFORM_OS), LINUX)
ifeq ($(GLFW_LINUX_ENABLE_X11),TRUE) ifeq ($(GLFW_LINUX_ENABLE_X11),TRUE)
CFLAGS += -D_GLFW_X11 CFLAGS += -D_GLFW_X11
endif endif
ifeq ($(GLFW_LINUX_ENABLE_WAYLAND),TRUE) ifeq ($(GLFW_LINUX_ENABLE_WAYLAND),TRUE)
CFLAGS += -D_GLFW_WAYLAND CFLAGS += -D_GLFW_WAYLAND
LDFLAGS += $(shell pkg-config wayland-client wayland-cursor wayland-egl xkbcommon --libs) LDFLAGS += $(shell pkg-config wayland-client wayland-cursor wayland-egl xkbcommon --libs)
@ -457,26 +464,26 @@ CFLAGS += $(CUSTOM_CFLAGS)
INCLUDE_PATHS = -I. INCLUDE_PATHS = -I.
# Define additional directories containing required header files # Define additional directories containing required header files
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
INCLUDE_PATHS += -Iexternal/glfw/include INCLUDE_PATHS += -Iexternal/glfw/include
ifeq ($(PLATFORM_OS),BSD) ifeq ($(PLATFORM_OS),BSD)
INCLUDE_PATHS += -I/usr/local/include INCLUDE_PATHS += -I/usr/local/include
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
INCLUDE_PATHS += -I$(SDL_INCLUDE_PATH) INCLUDE_PATHS += -I$(SDL_INCLUDE_PATH)
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
INCLUDE_PATHS += -Iexternal/glfw/include INCLUDE_PATHS += -Iexternal/glfw/include
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
INCLUDE_PATHS += -I/usr/include/libdrm INCLUDE_PATHS += -I/usr/include/libdrm
ifeq ($(USE_RPI_CROSSCOMPILER), TRUE) ifeq ($(USE_RPI_CROSSCOMPILER), TRUE)
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/usr/include INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/usr/include
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
NATIVE_APP_GLUE = $(ANDROID_NDK)/sources/android/native_app_glue NATIVE_APP_GLUE = $(ANDROID_NDK)/sources/android/native_app_glue
# Include android_native_app_glue.h # Include android_native_app_glue.h
INCLUDE_PATHS += -I$(NATIVE_APP_GLUE) INCLUDE_PATHS += -I$(NATIVE_APP_GLUE)
@ -502,7 +509,7 @@ endif
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
LDFLAGS = $(CUSTOM_LDFLAGS) -L. -L$(RAYLIB_RELEASE_PATH) LDFLAGS = $(CUSTOM_LDFLAGS) -L. -L$(RAYLIB_RELEASE_PATH)
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
ifneq ($(CC), tcc) ifneq ($(CC), tcc)
LDFLAGS += -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME)dll.a LDFLAGS += -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME)dll.a
@ -518,17 +525,17 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so -Lsrc -L/usr/local/lib LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so -Lsrc -L/usr/local/lib
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
LDFLAGS += -L$(SDL_LIBRARY_PATH) LDFLAGS += -L$(SDL_LIBRARY_PATH)
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
ifeq ($(USE_RPI_CROSSCOMPILER), TRUE) ifeq ($(USE_RPI_CROSSCOMPILER), TRUE)
LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib -L$(RPI_TOOLCHAIN_SYSROOT)/usr/lib LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib -L$(RPI_TOOLCHAIN_SYSROOT)/usr/lib
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
LDFLAGS += -Wl,-soname,libraylib.$(RAYLIB_API_VERSION).so -Wl,--exclude-libs,libatomic.a LDFLAGS += -Wl,-soname,libraylib.$(RAYLIB_API_VERSION).so -Wl,--exclude-libs,libatomic.a
LDFLAGS += -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings LDFLAGS += -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings
# Force linking of library module to define symbol # Force linking of library module to define symbol
@ -542,7 +549,7 @@ endif
# Define libraries required on linking: LDLIBS # Define libraries required on linking: LDLIBS
# NOTE: This is only required for dynamic library generation # NOTE: This is only required for dynamic library generation
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
ifeq ($(CC), tcc) ifeq ($(CC), tcc)
LDLIBS = -lopengl32 -lgdi32 -lwinmm -lshell32 LDLIBS = -lopengl32 -lgdi32 -lwinmm -lshell32
@ -570,7 +577,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
LDLIBS = -lglfw LDLIBS = -lglfw
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
LDLIBS = -static-libgcc -lopengl32 -lgdi32 LDLIBS = -static-libgcc -lopengl32 -lgdi32
endif endif
@ -582,16 +589,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
endif endif
LDLIBS += -lSDL2 -lSDL2main LDLIBS += -lSDL2 -lSDL2main
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
LDLIBS = -lGLESv2 -lEGL -ldrm -lgbm -lpthread -lrt -lm -ldl
ifeq ($(RAYLIB_MODULE_AUDIO),TRUE)
LDLIBS += -latomic
endif
endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# Libraries for Windows desktop compilation # Libraries for Windows desktop compilation
LDLIBS = -lgdi32 -lwinmm -lopengl32 LDLIBS = -lgdi32 -lwinmm -lopengl32
@ -615,6 +613,15 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
LDLIBS += -lm -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo LDLIBS += -lm -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo
endif endif
endif endif
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
LDLIBS = -lGLESv2 -lEGL -ldrm -lgbm -lpthread -lrt -lm -ldl
ifeq ($(RAYLIB_MODULE_AUDIO),TRUE)
LDLIBS += -latomic
endif
endif
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
endif
# Define source code object files required # Define source code object files required
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
@ -624,8 +631,7 @@ OBJS = rcore.o \
rtext.o \ rtext.o \
utils.o utils.o
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(USE_EXTERNAL_GLFW),FALSE) ifeq ($(USE_EXTERNAL_GLFW),FALSE)
OBJS += rglfw.o OBJS += rglfw.o
endif endif
@ -640,7 +646,7 @@ ifeq ($(RAYLIB_MODULE_RAYGUI),TRUE)
OBJS += raygui.o OBJS += raygui.o
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
OBJS += android_native_app_glue.o OBJS += android_native_app_glue.o
endif endif
@ -652,14 +658,14 @@ all: raylib
# Compile raylib library # Compile raylib library
# NOTE: Release directory is created if not exist # NOTE: Release directory is created if not exist
raylib: $(OBJS) raylib: $(OBJS)
ifeq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
# Compile raylib libray for web # Compile raylib libray for web
#$(CC) $(OBJS) -r -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc #$(CC) $(OBJS) -r -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc
$(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(OBJS) $(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(OBJS)
@echo "raylib library generated (lib$(RAYLIB_LIB_NAME).a)!" @echo "raylib library generated (lib$(RAYLIB_LIB_NAME).a)!"
else else
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# NOTE: Linking with provided resource file # NOTE: Linking with provided resource file
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/$(RAYLIB_LIB_NAME).dll $(OBJS) $(RAYLIB_RES_FILE) $(LDFLAGS) $(LDLIBS) $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/$(RAYLIB_LIB_NAME).dll $(OBJS) $(RAYLIB_RES_FILE) $(LDFLAGS) $(LDLIBS)
@ -688,7 +694,7 @@ else
cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).so cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).so
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_DRM)
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
# Compile raylib shared library version $(RAYLIB_VERSION). # Compile raylib shared library version $(RAYLIB_VERSION).
# WARNING: you should type "make clean" before doing this target # WARNING: you should type "make clean" before doing this target
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) $(LDLIBS) $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) $(LDLIBS)
@ -696,7 +702,7 @@ else
cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS) $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS)
@echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so)!" @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so)!"
# WARNING: symbolic links creation on Windows should be done using mklink command, no ln available # WARNING: symbolic links creation on Windows should be done using mklink command, no ln available
@ -851,7 +857,7 @@ clean: clean_shell_$(PLATFORM_SHELL)
clean_shell_sh: clean_shell_sh:
rm -fv *.o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so* raygui.c $(RAYLIB_RELEASE_PATH)/*-protocol.h $(RAYLIB_RELEASE_PATH)/*-protocol-code.h rm -fv *.o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so* raygui.c $(RAYLIB_RELEASE_PATH)/*-protocol.h $(RAYLIB_RELEASE_PATH)/*-protocol-code.h
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
rm -fv $(NATIVE_APP_GLUE)/android_native_app_glue.o rm -fv $(NATIVE_APP_GLUE)/android_native_app_glue.o
endif endif

src/platforms/rcore_desktop.c → src/platforms/rcore_desktop_glfw.c Parādīt failu


+ 10
- 4
src/rcore.c Parādīt failu

@ -3,7 +3,7 @@
* rcore - Window/display management, Graphic device/context management and input management * rcore - Window/display management, Graphic device/context management and input management
* *
* PLATFORMS SUPPORTED: * PLATFORMS SUPPORTED:
* > PLATFORM_DESKTOP (GLFW backend):
* > PLATFORM_DESKTOP_GLFW (GLFW backend):
* - Windows (Win32, Win64) * - Windows (Win32, Win64)
* - Linux (X11/Wayland desktop mode) * - Linux (X11/Wayland desktop mode)
* - macOS/OSX (x64, arm64) * - macOS/OSX (x64, arm64)
@ -493,9 +493,13 @@ void __stdcall Sleep(unsigned long msTimeout); // Required for: Wai
const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed' const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed'
#endif // !SUPPORT_MODULE_RTEXT #endif // !SUPPORT_MODULE_RTEXT
// Include platform-specific submodules
#if defined(PLATFORM_DESKTOP) #if defined(PLATFORM_DESKTOP)
#include "platforms/rcore_desktop.c"
#define PLATFORM_DESKTOP_GLFW
#endif
// Include platform-specific submodules
#if defined(PLATFORM_DESKTOP_GLFW)
#include "platforms/rcore_desktop_glfw.c"
#elif defined(PLATFORM_DESKTOP_SDL) #elif defined(PLATFORM_DESKTOP_SDL)
#include "platforms/rcore_desktop_sdl.c" #include "platforms/rcore_desktop_sdl.c"
#elif defined(PLATFORM_DESKTOP_RGFW) #elif defined(PLATFORM_DESKTOP_RGFW)
@ -564,10 +568,12 @@ void InitWindow(int width, int height, const char *title)
{ {
TRACELOG(LOG_INFO, "Initializing raylib %s", RAYLIB_VERSION); TRACELOG(LOG_INFO, "Initializing raylib %s", RAYLIB_VERSION);
#if defined(PLATFORM_DESKTOP)
#if defined(PLATFORM_DESKTOP_GLFW)
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (GLFW)"); TRACELOG(LOG_INFO, "Platform backend: DESKTOP (GLFW)");
#elif defined(PLATFORM_DESKTOP_SDL) #elif defined(PLATFORM_DESKTOP_SDL)
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (SDL)"); TRACELOG(LOG_INFO, "Platform backend: DESKTOP (SDL)");
#elif defined(PLATFORM_DESKTOP_RGFW)
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (RGFW)");
#elif defined(PLATFORM_WEB) #elif defined(PLATFORM_WEB)
TRACELOG(LOG_INFO, "Platform backend: WEB (HTML5)"); TRACELOG(LOG_INFO, "Platform backend: WEB (HTML5)");
#elif defined(PLATFORM_DRM) #elif defined(PLATFORM_DRM)

Notiek ielāde…
Atcelt
Saglabāt