Compile For ARM64
This commit is contained in:
parent
bf937f8c86
commit
b1d81e860f
@ -24,12 +24,18 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Use Clang By Default
|
# Use Clang By Default
|
||||||
|
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||||
|
if(NOT DEFINED CMAKE_C_COMPILER)
|
||||||
set(CMAKE_C_COMPILER clang)
|
set(CMAKE_C_COMPILER clang)
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED CMAKE_CXX_COMPILER)
|
||||||
set(CMAKE_CXX_COMPILER clang++)
|
set(CMAKE_CXX_COMPILER clang++)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Setup ARM Cross Compilation
|
# Setup ARM Cross Compilation
|
||||||
if(USE_ARM32_TOOLCHAIN)
|
if(USE_ARM32_TOOLCHAIN)
|
||||||
include(cmake/armhf-toolchain.cmake)
|
include(cmake/arm-toolchain.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Use LLD When Using Clang
|
# Use LLD When Using Clang
|
||||||
|
10
cmake/arm64-toolchain.cmake
Normal file
10
cmake/arm64-toolchain.cmake
Normal 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
7
debian/client-arm64
vendored
Normal 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
7
debian/server-arm64
vendored
Normal 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
|
@ -46,6 +46,44 @@ native_build() {
|
|||||||
cd ../../
|
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
|
# Build For ARM
|
||||||
arm_build() {
|
arm_build() {
|
||||||
# Create Build Dir
|
# Create Build Dir
|
||||||
@ -79,6 +117,11 @@ rm -rf out
|
|||||||
# Build
|
# Build
|
||||||
native_build client
|
native_build client
|
||||||
native_build server
|
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
|
if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then
|
||||||
# Requires ARM Versions Of GLFW And FreeImage
|
# Requires ARM Versions Of GLFW And FreeImage
|
||||||
arm_build client
|
arm_build client
|
||||||
|
@ -11,6 +11,7 @@ fi
|
|||||||
# Add ARM Repository
|
# Add ARM Repository
|
||||||
if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then
|
if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then
|
||||||
sudo dpkg --add-architecture armhf
|
sudo dpkg --add-architecture armhf
|
||||||
|
sudo dpkg --add-architecture arm64
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update APT
|
# Update APT
|
||||||
@ -29,12 +30,15 @@ sudo apt-get install --no-install-recommends -y \
|
|||||||
libglfw3 libglfw3-dev \
|
libglfw3 libglfw3-dev \
|
||||||
libfreeimage3 libfreeimage-dev \
|
libfreeimage3 libfreeimage-dev \
|
||||||
crossbuild-essential-armhf \
|
crossbuild-essential-armhf \
|
||||||
|
crossbuild-essential-arm64 \
|
||||||
qemu-user-static
|
qemu-user-static
|
||||||
|
|
||||||
# Install ARM Dependencies
|
# Install ARM Dependencies
|
||||||
if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then
|
if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then
|
||||||
sudo apt-get install --no-install-recommends -y \
|
sudo apt-get install --no-install-recommends -y \
|
||||||
libglfw3:armhf libglfw3-dev:armhf \
|
libglfw3:armhf libglfw3-dev:armhf \
|
||||||
libfreeimage3:armhf
|
libfreeimage3:armhf \
|
||||||
|
libglfw3:arm64 libglfw3-dev:arm64 \
|
||||||
|
libfreeimage3:arm64
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user