Skip to content

Commit

Permalink
cross compilation for PLATFORM_DRM (#3091)
Browse files Browse the repository at this point in the history
* added cross compilation options for DRM

* fixed identation
  • Loading branch information
TheLastBilly committed May 30, 2023
1 parent 45c00ab commit a18667c
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a18667c

Please sign in to comment.