From cfe2ac2783dfd86a7e9ae81aba2f5db3f1f64133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 23 Jan 2024 13:50:11 +0200 Subject: [PATCH] build-llvm: Set CMAKE_SYSTEM_PROCESSOR when cross compiling Normally there's nothing in the LLVM build that strictly requires this, but some fringe parts of the build may use it. Set it for consistency. --- build-llvm.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-llvm.sh b/build-llvm.sh index 720aeb5..f8baa86 100755 --- a/build-llvm.sh +++ b/build-llvm.sh @@ -153,8 +153,10 @@ fi CMAKEFLAGS="$LLVM_CMAKEFLAGS" if [ -n "$HOST" ]; then + ARCH="${HOST%%-*}" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_C_COMPILER=$HOST-gcc" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_CXX_COMPILER=$HOST-g++" + CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_SYSTEM_PROCESSOR=$ARCH" case $HOST in *-mingw32) CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_SYSTEM_NAME=Windows" @@ -267,7 +269,9 @@ if [ -n "$MACOS_REDIST" ]; then # If we're not building for the native arch, flag to CMake that we're # cross compiling, to let it build native versions of tools used # during the build. + ARCH="$(echo $MACOS_REDIST_ARCHS | awk '{print $1}')" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_SYSTEM_NAME=Darwin" + CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_SYSTEM_PROCESSOR=$ARCH" fi fi