1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Merge pull request #1634 from disarray2077/ninja_build

Add Ninja as a optional CMake Generator
This commit is contained in:
Brian Fiete 2022-07-08 08:50:28 -04:00 committed by GitHub
commit dc901b8614
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 5 deletions

View file

@ -4,9 +4,30 @@ echo Starting build.sh
PATH=/usr/local/bin:$PATH:$HOME/bin
SCRIPTPATH=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
ROOTPATH="$(dirname "$SCRIPTPATH")"
echo Building from from $SCRIPTPATH
echo Building from $SCRIPTPATH
cd $SCRIPTPATH
if [[ $1 == "clean" ]]; then
rm -rf ../jbuild
rm -rf ../jbuild_d
fi
if command -v ninja >/dev/null 2>&1 ; then
CAN_USE_NINJA=1
if [ -d ../jbuild_d ] && [ ! -f ../jbuild_d/build.ninja ]; then
CAN_USE_NINJA=0
fi
if [ $CAN_USE_NINJA == 1 ]; then
echo "Ninja is enabled for this build."
USE_NINJA="-GNinja"
else
echo "Ninja couldn't be enabled for this build, consider doing a clean build to start using Ninja for faster build speeds."
fi
else
echo "Ninja isn't installed, consider installing it for faster build speeds."
fi
# exit when any command fails
set -e
@ -35,10 +56,10 @@ if [ ! -d jbuild_d ]; then
mkdir jbuild
fi
cd jbuild_d
cmake -DCMAKE_BUILD_TYPE=Debug ../
cmake $USE_NINJA -DCMAKE_BUILD_TYPE=Debug ../
cmake --build .
cd ../jbuild
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ../
cmake $USE_NINJA -DCMAKE_BUILD_TYPE=RelWithDebInfo ../
cmake --build .
cd ../IDE/dist

View file

@ -1,6 +1,11 @@
#!/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
@ -17,7 +22,7 @@ fi
if [ ! -d llvm_linux_13_0_1/bin ]; then
cd llvm_linux_13_0_1
cmake ../llvm-project_13_0_1/llvm -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86;WebAssembly" -DCMAKE_BUILD_TYPE:String="Debug"
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
@ -28,7 +33,7 @@ fi
if [ ! -d llvm_linux_rel_13_0_1/bin ]; then
cd llvm_linux_rel_13_0_1
cmake ../llvm-project_13_0_1/llvm -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86;WebAssembly" -DCMAKE_BUILD_TYPE:String="Release"
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