Skip to content

Commit

Permalink
separate a cmake wrapper from cross-cmake-configure.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Jun 26, 2023
1 parent f0ebc2d commit 99d5a35
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
26 changes: 26 additions & 0 deletions cross/cmake-wrap.sh
Original file line number Diff line number Diff line change
@@ -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} \
"$@"
20 changes: 2 additions & 18 deletions cross/cross-cmake-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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} \
..

0 comments on commit 99d5a35

Please sign in to comment.