Skip to content

Commit

Permalink
Optilation (#10)
Browse files Browse the repository at this point in the history
* Update bazel version

* Use debug symbols on CI

* Deploy: Gotta go fast

* Disable MacOS builds (we poor)

* Would this work?

* Only target .NET 6

There's a problem that occurs when trying to target multiple frameworks. :/

* Comment out Android NDK and SDK from WORKSPACE

* Setup compile commands for VSCode

* Update apt packages on CI

* Fix version number

* Remove emscripten dependency

* Setup MSBuild on Windows CI

* Add MSBuild setup options

* Remove `dbg` flag on Windows :(

* Use Windows Server 2019 runner
  • Loading branch information
Speykious authored Mar 20, 2022
1 parent 09a7175 commit 7eb3d55
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.2
5.0.0
28 changes: 14 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ jobs:
matrix:
os:
- name: Windows
runner: windows-latest
runner: windows-2019
cache-path: C:/_bzl
- name: Linux_CPU
runner: ubuntu-latest
cache-path: ~/.cache/bazel
- name: Linux_GPU
runner: ubuntu-latest
cache-path: ~/.cache/bazel
- name: MacOS
runner: macos-latest
cache-path: ~/_bzl
# - name: MacOS
# runner: macos-latest
# cache-path: ~/_bzl
steps:
- name: Cache Bazel directory
uses: actions/cache@v2
Expand All @@ -115,7 +115,7 @@ jobs:

- name: Setup EGL (Linux, GPU)
if: ${{ matrix.os.name == 'Linux_GPU' }}
run: sudo apt install libglfw3-dev libgles2-mesa-dev
run: sudo apt update && sudo apt install libglfw3-dev libgles2-mesa-dev

- name: Setup .NET 6
uses: actions/setup-dotnet@v1
Expand All @@ -133,19 +133,19 @@ jobs:

- name: Build Native Library (*nix, CPU)
if: ${{ matrix.os.name != 'Windows' && matrix.os.name != 'Linux_GPU' }}
run: python build.py build --no-install --no-protobuf --desktop cpu --opencv cmake -vv
run: python build.py build --no-install --no-protobuf -c dbg --desktop cpu --opencv cmake -vv

- name: Build Native Library (Linux, GPU)
if: ${{ matrix.os.name == 'Linux_GPU' }}
run: python build.py build --no-install --no-protobuf --desktop gpu --opencv cmake -vv
run: python build.py build --no-install --no-protobuf -c dbg --desktop gpu --opencv cmake -vv

- name: Build Native Library (Windows, CPU)
if: ${{ matrix.os.name == 'Windows' }}
run: |
echo "Setting PYTHON_BIN_PATH to python in PATH"
$env:PYTHON_BIN_PATH=(Get-Command python).Path
echo $env:PYTHON_BIN_PATH
python build.py build --no-install --no-protobuf --desktop cpu --opencv cmake -vv
python build.py build --no-install --no-protobuf -c dbg --desktop cpu --opencv cmake -vv
- name: Upload Build Artifacts (${{ matrix.os.name }})
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -198,12 +198,12 @@ jobs:
name: Build.Linux_GPU
path: build/

- name: Download MacOS build artifacts
if: ${{ matrix.comp == 'CPU' }}
uses: actions/download-artifact@v2
with:
name: Build.MacOS
path: build/
# - name: Download MacOS build artifacts
# if: ${{ matrix.comp == 'CPU' }}
# uses: actions/download-artifact@v2
# with:
# name: Build.MacOS
# path: build/

- name: Install artifacts
run: python build.py build --no-protobuf -vv
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/deploy-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ jobs:
- name: Linux_GPU
runner: ubuntu-latest
cache-path: ~/.cache/bazel
- name: MacOS
runner: macos-latest
cache-path: ~/_bzl
# - name: MacOS
# runner: macos-latest
# cache-path: ~/_bzl
steps:
- name: Cache Bazel directory
uses: actions/cache@v2
Expand Down Expand Up @@ -126,19 +126,19 @@ jobs:

- name: Build Native Library (*nix, CPU)
if: ${{ matrix.os.name != 'Windows' && matrix.os.name != 'Linux_GPU' }}
run: python build.py build --no-install --no-protobuf --desktop cpu --opencv cmake -vv
run: python build.py build --no-install --no-protobuf -c fastbuild --desktop cpu --opencv cmake -vv

- name: Build Native Library (Linux, GPU)
if: ${{ matrix.os.name == 'Linux_GPU' }}
run: python build.py build --no-install --no-protobuf --desktop gpu --opencv cmake -vv
run: python build.py build --no-install --no-protobuf -c fastbuild --desktop gpu --opencv cmake -vv

- name: Build Native Library (Windows, CPU)
if: ${{ matrix.os.name == 'Windows' }}
run: |
echo "Setting PYTHON_BIN_PATH to python in PATH"
$env:PYTHON_BIN_PATH=(Get-Command python).Path
echo $env:PYTHON_BIN_PATH
python build.py build --no-install --no-protobuf --desktop cpu --opencv cmake -vv
python build.py build --no-install --no-protobuf -c fastbuild --desktop cpu --opencv cmake -vv
- name: Upload Build Artifacts (${{ matrix.os.name }})
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -191,12 +191,12 @@ jobs:
name: Build.Linux_GPU
path: build/

- name: Download MacOS build artifacts
if: ${{ matrix.comp == 'CPU' }}
uses: actions/download-artifact@v2
with:
name: Build.MacOS
path: build/
# - name: Download MacOS build artifacts
# if: ${{ matrix.comp == 'CPU' }}
# uses: actions/download-artifact@v2
# with:
# name: Build.MacOS
# path: build/

- name: Install artifacts
run: python build.py build --no-protobuf -vv
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ $RECYCLE.BIN/

# Bazel
bazel-*
compile_commands.json

# Build and binary folders
build/
Expand Down
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"bsv.bazel.buildFlags": ["-c", "opt", "--define", "MEDIAPIPE_DISABLE_GPU=1"],
"bsv.cc.compdb.targets": [
"//mediapipe_api/framework/...",
"//mediapipe_api/graphs/...",
"//mediapipe_api/modules/...",
"//mediapipe_api/util/...",
"//mediapipe_api:calculators",
"//mediapipe_api:common",
"//mediapipe_api:mediapipe_c",
]
}
4 changes: 2 additions & 2 deletions Mediapipe.Net.Runtime.CPU/Mediapipe.Net.Runtime.CPU.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Project">
<TargetFrameworks>net6.0;netstandard2.1</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyTitle>Mediapipe.Net.Runtime.CPU</AssemblyTitle>
<AssemblyName>Mediapipe.Net.Runtime.CPU</AssemblyName>
Expand All @@ -10,7 +10,7 @@
<PropertyGroup Label="Nuget">
<IsPackable>true</IsPackable>
<PackageId>Mediapipe.Net.Runtime.CPU</PackageId>
<Version>0.8.9</Version>
<Version>0.8.9.1</Version>
<Authors>homuler;Vignette</Authors>
<PackageTags>Google;Mediapipe;Tracking;Media Analysis</PackageTags>
<Title>Mediapipe.Net.Runtime.CPU</Title>
Expand Down
4 changes: 2 additions & 2 deletions Mediapipe.Net.Runtime.GPU/Mediapipe.Net.Runtime.GPU.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Project">
<TargetFrameworks>net6.0;netstandard2.1</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyTitle>Mediapipe.Net.Runtime.GPU</AssemblyTitle>
<AssemblyName>Mediapipe.Net.Runtime.GPU</AssemblyName>
Expand All @@ -10,7 +10,7 @@
<PropertyGroup Label="Nuget">
<IsPackable>true</IsPackable>
<PackageId>Mediapipe.Net.Runtime.GPU</PackageId>
<Version>0.8.9</Version>
<Version>0.8.9.1</Version>
<Authors>homuler;Vignette</Authors>
<PackageTags>Google;Mediapipe;Tracking;Media Analysis</PackageTags>
<Title>Mediapipe.Net.Runtime.GPU</Title>
Expand Down
18 changes: 9 additions & 9 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -325,17 +325,17 @@ http_archive(
)

# You may run setup_android.sh to install Android SDK and NDK.
android_ndk_repository(
name = "androidndk",
# If you need to support older versions of Android, please specify the API Level.
# Otherwise, some symbols in libmediapipe_jni.so cannot be resolved and `DllNotFoundException` will be thrown.
# android_ndk_repository(
# name = "androidndk",
# # If you need to support older versions of Android, please specify the API Level.
# # Otherwise, some symbols in libmediapipe_jni.so cannot be resolved and `DllNotFoundException` will be thrown.

# api_level = 21,
)
# # api_level = 21,
# )

android_sdk_repository(
name = "androidsdk",
)
# android_sdk_repository(
# name = "androidsdk",
# )

# iOS basic build deps.

Expand Down
8 changes: 0 additions & 8 deletions third_party/mediapipe_extension.diff
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ diff --git a/mediapipe/calculators/tensor/BUILD b/mediapipe/calculators/tensor/B
index 72c2f51..d43c261 100644
--- a/mediapipe/calculators/tensor/BUILD
+++ b/mediapipe/calculators/tensor/BUILD
@@ -35,6 +35,7 @@ selects.config_setting_group(
name = "compute_shader_unavailable",
match_any = [
"//mediapipe/gpu:disable_gpu",
+ "//mediapipe:emscripten",
],
)

@@ -572,6 +573,11 @@ cc_library(
"//mediapipe/gpu:MPPMetalHelper",
"//mediapipe/gpu:gpu_buffer",
Expand Down

0 comments on commit 7eb3d55

Please sign in to comment.