Skip to content

Commit a18667c

Browse files
authored
cross compilation for PLATFORM_DRM (#3091)
* added cross compilation options for DRM * fixed identation
1 parent 45c00ab commit a18667c

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

src/Makefile

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,11 @@ USE_EXTERNAL_GLFW ?= FALSE
9595
USE_WAYLAND_DISPLAY ?= FALSE
9696

9797
# Use cross-compiler for PLATFORM_RPI
98-
ifeq ($(PLATFORM),PLATFORM_RPI)
99-
USE_RPI_CROSS_COMPILER ?= FALSE
100-
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
101-
RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry
102-
RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot
103-
endif
98+
USE_RPI_CROSS_COMPILER ?= FALSE
99+
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
100+
RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry
101+
RPI_TOOLCHAIN_NAME ?= arm-linux-gnueabihf
102+
RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/$(RPI_TOOLCHAIN_NAME)/sysroot
104103
endif
105104

106105
# Determine if the file has root access (only required to install raylib)
@@ -273,8 +272,16 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
273272
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
274273
# Define RPI cross-compiler
275274
#CC = armv6j-hardfloat-linux-gnueabi-gcc
276-
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
277-
AR = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-ar
275+
CC = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-gcc
276+
AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar
277+
endif
278+
endif
279+
ifeq ($(PLATFORM),PLATFORM_DRM)
280+
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
281+
# Define RPI cross-compiler
282+
#CC = armv6j-hardfloat-linux-gnueabi-gcc
283+
CC = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-gcc
284+
AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar
278285
endif
279286
endif
280287
ifeq ($(PLATFORM),PLATFORM_WEB)
@@ -451,6 +458,10 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
451458
endif
452459
ifeq ($(PLATFORM),PLATFORM_DRM)
453460
INCLUDE_PATHS += -I/usr/include/libdrm
461+
ifeq ($(USE_RPI_CROSSCOMPILER), TRUE)
462+
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/usr/include
463+
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
464+
endif
454465
endif
455466
ifeq ($(PLATFORM),PLATFORM_ANDROID)
456467
NATIVE_APP_GLUE = $(ANDROID_NDK)/sources/android/native_app_glue
@@ -499,6 +510,9 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
499510
endif
500511
ifeq ($(PLATFORM),PLATFORM_DRM)
501512
LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
513+
ifeq ($(USE_RPI_CROSSCOMPILER), TRUE)
514+
INCLUDE_PATHS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib -L$(RPI_TOOLCHAIN_SYSROOT)/usr/lib
515+
endif
502516
endif
503517
ifeq ($(PLATFORM),PLATFORM_ANDROID)
504518
LDFLAGS += -Wl,-soname,libraylib.$(API_VERSION).so -Wl,--exclude-libs,libatomic.a

0 commit comments

Comments
 (0)