Skip to content
Snippets Groups Projects
Commit 8d65fc69 authored by Akash Kothari's avatar Akash Kothari
Browse files

Adding option of more targets to install script

parent 5dac5b40
No related branches found
No related tags found
No related merge requests found
...@@ -28,18 +28,107 @@ LLVM_SRC="llvm-$VERSION.src" ...@@ -28,18 +28,107 @@ LLVM_SRC="llvm-$VERSION.src"
HPVM_RT=hpvm-rt/hpvm-rt.bc HPVM_RT=hpvm-rt/hpvm-rt.bc
read_yn "Build and install HPVM automatically?" AUTOMATE
echo TARGET=all
read -p "Number of threads: " NUM_THREADS TARGET_INPUT=all
FLAGGED=false
# Get flags
while getopts 'hmj:t:' opt; do
case $opt in
h)
echo
echo
echo "This is the help menu for HPVM installation"
echo
echo "There are 3 options for installation:"
echo
echo "-m is a manual installation flag. This will require you to install HPVM manually by running cmake and make manually."
echo "For more details, refer to README.md. Defaults to automatic installation."
echo
echo "-j is the threads flag. Accepts one argument: how many threads to build with."
echo "To build with 2 threads, enter -j2. Defaults to 2 threads."
echo
echo "-t is the build target flag. Accepts one argument: which build target(s) you would like to build to."
echo "For single target, enter -a ARM. For multiple targets, enter -t \"X86;ARM\"."
echo "Supports the following targets: AArch64, AMDGPU, ARM, BPF, Hexagon, Mips, MSP430, NVPTX, PowerPC, Sparc, SystemZ, X86, XCore."
echo "Defaults to targeting all supported architectures."
echo
echo "If no flags are provided, the script will use command line prompts for all options."
echo
exit
;;
m)
AUTOMATE=false
FLAGGED=true
;;
j)
if ! [[ $OPTARG =~ ^[0-9]+$ ]]; then
echo "Invalid argument for # of threads: $OPTARG"
exit -1;
else
NUM_THREADS=$OPTARG
FLAGGED=true
fi
;;
t)
TARGET=$OPTARG
FLAGGED=true
;;
esac
done
if $FLAGGED; then
echo "Running with the following options:"
echo Automated: $AUTOMATE
echo Threads: $NUM_THREADS
echo Targets: $TARGET
echo
else
echo "No Flags found. Using command line prompts."
read -p "Build and install HPVM automatically? (y or n): " AUTOMATE_INPUT
if [[ $AUTOMATE_INPUT == "" ]]; then
echo "No input given. Using default: $AUTOMATE"
elif [[ ! $AUTOMATE_INPUT == "y" ]] && [[ ! $AUTOMATE_INPUT == "n" ]]; then
echo "Invalid input. Using default: $AUTOMATE"
elif [[ $AUTOMATE_INPUT == "n" ]]; then
AUTOMATE=false
fi
if [ ! $NUM_THREADS -gt 0 ]; then
NUM_THREADS = 2
echo echo
echo Using $NUM_THREADS threads by default. read -p "Number of threads: " NUM_THREADS_INPUT
if [[ $NUM_THREADS_INPUT == "" ]]; then
echo "No input given. Using default: $NUM_THREADS"
elif ! [[ $NUM_THREADS_INPUT =~ ^[0-9]+$ ]]; then
echo "Given input is not an integer. Using default: $NUM_THREADS"
elif [ ! $NUM_THREADS_INPUT -gt 0 ]; then
echo "Given input is not greater than 0. Using default: $NUM_THREADS"
else
NUM_THREADS=$NUM_THREADS_INPUT
fi
echo
echo
echo "Supports the following options: AArch64, AMDGPU, ARM, BPF, Hexagon, Mips, MSP430, NVPTX, PowerPC, Sparc, SystemZ, X86, XCore."
echo "If building for multiple targets, seperate options with semicolon:"
echo "e.g. X86;ARM"
read -p "Build target: " TARGET_INPUT
if [[ $TARGET_INPUT == "" ]]; then
echo "No input given. Using default: $TARGET"
else
TARGET=$TARGET_INPUT
fi
echo echo
fi
echo "Running with the following options:"
echo Automated: $AUTOMATE
echo Threads: $NUM_THREADS
echo Targets: $TARGET
echo
fi
if [ -d $LLVM_SRC ]; then if [ -d $LLVM_SRC ]; then
echo Found $LLVM_SRC, not dowloading it again! echo Found $LLVM_SRC, not dowloading it again!
...@@ -113,9 +202,16 @@ cd $CURRENT_DIR/llvm_patches ...@@ -113,9 +202,16 @@ cd $CURRENT_DIR/llvm_patches
echo Patches applied. echo Patches applied.
if [ ! $AUTOMATE == "y" ]; then if ! $AUTOMATE ; then
echo echo
echo HPVM not installed. Exiting. echo "HPVM not installed."
echo "To complete installation, follow these instructions:"
echo " - Create and navigate to a folder \"./build\" "
echo " - Run \"cmake ../llvm [options]\". Find potential options in README.md."
echo " - Run \"make -j<number of threads>\" and then \"make install\""
echo "For more details refer to README.md."
echo
echo "Exiting."
exit exit
fi fi
...@@ -136,8 +232,8 @@ if [ ! -d $INSTALL_DIR ]; then ...@@ -136,8 +232,8 @@ if [ ! -d $INSTALL_DIR ]; then
fi fi
cd $BUILD_DIR cd $BUILD_DIR
echo cmake ../$LLVM_SRC -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR echo cmake ../$LLVM_SRC -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_TARGETS_TO_BUILD=$TARGET -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
cmake ../$LLVM_SRC -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR cmake ../$LLVM_SRC -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_TARGETS_TO_BUILD=$TARGET -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
echo make -j$NUM_THREADS echo make -j$NUM_THREADS
make -j$NUM_THREADS make -j$NUM_THREADS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment