arcana-lab / noelle

NOELLE Offers Empowering LLVM Extensions
MIT License
72 stars 35 forks source link

Update NOELLE script installation #111

Closed tommymcm closed 6 months ago

tommymcm commented 6 months ago

NOELLE's scripts are currently installed by injecting the install directory at a predefined spot. This creates a headache for the cmake build, which has to execute a command to perform the string insertion instead of just calling install(FILES ...).

This issue involves adding the following code at the top of each script, replacing the current installDir line:

SOURCE=${BASH_SOURCE[0]}
while [ -L "${SOURCE}" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR=$( cd -P "$( dirname "${SOURCE}" )" >/dev/null 2>&1 && pwd )
  SOURCE=$(readlink "${SOURCE}")
  # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
  [[ ${SOURCE} != /* ]] && SOURCE=$DIR/$SOURCE 
done
installDir=$(realpath $( cd -P "$( dirname "${SOURCE}" )" >/dev/null 2>&1 && pwd )/..)