@@ -43,12 +43,56 @@ def get_vec_fbcode_preprocessor_flags():
43
43
]
44
44
return preprocessor_flags
45
45
46
+ def get_apple_framework_deps_kwargs (is_fbcode ):
47
+ # various ovr_configs are not available in oss
48
+ if not runtime .is_oss and not is_fbcode :
49
+ # Jump through few hoops since 'frameworks' is not a valid kwarg
50
+ # for some buck rules
51
+ frameworks = {'frameworks' : select ({
52
+ "DEFAULT" : [],
53
+ "ovr_config//os:iphoneos" : ["$SDKROOT/System/Library/Frameworks/Accelerate.framework" ],
54
+ "ovr_config//os:macos-arm64" : ["$SDKROOT/System/Library/Frameworks/Accelerate.framework" ],
55
+ "ovr_config//os:macos-x86_64" : ["$SDKROOT/System/Library/Frameworks/Accelerate.framework" ],
56
+ })}
57
+ return frameworks
58
+ return {'fbobjc_frameworks' : ["Accelerate" ]}
59
+
60
+ def get_preprocessor_flags ():
61
+ # various ovr_configs are not available in oss
62
+ preprocessor_flags = select ({
63
+ ":linux-x86_64" : [
64
+ "-DET_BUILD_WITH_BLAS" ,
65
+ ] if not runtime .is_oss else [],
66
+ "DEFAULT" : [],
67
+ })
68
+
69
+ if not runtime .is_oss :
70
+ # various ovr_configs are not available in oss
71
+ additional_preprocessor_flags = select ({
72
+ "ovr_config//os:iphoneos" : [
73
+ "-DET_BUILD_WITH_BLAS" ,
74
+ "-DET_BUILD_FOR_APPLE" ,
75
+ ] if not runtime .is_oss else [],
76
+ "ovr_config//os:macos-arm64" : [
77
+ "-DET_BUILD_WITH_BLAS" ,
78
+ "-DET_BUILD_FOR_APPLE" ,
79
+ ] if not runtime .is_oss else [],
80
+ "ovr_config//os:macos-x86_64" : [
81
+ "-DET_BUILD_WITH_BLAS" ,
82
+ "-DET_BUILD_FOR_APPLE" ,
83
+ ] if not runtime .is_oss else [],
84
+ "DEFAULT" : [],
85
+ })
86
+ preprocessor_flags = preprocessor_flags + additional_preprocessor_flags
87
+ return preprocessor_flags
88
+
89
+
46
90
# Currently, having a dependency on fbsource//third-party/sleef:sleef may cause
47
91
# duplicate symbol errors when linking fbcode targets in opt mode that also
48
92
# depend on ATen. This is because ATen accesses sleef via the third-party folder
49
93
# in caffe2 (caffe2/third-party//sleef:sleef).
50
94
# TODO(ssjia): Enable -DCPU_CAPABILITY_AVX2 in fbcode, which requires sleef.
51
- def define_libs ():
95
+ def define_libs (is_fbcode = False ):
52
96
runtime .cxx_library (
53
97
name = "libvec" ,
54
98
srcs = [],
@@ -131,12 +175,7 @@ def define_libs():
131
175
"//executorch/..." ,
132
176
"@EXECUTORCH_CLIENTS" ,
133
177
],
134
- preprocessor_flags = select ({
135
- ":linux-x86_64" : [
136
- "-DET_BUILD_WITH_BLAS" ,
137
- ] if not runtime .is_oss else [],
138
- "DEFAULT" : [],
139
- }),
178
+ preprocessor_flags = get_preprocessor_flags (),
140
179
fbandroid_platform_preprocessor_flags = [
141
180
(
142
181
"^android-arm64.*$" ,
@@ -157,9 +196,6 @@ def define_libs():
157
196
"-DET_BUILD_WITH_BLAS" ,
158
197
"-DET_BUILD_FOR_APPLE" ,
159
198
],
160
- fbobjc_frameworks = [
161
- "Accelerate" ,
162
- ],
163
199
deps = select ({
164
200
":linux-x86_64" : [mkl_dep ] if not runtime .is_oss else [],
165
201
"DEFAULT" : [],
@@ -169,4 +205,5 @@ def define_libs():
169
205
"//executorch/kernels/optimized:libutils" ,
170
206
"//executorch/runtime/core/exec_aten:lib" ,
171
207
],
208
+ ** get_apple_framework_deps_kwargs (is_fbcode ),
172
209
)
0 commit comments