Fix CMake

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++") set(CMAKE_CXX_COMPILER "clang++")
endif() endif()
# Setup ARM Cross Compilation
if(USE_ARM32_TOOLCHAIN)
include(cmake/armhf-toolchain.cmake)
endif()
# Utility Functions # Utility Functions
include(cmake/util.cmake) include(cmake/util.cmake)
@ -67,6 +62,11 @@ endif()
# Start Project # Start Project
project(minecraft-pi-reborn) 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 # Specify Default Installation Prefix
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/" CACHE PATH "" FORCE) set(CMAKE_INSTALL_PREFIX "/" CACHE PATH "" FORCE)

View File

@ -46,7 +46,7 @@ mkdir build && cd build
# Build ARM Components # Build ARM Components
mkdir arm && cd arm 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 make -j$(nproc) && sudo make install
cd ../ cd ../

View File

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