Compile For ARM64
All checks were successful
minecraft-pi-reborn/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2021-06-24 12:40:34 -04:00
parent bf937f8c86
commit b1d81e860f
7 changed files with 81 additions and 4 deletions

View File

@ -24,12 +24,18 @@ else()
endif()
# Use Clang By Default
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
if(NOT DEFINED CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER clang)
endif()
if(NOT DEFINED CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER clang++)
endif()
endif()
# Setup ARM Cross Compilation
if(USE_ARM32_TOOLCHAIN)
include(cmake/armhf-toolchain.cmake)
include(cmake/arm-toolchain.cmake)
endif()
# Use LLD When Using Clang

View File

@ -0,0 +1,10 @@
# Compile For ARM64
if(NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64_be" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv8b" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv8l"))
# Use ARM64 Cross-Compiler
set(TARGET "aarch64-linux-gnu")
set(CMAKE_C_COMPILER "${TARGET}-gcc")
set(CMAKE_CXX_COMPILER "${TARGET}-g++")
set(CMAKE_FIND_ROOT_PATH "/usr/${TARGET}" "/usr/lib/${TARGET}")
endif()
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "aarch64")

7
debian/client-arm64 vendored Normal file
View File

@ -0,0 +1,7 @@
Package: minecraft-pi-reborn-client
Version: ${VERSION}
Maintainer: TheBrokenRail <connor24nolan@live.com>
Description: Fun with Blocks
Homepage: https://www.minecraft.net/en-us/edition/pi
Architecture: arm64
Depends: zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3, libc6-armhf-cross, libstdc++6-armhf-cross

7
debian/server-arm64 vendored Normal file
View File

@ -0,0 +1,7 @@
Package: minecraft-pi-reborn-server
Version: ${VERSION}
Maintainer: TheBrokenRail <connor24nolan@live.com>
Description: Fun with Blocks
Homepage: https://www.minecraft.net/en-us/edition/pi
Architecture: arm64
Depends: libc6-armhf-cross, libstdc++6-armhf-cross

View File

@ -46,6 +46,44 @@ native_build() {
cd ../../
}
# Build For ARM64
arm64_build() {
# Create Build Dir
rm -rf build/$1-arm64
mkdir -p build/$1-arm64
cd build/$1-arm64
# Create Prefix
local prefix="$(cd ../../; pwd)/out/$1-arm64"
rm -rf "${prefix}"
mkdir -p "${prefix}"
# Prepare
local extra_arg='-DMCPI_USE_MEDIA_LAYER_PROXY=ON'
if [ "$1" = "server" ]; then
extra_arg='-DMCPI_SERVER_MODE=ON'
fi
# Build ARM Components
mkdir arm
cd arm
cmake -DMCPI_BUILD_MODE=arm "${extra_arg}" ../../..
make -j$(nproc)
make install DESTDIR="${prefix}"
cd ../
# Build Native Components
mkdir native
cd native
cmake -DCMAKE_TOOLCHAIN_FILE="$(cd ../../../; pwd)/cmake/arm64-toolchain.cmake" -DMCPI_BUILD_MODE=native "${extra_arg}" ../../..
make -j$(nproc)
make install DESTDIR="${prefix}"
cd ../
# Exit
cd ../../
}
# Build For ARM
arm_build() {
# Create Build Dir
@ -79,6 +117,11 @@ rm -rf out
# Build
native_build client
native_build server
if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then
# Requires ARM Versions Of GLFW And FreeImage
arm64_build client
fi
arm64_build server
if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then
# Requires ARM Versions Of GLFW And FreeImage
arm_build client

View File

@ -11,6 +11,7 @@ fi
# Add ARM Repository
if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then
sudo dpkg --add-architecture armhf
sudo dpkg --add-architecture arm64
fi
# Update APT
@ -29,12 +30,15 @@ sudo apt-get install --no-install-recommends -y \
libglfw3 libglfw3-dev \
libfreeimage3 libfreeimage-dev \
crossbuild-essential-armhf \
crossbuild-essential-arm64 \
qemu-user-static
# Install ARM Dependencies
if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then
sudo apt-get install --no-install-recommends -y \
libglfw3:armhf libglfw3-dev:armhf \
libfreeimage3:armhf
libfreeimage3:armhf \
libglfw3:arm64 libglfw3-dev:arm64 \
libfreeimage3:arm64
fi