1#!/bin/bash 2# Copyright (c) Meta Platforms, Inc. and affiliates. 3# All rights reserved. 4# 5# This source code is licensed under the BSD-style license found in the 6# LICENSE file in the root directory of this source tree. 7 8set -exu 9 10# shellcheck source=/dev/null 11source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" 12 13which "${PYTHON_EXECUTABLE}" 14# Just set this variable here, it's cheap even if we use buck2 15CMAKE_OUTPUT_DIR=cmake-out 16 17build_cmake_quantized_aot_lib() { 18 echo "Building quantized aot lib" 19 SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" 20 CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch" 21 (rm -rf ${CMAKE_OUTPUT_DIR} \ 22 && mkdir ${CMAKE_OUTPUT_DIR} \ 23 && cd ${CMAKE_OUTPUT_DIR} \ 24 && retry cmake -DCMAKE_BUILD_TYPE=Release \ 25 -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \ 26 -DEXECUTORCH_BUILD_KERNELS_QUANTIZED_AOT=ON \ 27 -DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..) 28 29 cmake --build ${CMAKE_OUTPUT_DIR} -j4 30} 31 32build_cmake_quantized_aot_lib 33