Browse Source

Fix Cross-Compilation Toolchain

pull/23/head
TheBrokenRail 4 weeks ago
parent
commit
55475a3a0c
  1. 10
      cmake/base-toolchain.cmake
  2. 4
      scripts/build.sh

10
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

4
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

Loading…
Cancel
Save