diff --git a/ports/install.sh b/ports/install.sh index 14699f9cfa..9a9694e695 100755 --- a/ports/install.sh +++ b/ports/install.sh @@ -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 diff --git a/toolchain/Toolchain.txt b/toolchain/Toolchain.txt index 8acce806e7..5b12ce4f70 100644 --- a/toolchain/Toolchain.txt +++ b/toolchain/Toolchain.txt @@ -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++)