Fix CMake
All checks were successful
minecraft-pi-reborn/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2021-12-17 18:19:23 -05:00
parent 406aa3f9a6
commit 5a5fe4c731
3 changed files with 11 additions and 8 deletions

View File

@ -32,11 +32,6 @@ if(NOT DEFINED CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER "clang++")
endif()
# Setup ARM Cross Compilation
if(USE_ARM32_TOOLCHAIN)
include(cmake/armhf-toolchain.cmake)
endif()
# Utility Functions
include(cmake/util.cmake)
@ -67,6 +62,11 @@ endif()
# Start Project
project(minecraft-pi-reborn)
# Require ARM Compilation
if(USE_ARM32_TOOLCHAIN AND (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "arm") AND (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l"))
message(FATAL_ERROR "ARM-Targeting Compiler Required")
endif()
# Specify Default Installation Prefix
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/" CACHE PATH "" FORCE)

View File

@ -46,7 +46,7 @@ mkdir build && cd build
# Build ARM Components
mkdir arm && cd arm
cmake -DMCPI_BUILD_MODE=arm ../..
cmake -DCMAKE_TOOLCHAIN_FILE=../../cmake/armhf-toolchain.cmake -DMCPI_BUILD_MODE=arm ../..
make -j$(nproc) && sudo make install
cd ../

View File

@ -2,6 +2,9 @@
set -e
# ARM Toolchain File
ARM_TOOLCHAIN_FILE="$(pwd)/cmake/armhf-toolchain.cmake"
# Build
build() {
# Find Toolchain
@ -30,7 +33,7 @@ build() {
# Build ARM Components
mkdir arm
cd arm
cmake -DMCPI_BUILD_MODE=arm "${extra_arg}" ../../..
cmake -DCMAKE_TOOLCHAIN_FILE="${ARM_TOOLCHAIN_FILE}" -DMCPI_BUILD_MODE=arm "${extra_arg}" ../../..
make -j$(nproc)
make install DESTDIR="${prefix}"
cd ../
@ -66,7 +69,7 @@ armhf_build() {
fi
# Build All Components
cmake -DMCPI_BUILD_MODE=both -DMCPI_SERVER_MODE="${server_mode}" ../..
cmake -DCMAKE_TOOLCHAIN_FILE="${ARM_TOOLCHAIN_FILE}" -DMCPI_BUILD_MODE=both -DMCPI_SERVER_MODE="${server_mode}" ../..
make -j$(nproc)
make install DESTDIR="${prefix}"