From 55475a3a0c728b2ab467e46619609c6f649f54a1 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Mon, 20 Sep 2021 22:47:33 -0400 Subject: [PATCH] Fix Cross-Compilation Toolchain --- cmake/base-toolchain.cmake | 10 +++++++++- scripts/build.sh | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cmake/base-toolchain.cmake b/cmake/base-toolchain.cmake index 4a949d05..c064218b 100644 --- a/cmake/base-toolchain.cmake +++ b/cmake/base-toolchain.cmake @@ -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 diff --git a/scripts/build.sh b/scripts/build.sh index 6fbc4b92..031baca9 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -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