ports: Allow using banan-os cmake toolchain file for ports

This commit is contained in:
Bananymous 2024-12-03 20:18:24 +02:00
parent 0dd81328ff
commit 3b7b6beca5
2 changed files with 14 additions and 3 deletions

View File

@ -6,7 +6,7 @@ if (( $# != 1 )); then
fi
if [[ -z $BANAN_ROOT_DIR ]]; then
BANAN_ROOT_DIR="$(realpath $(dirname $(realpath $0))/..)"
export BANAN_ROOT_DIR="$(realpath $(dirname $(realpath $0))/..)"
fi
source "$BANAN_ROOT_DIR/script/config.sh"
@ -29,6 +29,8 @@ export OBJDUMP="$BANAN_TOOLCHAIN_TRIPLE-objdump"
export STRIP="$BANAN_TOOLCHAIN_TRIPLE-strip"
export CXXFILT="$BANAN_TOOLCHAIN_TRIPLE-c++filt"
export CMAKE_TOOLCHAIN_FILE="$BANAN_TOOLCHAIN_DIR/Toolchain.txt"
pushd "$BANAN_ROOT_DIR" >/dev/null
./bos all && ./bos install || exit 1
popd >/dev/null

View File

@ -13,12 +13,21 @@ if (NOT DEFINED ENV{BANAN_SYSROOT_TAR})
endif ()
set(BANAN_SYSROOT_TAR $ENV{BANAN_SYSROOT_TAR})
set(TOOLCHAIN_PREFIX ${CMAKE_SOURCE_DIR}/toolchain/local)
if (NOT DEFINED ENV{BANAN_ROOT_DIR})
message(FATAL_ERROR "environment variable BANAN_ROOT_DIR not defined")
endif ()
set(TOOLCHAIN_PREFIX $ENV{BANAN_ROOT_DIR}/toolchain/local)
set(CMAKE_SYSTEM_NAME banan-os)
set(CMAKE_SYSTEM_PROCESSOR AMD64)
set(CMAKE_SYSROOT ${BANAN_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}/bin/${BANAN_ARCH}-banan_os-g++)