Skip to content

Commit f871ece

Browse files
committed
build: make --apple_generate_dsym optional
1 parent 0a446ae commit f871ece

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

build.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,13 @@ def _copy(self, source, dest, mode=0o755):
6969
self.console.v(f"Changing the mode of '{dest}'...")
7070
os.chmod(dest, mode)
7171

72-
def _copytree(self, source, dest):
72+
def _copytree(self, source, dest, ignore_nonexistent_source=False):
7373
self.console.v(f"Copying '{source}' to '{dest}' recursively...")
7474

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+
7579
if not os.path.exists(dest):
7680
self.console.v(f"Creating '{dest}'...")
7781
os.makedirs(dest, 0o755)
@@ -161,9 +165,12 @@ def run(self):
161165
ios_plugin_dst = os.path.join(_BUILD_RUNTIME_PATH, 'Plugins', 'iOS')
162166
self._run_command(self._build_ios_commands())
163167
self._unzip(self._find_latest_built_framework(), ios_plugin_dst)
168+
169+
# Copy dSYM files if they exist (when built with `--apple_generate_dsym`)
164170
self._copytree(
165171
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)
167174

168175
self.console.info('Built native libraries for iOS')
169176

@@ -303,7 +310,6 @@ def _build_ios_commands(self):
303310
commands = self._build_common_commands()
304311
commands += [f'--config=ios_{self.command_args.ios}']
305312
commands += self._build_opencv_switch()
306-
commands.append('--apple_generate_dsym')
307313

308314
commands.append('//mediapipe_api/objc:MediaPipeUnity')
309315
return commands

0 commit comments

Comments
 (0)