From fba91858d2105c222768d0a6fc1ac6f7dd419a83 Mon Sep 17 00:00:00 2001 From: TheLastBilly Date: Tue, 30 May 2023 11:44:31 -0400 Subject: [PATCH 1/2] added cross compilation options for DRM --- src/Makefile | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/Makefile b/src/Makefile index 5d7086d8a9e8..10d872f6d956 100644 --- a/src/Makefile +++ b/src/Makefile @@ -95,12 +95,11 @@ USE_EXTERNAL_GLFW ?= FALSE USE_WAYLAND_DISPLAY ?= FALSE # Use cross-compiler for PLATFORM_RPI -ifeq ($(PLATFORM),PLATFORM_RPI) - USE_RPI_CROSS_COMPILER ?= FALSE - ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) - RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry - RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot - endif +USE_RPI_CROSS_COMPILER ?= FALSE +ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) + RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry + RPI_TOOLCHAIN_NAME ?= arm-linux-gnueabihf + RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/$(RPI_TOOLCHAIN_NAME)/sysroot endif # Determine if the file has root access (only required to install raylib) @@ -273,8 +272,16 @@ ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) # Define RPI cross-compiler #CC = armv6j-hardfloat-linux-gnueabi-gcc - CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc - AR = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-ar + CC = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-gcc + AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar + endif +endif +ifeq ($(PLATFORM),PLATFORM_DRM) + ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) + # Define RPI cross-compiler + #CC = armv6j-hardfloat-linux-gnueabi-gcc + CC = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-gcc + AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar endif endif ifeq ($(PLATFORM),PLATFORM_WEB) @@ -451,6 +458,10 @@ ifeq ($(PLATFORM),PLATFORM_RPI) endif ifeq ($(PLATFORM),PLATFORM_DRM) INCLUDE_PATHS += -I/usr/include/libdrm + ifeq ($(USE_RPI_CROSSCOMPILER), TRUE) + INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/usr/include + INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include + endif endif ifeq ($(PLATFORM),PLATFORM_ANDROID) NATIVE_APP_GLUE = $(ANDROID_NDK)/sources/android/native_app_glue @@ -499,6 +510,9 @@ ifeq ($(PLATFORM),PLATFORM_RPI) endif ifeq ($(PLATFORM),PLATFORM_DRM) LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) + ifeq ($(USE_RPI_CROSSCOMPILER), TRUE) + INCLUDE_PATHS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib -L$(RPI_TOOLCHAIN_SYSROOT)/usr/lib + endif endif ifeq ($(PLATFORM),PLATFORM_ANDROID) LDFLAGS += -Wl,-soname,libraylib.$(API_VERSION).so -Wl,--exclude-libs,libatomic.a From 7588ef01cfa4d25ac7510c31b9c63ae80ceaa40a Mon Sep 17 00:00:00 2001 From: TheLastBilly Date: Tue, 30 May 2023 11:51:37 -0400 Subject: [PATCH 2/2] fixed identation --- src/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 10d872f6d956..c6cd30e812aa 100644 --- a/src/Makefile +++ b/src/Makefile @@ -459,8 +459,8 @@ endif ifeq ($(PLATFORM),PLATFORM_DRM) INCLUDE_PATHS += -I/usr/include/libdrm ifeq ($(USE_RPI_CROSSCOMPILER), TRUE) - INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/usr/include - INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include + INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/usr/include + INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include endif endif ifeq ($(PLATFORM),PLATFORM_ANDROID) @@ -511,7 +511,7 @@ endif ifeq ($(PLATFORM),PLATFORM_DRM) LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) ifeq ($(USE_RPI_CROSSCOMPILER), TRUE) - INCLUDE_PATHS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib -L$(RPI_TOOLCHAIN_SYSROOT)/usr/lib + INCLUDE_PATHS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib -L$(RPI_TOOLCHAIN_SYSROOT)/usr/lib endif endif ifeq ($(PLATFORM),PLATFORM_ANDROID)