-
Clone the repository, remember to initialize the submodules.
git submodule update --init --recursive [--depth=1]
-
Install Bazelisk or Bazel version that meets MediaPipe requirement.
-
Run
setup.py
to generate the godot-cpp bindings as well as apply/setup source code to themediapipe
workspace. Runsetup.py --help
to view the various options.
Example:
./setup.py --godot-binary path/to/godot/binary
- Copy
addons
to your Godot project's root directory. - (Optional) Add calculator dependencies in
GDMP/GDMP.bzl
if you have additional calculators to compile into GDMP.
build.py
is a wrapper script that invoke Bazel build commands in mediapipe
workspace to build GDMP libraries.
Common usage:
./build.py [target] --type [debug/release] --output [output-dir]
Run build.py --help
to see all options.
Windows users: Cross-compiling Android library on Windows is currently not supported, please set up WSL or Linux VM before proceed to the instructions below.
-
Install Android SDK and NDK, then setting
ANDROID_HOME
andANDROID_NDK_HOME
environment variable that point to your install location.You will also need to uncomment the last 3 lines of
mediapipe/WORKSPACE
(includingandroid_sdk_repository
andandroid_ndk_repository
) that added eariler during setup.Refer to MediaPipe docs for more details.
-
Build Android libraries. For example, run:
build.py android --arch arm64-v8a
to build library for
arm64-v8a
architecture, you can pass comma-separated list to build multiple architectures. If--arch
is omitted, building native libraries will be skipped, and procceed to build Android AAR directly. You can use--android-skip-aar
to skip building Android AAR.
-
Install Xcode, then switch to installed Xcode by using
xcode-select
-
Run
build.py ios
to build iOS libraryBazel should build GDMP for your Mac's CPU architecture by default, if you would like to build multiple architectures, append
--arch x86_64,arm64
to the build command to build both x86_64 and arm64 architectures for example.
Flatpak environment: If you intend to distribute the library, you might want to use an environment isolated from host before you proceed. You can use scripts/flatpak_env.sh
to enable Flatpak environment.
- Run
build.py desktop
to build desktop library.
Linking prebuilt OpenCV: GDMP builds OpenCV from source on Linux by default, if you want to use pre-compiled OpenCV libraries, you will need to:
- Modify
mediapipe/third_party/opencv_linux.BUILD
to make OpenCV installed on your host visible to Bazel. - Comment out
--define=OPENCV=source
frombuild.py
to make Bazel using binary OpenCV rules.
When linking prebuilt OpenCV libraries, build script will not copy required libraries to output destination, make sure they can be found by dynamic linker.
-
Install MSVC compiler and Windows SDK, then setting
BAZEL_VC
environment variable pointing to your VC installation.Refer to Bazel documentation for more details.
-
Bash is required for building MediaPipe, make sure
bash
is inPATH
or settingBAZEL_SH
environment variable pointing to it.Bash can be installed from Git for Windows or MSYS2
-
Install OpenCV and configure
mediapipe
workspace:- Modify
mediapipe/WORKSPACE
forpath
underwindows_opencv
if OpenCV is not installed onC:\opencv
- Modify
OPENCV_VERSION
inmediapipe/third_party/opencv_windows.BUILD
if OpenCV version is not3.4.10
Refer to MediaPipe documentation for more details.
- Modify
-
Run
build.py desktop
to build desktop library.