Fix Cross-Compilation Toolchain

This commit is contained in:
TheBrokenRail 2021-09-20 22:47:33 -04:00
parent f9acb08e4f
commit 55475a3a0c
2 changed files with 11 additions and 3 deletions

View File

@ -22,7 +22,15 @@ macro(setup_toolchain target)
set(CMAKE_FIND_ROOT_PATH "/usr/${target}" "/usr/lib/${target}")
# Include Directories
pick_gcc_version("/usr/lib/gcc-cross/${target}" GCC_VERSION)
set(NEW_FLAGS "-nostdinc -nostdinc++ -Wno-unused-command-line-argument -isystem /usr/lib/gcc-cross/${target}/${GCC_VERSION}/include -isystem /usr/${target}/include/c++/${GCC_VERSION} -isystem /usr/${target}/include/c++/${GCC_VERSION}/${target} -isystem /usr/${target}/include")
string(CONCAT NEW_FLAGS
"-nostdinc -nostdinc++ -Wno-unused-command-line-argument "
"-isystem /usr/${target}/include/c++/${GCC_VERSION} "
"-isystem /usr/${target}/include/c++/${GCC_VERSION}/${target} "
"-isystem /usr/${target}/include/c++/${GCC_VERSION}/backward "
"-isystem /usr/lib/gcc-cross/${target}/${GCC_VERSION}/include "
"-isystem /usr/lib/gcc-cross/${target}/${GCC_VERSION}/include-fixed "
"-isystem /usr/${target}/include"
)
set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT} ${NEW_FLAGS}")
set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} ${NEW_FLAGS}")
# Extra

View File

@ -7,7 +7,7 @@ build() {
# Find Toolchain
local toolchain_file="$(pwd)/cmake/$2-toolchain.cmake"
if [ ! -f "${toolchain_file}" ]; then
echo "Invalid Architecture: $1" > /dev/stderr
echo "Invalid Architecture: $2" > /dev/stderr
exit 1
fi
@ -76,7 +76,7 @@ arm_build() {
# Verify Mode
if [ "$1" != "client" ] && [ "$1" != "server" ]; then
echo "Invalid Mode: $2" > /dev/stderr
echo "Invalid Mode: $1" > /dev/stderr
exit 1
fi