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