Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*.so
**/*.framework/*
!**/*.framework/*.meta
**/*.framework.dSYM/*
!**/*.framework.dSYM/*.meta

bazel-*

Expand Down
15 changes: 13 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ def _copy(self, source, dest, mode=0o755):
self.console.v(f"Changing the mode of '{dest}'...")
os.chmod(dest, mode)

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

if ignore_nonexistent_source and not os.path.exists(source):
self.console.v(f"Tried to copy '{source}', but it does not exist")
return

if not os.path.exists(dest):
self.console.v(f"Creating '{dest}'...")
os.makedirs(dest, 0o755)
Expand Down Expand Up @@ -158,8 +162,15 @@ def run(self):

if self.command_args.ios:
self.console.info('Building native libaries for iOS...')
ios_plugin_dst = os.path.join(_BUILD_RUNTIME_PATH, 'Plugins', 'iOS')
self._run_command(self._build_ios_commands())
self._unzip(self._find_latest_built_framework(), os.path.join(_BUILD_RUNTIME_PATH, 'Plugins', 'iOS'))
self._unzip(self._find_latest_built_framework(), ios_plugin_dst)

# Copy dSYM files if they exist (when built with `--apple_generate_dsym`)
self._copytree(
os.path.join(_BAZEL_BIN_PATH, 'mediapipe_api', 'objc', 'MediaPipeUnity.framework.dSYM'),
os.path.join(ios_plugin_dst, 'MediaPipeUnity.framework.dSYM'),
ignore_nonexistent_source=True)

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

Expand Down