Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pvelesko committed Sep 16, 2024
1 parent de40ab9 commit 26fda4f
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions scripts/configure_llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ if [ "$ONLY_NECESSARY_SPIRV_EXTS" != "on" ] && [ "$ONLY_NECESSARY_SPIRV_EXTS" !=
exit 1
fi

# get the gcc base path to use in cmake flags
gcc_base_path=$( which gcc | sed s+'bin/gcc'++ )

# set the brach name for checkuot based on only-necessary-spirv-exts
if [ "$4" == "on" ]; then
Expand Down Expand Up @@ -119,14 +117,24 @@ else
cd ${LLVM_DIR}
fi

# check if the build directory exists, if not create it
if [ ! -d build_$VERSION ]; then
# check if the build directory exists
if [ -d build_$VERSION ]; then
read -p "Build directory build_$VERSION already exists. Do you want to delete it and continue? (y/n) " answer
case ${answer:0:1} in
y|Y )
echo "Deleting existing build directory..."
rm -rf build_$VERSION
mkdir build_$VERSION
cd build_$VERSION
;;
* )
echo "Build directory not deleted. Exiting."
exit 1
;;
esac
else
mkdir build_$VERSION
cd build_$VERSION
else
# Warn the user, error out
echo "Build directory build_$VERSION already exists, please remove it and re-run the script"
exit 1
fi

# Check if /usr/include/plugin-api.h exists
Expand Down Expand Up @@ -175,35 +183,36 @@ fi
# Add build type condition
if [ "$LINK_TYPE" == "static" ]; then
cmake ../ \
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang;openmp;clang-tools-extra" \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV" \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DGCC_INSTALL_PREFIX=${gcc_base_path}\
-DCMAKE_CXX_COMPILER=$(which g++) \
-DCMAKE_C_COMPILER=$(which gcc) \
-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,${gcc_base_path}/lib64 -L${gcc_base_path}/lib64" \
-DLLVM_ENABLE_ASSERTIONS=On \
-DLLVM_BINUTILS_INCDIR=${BINUTILS_HEADER_DIR}
-DLLVM_BINUTILS_INCDIR="${BINUTILS_HEADER_DIR}"
elif [ "$LINK_TYPE" == "dynamic" ]; then
cmake ../ \
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DCMAKE_INSTALL_RPATH=${INSTALL_DIR}/lib \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DCMAKE_INSTALL_RPATH="${INSTALL_DIR}/lib" \
-DLLVM_ENABLE_PROJECTS="clang;openmp;clang-tools-extra" \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV" \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_PARALLEL_LINK_JOBS=2 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DGCC_INSTALL_PREFIX=${gcc_base_path}\
-DCMAKE_CXX_COMPILER=$(which g++) \
-DCMAKE_C_COMPILER=$(which gcc) \
-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,${gcc_base_path}/lib64 -L${gcc_base_path}/lib64" \
-DLLVM_BINUTILS_INCDIR=${BINUTILS_HEADER_DIR} \
-DLLVM_BINUTILS_INCDIR="${BINUTILS_HEADER_DIR}" \
-DLLVM_ENABLE_ASSERTIONS=On
else
echo "Invalid link_type. Must be 'static' or 'dynamic'."
exit 1
fi

# Clean up the temporary configuration file
rm -f "$CLANG_CONFIG_FILE"

0 comments on commit 26fda4f

Please sign in to comment.