@@ -69,9 +69,13 @@ def _copy(self, source, dest, mode=0o755):
69
69
self .console .v (f"Changing the mode of '{ dest } '..." )
70
70
os .chmod (dest , mode )
71
71
72
- def _copytree (self , source , dest ):
72
+ def _copytree (self , source , dest , ignore_nonexistent_source = False ):
73
73
self .console .v (f"Copying '{ source } ' to '{ dest } ' recursively..." )
74
74
75
+ if ignore_nonexistent_source and not os .path .exists (source ):
76
+ self .console .v (f"Tried to copy '{ source } ', but it does not exist" )
77
+ return
78
+
75
79
if not os .path .exists (dest ):
76
80
self .console .v (f"Creating '{ dest } '..." )
77
81
os .makedirs (dest , 0o755 )
@@ -161,9 +165,12 @@ def run(self):
161
165
ios_plugin_dst = os .path .join (_BUILD_RUNTIME_PATH , 'Plugins' , 'iOS' )
162
166
self ._run_command (self ._build_ios_commands ())
163
167
self ._unzip (self ._find_latest_built_framework (), ios_plugin_dst )
168
+
169
+ # Copy dSYM files if they exist (when built with `--apple_generate_dsym`)
164
170
self ._copytree (
165
171
os .path .join (_BAZEL_BIN_PATH , 'mediapipe_api' , 'objc' , 'MediaPipeUnity.framework.dSYM' ),
166
- os .path .join (ios_plugin_dst , 'MediaPipeUnity.framework.dSYM' ))
172
+ os .path .join (ios_plugin_dst , 'MediaPipeUnity.framework.dSYM' ),
173
+ ignore_nonexistent_source = True )
167
174
168
175
self .console .info ('Built native libraries for iOS' )
169
176
@@ -303,7 +310,6 @@ def _build_ios_commands(self):
303
310
commands = self ._build_common_commands ()
304
311
commands += [f'--config=ios_{ self .command_args .ios } ' ]
305
312
commands += self ._build_opencv_switch ()
306
- commands .append ('--apple_generate_dsym' )
307
313
308
314
commands .append ('//mediapipe_api/objc:MediaPipeUnity' )
309
315
return commands
0 commit comments