MediaPipe
github:https://github.com/google/mediapipe
MediaPipe 的主要概念
數據包(Packet)
數據流(Stream)
計算單元(Calculator)
圖(Graph)
子圖(Subgraph)
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 --action_env PYTHON_BIN_PATH="C://Python//Python36//python.exe" mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu --verbose_failures
注意:
Building C++ command-line example apps
To build, for example, MediaPipe Hands, run:
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
如遇到python錯誤,命令中指定python路徑 --action_env PYTHON_BIN_PATH="C://Python//Python36//python.exe"
例:
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 --action_env PYTHON_BIN_PATH="C://Python//Python36//python.exe" mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu --verbose_failures
Bazel
中文筆記推薦:https://blog.gmem.cc/bazel-study-note
使用Bazel編譯項目
在https://github.com/bazelbuild/examples/,可以clone到本地試一下
1 編譯你的第一個Bazel項目
首先進入到cpp-tutorial/stage1目錄下,然后運行以下指令:
bazel build //main:hello-world
注意target中的//main:
是BUILD文件相對於WORKSPACE文件的位置,hello-world
則是我們在BUILD文件中命名好的target的名字。
現在你可以測試你剛剛生成的二進制文件了:
bazel-bin/main/hello-world
查看依賴圖
生成依賴圖的一段文字描述(即在工作區根目錄下運行下述指令):
bazel query --nohost_deps --noimplicit_deps 'deps(//main:hello-world)' --output graph
這個指令告訴Bazel查找target //main:hello-world
的所有依賴項(不包括host和隱式依賴),然后輸出圖的文字描述。再把文字描述貼到GraphViz里,可以看到依賴圖。
2 多個target的編譯
cpp-tutorial/stage2/main
3 多個package的編譯
cpp-tutorial/stage3
bazel使用windows.h
https://github.com/bazelbuild/bazel/tree/master/examples/windows/dll
bazel build //examples/windows/dll:hello_world-link-to-dll-via-lib
例:bazel-windows-demo
bazel build //main:test