-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_igc.sh
executable file
·71 lines (57 loc) · 2.29 KB
/
build_igc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
script=$(readlink -f "$0")
scriptpath=$(dirname "$script")
if [ -z $GFX_BUILD_HOME ]; then
echo "GFX_BUILD_HOME unset. Please use export GFX_BUILD_HOME=/your/path"
exit 1
fi
source $scriptpath/manifest.sh
cd $GFX_BUILD_HOME || exit 1
mkdir -p install/llvm
mkdir -p build/llvm
rm -rf install/llvm/*
cd $GFX_BUILD_HOME/build/llvm || exit 1
cmake -G Ninja $GFX_BUILD_HOME/llvm-project/llvm \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;libc;libcxx;libcxxabi;libunwind;lld;lldb;openmp" \
-DLIBCXXABI_USE_COMPILER_RT=YES \
-DCMAKE_INSTALL_PREFIX=$GFX_BUILD_HOME/install/llvm || exit 1
cmake --build .
cmake --build . --target install
# https://github.com/KhronosGroup/SPIRV-LLVM-Translator/tree/llvm_release_110#build-with-pre-built-llvm
cd $GFX_BUILD_HOME || exit 1
mkdir -p install/llvm-spirv
mkdir -p build/llvm-spirv
rm -rf install/llvm-spirv/*
cd $GFX_BUILD_HOME/build/llvm-spirv || exit 1
cmake -DCMAKE_BUILD_TYPE=Debug $GFX_BUILD_HOME/llvm-spirv \
-DLLVM_DIR=$GFX_BUILD_HOME/install/llvm/lib/cmake/llvm/ \
-DLLVM_SPIRV_BUILD_EXTERNAL=YES \
-DCMAKE_INSTALL_PREFIX=$GFX_BUILD_HOME/install/llvm-spirv || exit 1
make install -j`nproc`
# https://github.com/intel/opencl-clang/tree/ocl-open-110#out-of-tree-build
cd $GFX_BUILD_HOME || exit 1
mkdir -p install/opencl-clang
mkdir -p build/opencl-clang
rm -rf install/opencl-clang/*
cd $GFX_BUILD_HOME/build/opencl-clang || exit 1
cmake $GFX_BUILD_HOME/opencl-clang \
-DPREFERRED_LLVM_VERSION="$IGC_LLVM_VERSION" \
-DLLVMSPIRV_INCLUDED_IN_LLVM=OFF \
-DLLVM_DIR=$GFX_BUILD_HOME/install/llvm/lib/cmake/llvm/ \
-DSPIRV_TRANSLATOR_DIR=$GFX_BUILD_HOME/install/llvm-spirv \
-DCMAKE_INSTALL_PREFIX=$GFX_BUILD_HOME/install/opencl-clang || exit 1
make all -j`nproc`
make install
# https://github.com/intel/intel-graphics-compiler/blob/igc-1.0.8744/documentation/build_ubuntu.md#use-preinstalled-packages
cd $GFX_BUILD_HOME || exit 1
mkdir -p install/igc
mkdir -p build/igc
rm -rf install/igc/*
cd $GFX_BUILD_HOME/build/igc || exit 1
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$GFX_BUILD_HOME/install/igc \
-DLLVM_DIR=$GFX_BUILD_HOME/install/llvm/lib/cmake/llvm/ \
-DIGC_OPTION__LLVM_PREFERRED_VERSION=$IGC_LLVM_VERSION \
$GFX_BUILD_HOME/igc/ || exit 1
make install -j`nproc`
echo "Done"