From 99d5a35eb4e3d3b645999ed246bc1ef9073b4d2f Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Mon, 26 Jun 2023 20:13:38 +0900 Subject: [PATCH] separate a cmake wrapper from cross-cmake-configure.sh --- cross/cmake-wrap.sh | 26 ++++++++++++++++++++++++++ cross/cross-cmake-configure.sh | 20 ++------------------ 2 files changed, 28 insertions(+), 18 deletions(-) create mode 100755 cross/cmake-wrap.sh diff --git a/cross/cmake-wrap.sh b/cross/cmake-wrap.sh new file mode 100755 index 00000000..6f09527a --- /dev/null +++ b/cross/cmake-wrap.sh @@ -0,0 +1,26 @@ +#! /bin/sh + +set -e + +THIS_DIR=$(cd $(dirname $0) && pwd -P) + +# tested ARCH: arm64 s390x armhf riscv64 i386 + +ARCH=${ARCH:-arm64} +case ${ARCH} in +arm64) + TRIPLET=${TRIPLET:-aarch64-linux-gnu} + ;; +armhf) + TRIPLET=${TRIPLET:-arm-linux-gnueabihf} + ;; +*) + TRIPLET=${TRIPLET:-${ARCH}-linux-gnu} + ;; +esac + +cmake \ +-DCMAKE_TOOLCHAIN_FILE=${THIS_DIR}/cross.cmake \ +-DTRIPLET=${TRIPLET} \ +-DARCH=${ARCH} \ +"$@" diff --git a/cross/cross-cmake-configure.sh b/cross/cross-cmake-configure.sh index 4760747f..0f174713 100755 --- a/cross/cross-cmake-configure.sh +++ b/cross/cross-cmake-configure.sh @@ -2,26 +2,10 @@ set -e -# tested ARCH: arm64 s390x armhf riscv64 i386 - -ARCH=${ARCH:-arm64} -case ${ARCH} in -arm64) - TRIPLET=${TRIPLET:-aarch64-linux-gnu} - ;; -armhf) - TRIPLET=${TRIPLET:-arm-linux-gnueabihf} - ;; -*) - TRIPLET=${TRIPLET:-${ARCH}-linux-gnu} - ;; -esac +THIS_DIR=$(cd $(dirname $0) && pwd -P) mkdir build.cross.${ARCH} cd build.cross.${ARCH} -cmake \ --DCMAKE_TOOLCHAIN_FILE=../cross/cross.cmake \ --DTRIPLET=${TRIPLET} \ --DARCH=${ARCH} \ +${THIS_DIR}/cmake-wrap.sh \ ${EXTRA_CMAKE_OPTIONS} \ ..