Added cross-compiler RPI libs

This commit is contained in:
Ray
2017-10-22 20:00:38 +02:00
parent 6cec382f65
commit ad31730b6a
3 changed files with 24 additions and 12 deletions

Binary file not shown.

View File

@ -46,7 +46,7 @@ RAYLIB_PATH ?= ..
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll)
# NOTE: OpenAL Soft library should be provided in the selected form # NOTE: OpenAL Soft library should be provided in the selected form
RAYLIB_LIBTYPE ?= SHARED RAYLIB_LIBTYPE ?= STATIC
OPENAL_LIBTYPE ?= STATIC OPENAL_LIBTYPE ?= STATIC
# On PLATFORM_WEB force OpenAL Soft shared library # On PLATFORM_WEB force OpenAL Soft shared library
@ -54,6 +54,13 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
OPENAL_LIBTYPE = SHARED OPENAL_LIBTYPE = SHARED
endif endif
# Use cross-compiler for PLATFORM_RPI
ifeq ($(PLATFORM),PLATFORM_RPI)
RPI_CROSS_COMPILE ?= YES
RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry
RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot
endif
# Determine if the file has root access (only for installing raylib) # Determine if the file has root access (only for installing raylib)
# "whoami" prints the name of the user that calls him (so, if it is the root # "whoami" prints the name of the user that calls him (so, if it is the root
# user, "whoami" prints "root"). # user, "whoami" prints "root").
@ -77,11 +84,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI cross-compiler
RPI_CROSS_COMPILE ?= NO
endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH = C:/emsdk EMSDK_PATH = C:/emsdk
@ -166,8 +168,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(RPI_CROSS_COMPILE),YES) ifeq ($(RPI_CROSS_COMPILE),YES)
# RPI cross-compiler # Define RPI cross-compiler
CC = armv6j-hardfloat-linux-gnueabi-gcc #CC = armv6j-hardfloat-linux-gnueabi-gcc
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
@ -188,6 +191,14 @@ endif
# Default archiver program to pack libraries # Default archiver program to pack libraries
AR = ar AR = ar
ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(RPI_CROSS_COMPILE),YES)
# Define RPI cross-archiver
#CC = armv6j-hardfloat-linux-gnueabi-gcc
AR = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-ar
endif
endif
# Android archiver (also depends on desired architecture) # Android archiver (also depends on desired architecture)
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(ANDROID_ARCH),ARM) ifeq ($(ANDROID_ARCH),ARM)
@ -251,9 +262,10 @@ INCLUDE_PATHS = -I. -Iexternal -Iexternal/include
# Define additional directories containing required header files # Define additional directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI requried libraries # RPI requried libraries
INCLUDE_PATHS += -I/opt/vc/include INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vmcs_host/linux
INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
# Android required libraries # Android required libraries
@ -326,7 +338,7 @@ else
@echo "raylib shared library generated (libraylib.so)!" @echo "raylib shared library generated (libraylib.so)!"
endif endif
else else
# Compile raylib static library. # Compile raylib static library
@echo raylib library release path is $(RAYLIB_RELEASE_PATH) @echo raylib library release path is $(RAYLIB_RELEASE_PATH)
$(AR) rcs $(RAYLIB_RELEASE_PATH)/libraylib.a $(OBJS) $(AR) rcs $(RAYLIB_RELEASE_PATH)/libraylib.a $(OBJS)
@echo "raylib static library generated (libraylib.a)!" @echo "raylib static library generated (libraylib.a)!"