Skip to content

Commit 2327924

Browse files
committed
test
1 parent 610f398 commit 2327924

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

install_executorch.py

-5
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,8 @@ def main(args):
205205
cmake_args = [os.getenv("CMAKE_ARGS", "")]
206206
use_pytorch_nightly = True
207207

208-
has_pybindings = False
209208
wants_pybindings_off, pybind_defines = _list_pybind_defines(args)
210209
if not wants_pybindings_off:
211-
has_pybindings = True
212210
if len(pybind_defines) > 0:
213211
# If the user explicitly provides a list of bindings, just use them
214212
cmake_args += pybind_defines
@@ -217,9 +215,6 @@ def main(args):
217215
# a list, then turn on xnnpack by default
218216
cmake_args.append("-DEXECUTORCH_BUILD_XNNPACK=ON")
219217

220-
if has_pybindings:
221-
cmake_args.append("-DEXECUTORCH_BUILD_PYBIND=ON")
222-
223218
if args.clean:
224219
clean()
225220
return

setup.py

+25-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,31 @@ def _is_cmake_arg_enabled(var: str, default: bool) -> bool:
107107

108108
@classmethod
109109
def pybindings(cls) -> bool:
110-
return cls._is_cmake_arg_enabled("EXECUTORCH_BUILD_PYBIND", default=False)
110+
user_defined = _cmake_args_defines().get("EXECUTORCH_BUILD_PYBIND", None)
111+
if user_defined is not None:
112+
return cls._is_truthy(user_defined)
113+
# If the user hasn't specified anything, we want to turn this on if any
114+
# bindings are requested explicitly.
115+
return any(
116+
[
117+
cls.coreml(),
118+
cls.mps(),
119+
cls.xnnpack(),
120+
cls.training(),
121+
]
122+
)
123+
124+
@classmethod
125+
def coreml(cls) -> bool:
126+
return cls._is_cmake_arg_enabled("EXECUTORCH_BUILD_COREML", default=False)
127+
128+
@classmethod
129+
def mps(cls) -> bool:
130+
return cls._is_cmake_arg_enabled("EXECUTORCH_BUILD_MPS", default=False)
131+
132+
@classmethod
133+
def xnnpack(cls) -> bool:
134+
return cls._is_cmake_arg_enabled("EXECUTORCH_BUILD_XNNPACK", default=False)
111135

112136
@classmethod
113137
def training(cls) -> bool:

0 commit comments

Comments
 (0)