mirror of https://github.com/llvm/torch-mlir
Use portable realpath. Its unavailable in !GNU (#145)
realpath is a GNUUtils package that is not available on recent OSX TEST=Build on OSX systems without GNUutils + zsh Change-Id: I573855b93a08e1746e0bb214be28b4a3ea8264capull/144/head
parent
4237172bbf
commit
d35724ad0d
|
@ -9,9 +9,13 @@
|
|||
# BUILD_DIR=/build ./build_tools/cmake_configure.sh [ARGS...]
|
||||
set -e
|
||||
|
||||
portable_realpath() {
|
||||
echo "$(cd $1 && pwd)"
|
||||
}
|
||||
|
||||
# Setup directories.
|
||||
td="$(realpath $(dirname $0)/..)"
|
||||
build_dir="$(realpath "${NPCOMP_BUILD_DIR:-$td/build}")"
|
||||
td="$(portable_realpath $(dirname $0)/..)"
|
||||
build_dir="$(portable_realpath "${NPCOMP_BUILD_DIR:-$td/build}")"
|
||||
build_mlir="${LLVM_BUILD_DIR-$build_dir/build-mlir}"
|
||||
install_mlir="${LLVM_INSTALL_DIR-$build_dir/install-mlir}"
|
||||
declare -a extra_opts
|
||||
|
@ -82,7 +86,7 @@ echo "Using llvm-lit: $LLVM_LIT"
|
|||
# Write a .env file for python tooling.
|
||||
function write_env_file() {
|
||||
echo "Updating $build_dir/.env file"
|
||||
echo "PYTHONPATH=\"$(realpath "$build_dir/python"):$(realpath "$install_mlir/python")\"" > "$build_dir/.env"
|
||||
echo "PYTHONPATH=\"$(portable_realpath "$build_dir/python"):$(portable_realpath "$install_mlir/python")\"" > "$build_dir/.env"
|
||||
echo "NUMPY_EXPERIMENTAL_ARRAY_FUNCTION=1" >> "$build_dir/.env"
|
||||
if ! cp "$build_dir/.env" "$td/.env"; then
|
||||
echo "WARNING: Failed to write $td/.env"
|
||||
|
|
|
@ -4,13 +4,18 @@
|
|||
# Usage (for aribtrary build/ directory):
|
||||
# BUILD_DIR=/build ./build_tools/install_mlir.sh
|
||||
set -e
|
||||
td="$(realpath $(dirname $0)/..)"
|
||||
build_dir="$(realpath "${NPCOMP_BUILD_DIR:-$td/build}")"
|
||||
|
||||
portable_realpath() {
|
||||
echo "$(cd $1 && pwd)"
|
||||
}
|
||||
|
||||
td="$(portable_realpath $(dirname $0)/..)"
|
||||
build_dir="$(portable_realpath "${NPCOMP_BUILD_DIR:-$td/build}")"
|
||||
build_mlir="${LLVM_BUILD_DIR-$build_dir/build-mlir}"
|
||||
install_mlir="${LLVM_INSTALL_DIR-$build_dir/install-mlir}"
|
||||
|
||||
# Find LLVM source (assumes it is adjacent to this directory).
|
||||
LLVM_SRC_DIR="$(realpath "${LLVM_SRC_DIR:-$td/external/llvm-project}")"
|
||||
LLVM_SRC_DIR="$(portable_realpath "${LLVM_SRC_DIR:-$td/external/llvm-project}")"
|
||||
|
||||
if ! [ -f "$LLVM_SRC_DIR/llvm/CMakeLists.txt" ]; then
|
||||
echo "Expected LLVM_SRC_DIR variable to be set correctly (got '$LLVM_SRC_DIR')"
|
||||
|
|
Loading…
Reference in New Issue