blob: 59064307476d02e9fa9e2cc08e3e2ce9ea5e827c [file] [log] [blame]
#!/bin/bash
# Copyright 2021 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Sets up a CMake build. Requires that BUILD_DIR be set in the environment and
# expects to be *sourced* not invoked, since it sets environment variables.
set -euo pipefail
ROOT_DIR=$(git rev-parse --show-toplevel)
cd "${ROOT_DIR}"
CMAKE_BIN="${CMAKE_BIN:-$(which cmake)}"
"${CMAKE_BIN}" --version
ninja --version
if [[ -d "${BUILD_DIR}" ]]; then
echo "'${BUILD_DIR}' directory already exists. Will use cached results there."
else
echo "'${BUILD_DIR}' directory does not already exist. Creating a new one."
mkdir "${BUILD_DIR}"
fi