forked from flang-compiler/classic-flang-llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Bryan Chan edited this page Aug 25, 2020
·
7 revisions
Sample script (adapted from upstream instructions):
#!/bin/bash
buildtype=Debug
installdir=$PWD/install
if [ ! -d classic-flang-llvm ]; then
git clone https://github.com/Huawei-PTLab/classic-flang-llvm
fi
if [ ! -d flang ]; then
git clone https://github.com/flang-compiler/flang
fi
mkdir -p build/llvm
pushd build/llvm
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=$buildtype \
-DCMAKE_INSTALL_PREFIX=$installdir \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DLLVM_ENABLE_PROJECTS="clang;openmp" \
-DLLVM_ENABLE_CLASSIC_FLANG=on \
-DLLVM_ENABLE_ASSERTIONS=on \
-DLLVM_OPTIMIZED_TABLEGEN=on \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
../../classic-flang-llvm/llvm || exit 1
ninja -j1 install || exit 1
popd
if ! llvm_lit="$(realpath --canonicalize-existing $PWD/build/llvm/bin/llvm-lit 2>/dev/null)" || \
[ ! -x "$llvm_lit" ]; then
echo "no usable llvm-lit"
exit 1
fi
mkdir -p build/libpgmath
pushd build/libpgmath
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=$buildtype \
-DCMAKE_INSTALL_PREFIX=$installdir \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DLLVM_CONFIG=$installdir/bin/llvm-config \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
-DLIBPGMATH_LLVM_LIT_EXECUTABLE="$llvm_lit" \
../../flang/runtime/libpgmath || exit 1
ninja check-libpgmath install || exit 1
popd
mkdir -p build/flang
pushd build/flang
cmake -Wno-dev -G 'Unix Makefiles' \
-DCMAKE_BUILD_TYPE=$buildtype \
-DCMAKE_INSTALL_PREFIX=$installdir \
-DCMAKE_C_COMPILER=$installdir/bin/clang \
-DCMAKE_CXX_COMPILER=$installdir/bin/clang++ \
-DCMAKE_Fortran_COMPILER=$installdir/bin/flang \
-DLLVM_CONFIG=$installdir/bin/llvm-config \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
-DLLVM_EXTERNAL_LIT="$llvm_lit" \
../../flang || exit 1
make -j2 install || exit 1
make check-all || exit 1
popd
echo "SUCCESS"