1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00
Beef/extern/llvm_build.sh
disarray2077 2bedd687db Add Ninja as a optional CMake Generator
Ninja:
real	2m25.508s
user	9m52.981s
sys	0m32.548s

Without ninja:
real	8m38.425s
user	8m5.723s
sys	0m30.840s
2022-07-07 21:22:08 -03:00

47 lines
No EOL
1.4 KiB
Bash
Executable file

#!/bin/bash
set -e
USE_NINJA=""
if command -v ninja >/dev/null 2>&1 ; then
USE_NINJA="-GNinja"
fi
if [ ! -d llvm-project_13_0_1 ]; then
if [ -f llvm-13.0.1.src.tar.xz ]; then # if user downloaded llvm-13.0.1.src.tar.xz then use it instead
tar -xf llvm-13.0.1.src.tar.xz
mkdir llvm-project_13_0_1
mv llvm-13.0.1.src llvm-project_13_0_1/llvm
else # shallow git clone llvm repo if llvm-13.0.1.src.tar.xz does not exists
git clone --depth 1 --branch llvmorg-13.0.1 https://github.com/llvm/llvm-project.git llvm-project_13_0_1
fi
fi #end if llvm-project_13_0_1 exists
if [ ! -d llvm_linux_13_0_1 ]; then
mkdir llvm_linux_13_0_1
fi
if [ ! -d llvm_linux_13_0_1/bin ]; then
cd llvm_linux_13_0_1
cmake $USE_NINJA ../llvm-project_13_0_1/llvm -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86;WebAssembly" -DCMAKE_BUILD_TYPE:String="Debug"
cmake --build . -t $(cat ../llvm_targets.txt)
cd ..
fi
if [ ! -d llvm_linux_rel_13_0_1 ]; then
mkdir llvm_linux_rel_13_0_1
fi
if [ ! -d llvm_linux_rel_13_0_1/bin ]; then
cd llvm_linux_rel_13_0_1
cmake $USE_NINJA ../llvm-project_13_0_1/llvm -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86;WebAssembly" -DCMAKE_BUILD_TYPE:String="Release"
cmake --build . -t $(cat ../llvm_targets.txt)
cd ..
fi
if [ ! -d ../IDE/dist/llvm/bin ]; then
mkdir ../IDE/dist/llvm
mkdir ../IDE/dist/llvm/bin
fi
cp llvm_linux_rel_13_0_1/bin/llvm-ar ../IDE/dist/llvm/bin
echo done > llvm_linux_13_0_1/_Done.txt