File tree 2 files changed +28
-6
lines changed
2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ def clean():
52
52
print ("Done cleaning build artifacts." )
53
53
54
54
55
+ # Please keep this insync with `ShouldBuild.pybindings` in setup.py.
55
56
VALID_PYBINDS = ["coreml" , "mps" , "xnnpack" , "training" ]
56
57
57
58
@@ -205,10 +206,8 @@ def main(args):
205
206
cmake_args = [os .getenv ("CMAKE_ARGS" , "" )]
206
207
use_pytorch_nightly = True
207
208
208
- has_pybindings = False
209
209
wants_pybindings_off , pybind_defines = _list_pybind_defines (args )
210
210
if not wants_pybindings_off :
211
- has_pybindings = True
212
211
if len (pybind_defines ) > 0 :
213
212
# If the user explicitly provides a list of bindings, just use them
214
213
cmake_args += pybind_defines
@@ -217,9 +216,6 @@ def main(args):
217
216
# a list, then turn on xnnpack by default
218
217
cmake_args .append ("-DEXECUTORCH_BUILD_XNNPACK=ON" )
219
218
220
- if has_pybindings :
221
- cmake_args .append ("-DEXECUTORCH_BUILD_PYBIND=ON" )
222
-
223
219
if args .clean :
224
220
clean ()
225
221
return
Original file line number Diff line number Diff line change @@ -107,7 +107,33 @@ def _is_cmake_arg_enabled(var: str, default: bool) -> bool:
107
107
108
108
@classmethod
109
109
def pybindings (cls ) -> bool :
110
- return cls ._is_cmake_arg_enabled ("EXECUTORCH_BUILD_PYBIND" , default = False )
110
+ return cls ._is_cmake_arg_enabled (
111
+ "EXECUTORCH_BUILD_PYBIND" ,
112
+ # If the user hasn't specified anything, we want to turn this on if any
113
+ # bindings are requested explicitly.
114
+ #
115
+ # Please keep this in sync with `VALID_PYBINDS` in install_executorch.py.
116
+ default = any (
117
+ [
118
+ cls .coreml (),
119
+ cls .mps (),
120
+ cls .xnnpack (),
121
+ cls .training (),
122
+ ]
123
+ ),
124
+ )
125
+
126
+ @classmethod
127
+ def coreml (cls ) -> bool :
128
+ return cls ._is_cmake_arg_enabled ("EXECUTORCH_BUILD_COREML" , default = False )
129
+
130
+ @classmethod
131
+ def mps (cls ) -> bool :
132
+ return cls ._is_cmake_arg_enabled ("EXECUTORCH_BUILD_MPS" , default = False )
133
+
134
+ @classmethod
135
+ def xnnpack (cls ) -> bool :
136
+ return cls ._is_cmake_arg_enabled ("EXECUTORCH_BUILD_XNNPACK" , default = False )
111
137
112
138
@classmethod
113
139
def training (cls ) -> bool :
You can’t perform that action at this time.
0 commit comments