From 873243acc267b2ec7bedc1be8564cd990f522ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 7 May 2019 23:22:03 +0300 Subject: [PATCH] build-llvm: Use the built-in recursive cmake for building llvm-tblgen if necessary This requires setting a flag to use the system default compiler for this, instead of the cross compiler. --- build-llvm.sh | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/build-llvm.sh b/build-llvm.sh index 51db74f..c799506 100755 --- a/build-llvm.sh +++ b/build-llvm.sh @@ -96,27 +96,20 @@ if [ -n "$HOST" ]; then echo $(dirname $(which llvm-tblgen)) fi } - native=$(find_native_tools) - if [ -z "$native" ]; then - # As we don't do any install here, the target prefix shouldn't actually - # be created. - HOST="" BUILDTARGETS="llvm-tblgen clang-tblgen llvm-config" $0 $PREFIX/llvmtools - native=$(find_native_tools) - if [ -z "$native" ]; then - echo Unable to find the newly built llvm-tblgen - exit 1 - fi - fi CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_SYSTEM_NAME=Windows" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_CROSSCOMPILING=TRUE" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_C_COMPILER=$HOST-gcc" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_CXX_COMPILER=$HOST-g++" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_RC_COMPILER=$HOST-windres" + CMAKEFLAGS="$CMAKEFLAGS -DCROSS_TOOLCHAIN_FLAGS_NATIVE=" - CMAKEFLAGS="$CMAKEFLAGS -DLLVM_TABLEGEN=$native/llvm-tblgen" - CMAKEFLAGS="$CMAKEFLAGS -DCLANG_TABLEGEN=$native/clang-tblgen" - CMAKEFLAGS="$CMAKEFLAGS -DLLVM_CONFIG_PATH=$native/llvm-config" + native=$(find_native_tools) + if [ -n "$native" ]; then + CMAKEFLAGS="$CMAKEFLAGS -DLLVM_TABLEGEN=$native/llvm-tblgen" + CMAKEFLAGS="$CMAKEFLAGS -DCLANG_TABLEGEN=$native/clang-tblgen" + CMAKEFLAGS="$CMAKEFLAGS -DLLVM_CONFIG_PATH=$native/llvm-config" + fi CROSS_ROOT=$(cd $(dirname $(which $HOST-gcc))/../$HOST && pwd) CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH=$CROSS_ROOT" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER"