xref: /aosp_15_r20/external/pytorch/aten/conda/build.sh (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1#!/bin/bash
2
3set -e
4
5if [ -z "$PREFIX" ]; then
6  PREFIX="$CONDA_PREFIX"
7fi
8
9# When conda-build constructs a new working copy to perform a build
10# in, it recursively copies *all* files and directories in the original
11# source directory, including any pre-existing build products (e.g.,
12# if you previously ran cmake.)  This is problematic, because if
13# a 'build' directory already exists, cmake will reuse build settings
14# rather than recompute them from scratch.  We want a fresh build, so
15# we prophylactically remove the build directory.
16rm -rf build || true
17
18mkdir -p build
19cd build
20cmake -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" -DCMAKE_BUILD_TYPE=Release $CONDA_CMAKE_ARGS ..
21make install -j20
22