diff --git a/install_requirements.sh b/install_requirements.sh index 966ccd8a9be..d541a30b221 100755 --- a/install_requirements.sh +++ b/install_requirements.sh @@ -27,7 +27,6 @@ fi # Parse options. EXECUTORCH_BUILD_PYBIND=OFF -CMAKE_ARGS="" for arg in "$@"; do case $arg in @@ -110,4 +109,5 @@ $PIP_EXECUTABLE install --extra-index-url "${TORCH_NIGHTLY_URL}" \ EXECUTORCH_BUILD_PYBIND="${EXECUTORCH_BUILD_PYBIND}" \ CMAKE_ARGS="${CMAKE_ARGS}" \ + CMAKE_BUILD_ARGS="${CMAKE_BUILD_ARGS}" \ $PIP_EXECUTABLE install . --no-build-isolation -v diff --git a/setup.py b/setup.py index 6591123d5e6..413a028e1e2 100644 --- a/setup.py +++ b/setup.py @@ -398,6 +398,14 @@ def run(self): if "CMAKE_ARGS" in os.environ: cmake_args += [item for item in os.environ["CMAKE_ARGS"].split(" ") if item] + # Allow adding extra build args through the environment. Used by some + # tests and demos to expand the set of targets included in the pip + # package. + if "CMAKE_BUILD_ARGS" in os.environ: + build_args += [ + item for item in os.environ["CMAKE_BUILD_ARGS"].split(" ") if item + ] + # Put the cmake cache under the temp directory, like # "pip-out/temp./cmake-out". cmake_cache_dir = os.path.join(repo_root, self.build_temp, "cmake-out")