Skip to content

Commit 45099d4

Browse files
authored
Add runtime linking (#19)
* Add initial implementation of openvino-finder * Add initial implementation of xtask * Allow runtime linking in openvino-sys In order to link to the `inference_engine_c_api` library at runtime (instead of dynamically at startup), this change re-factors much of the openvino-sys library and build script: - the types and functions to link to are generated separately and included in-tree now - the generated functions are wrapped in a custom `link!` macro to decide which linking mechanism to use - by default, linking is performed dynamically at startup (`--features dynamic-linking`) but the crate can optionally be compiled with runtime linking (`--features runtime-linking`) - openvino-sys exposes a new `load(_: PathBuf)` function to load in the definitions of the shared library (a no-op in the dynamic linking case) - openvino-sys now exposes a `find() -> Option<PathBuf>` function which provides the path to the library linked to (necessary to calculate the `plugins.xml` location to use) * Add new CI tasks * Fix documentation warnings * Add runtime-linking documentation * Move load and find to openvino_sys::library * Implement 'cargo xtask codegen'
1 parent f7c8306 commit 45099d4

File tree

23 files changed

+2498
-161
lines changed

23 files changed

+2498
-161
lines changed

.cargo/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[alias]
2+
xtask = "run --package xtask --"

.github/workflows/main.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ jobs:
3535
- name: Install system dependencies
3636
run: sudo apt update && sudo apt install -y clang cmake libclang-dev gnupg2 libdrm2 libglib2.0-0 libusb-1.0-0-dev lsb-release libgtk-3-0 libtool udev unzip dos2unix
3737
- name: Build (openvino-sys from source)
38-
run: cargo build --verbose
38+
run: cargo build --verbose --features openvino-sys/from-source
3939
- name: Run tests
40-
run: cargo test --verbose
40+
run: cargo test --verbose --features openvino-sys/from-source
4141

4242
# Build and test from an existing OpenVINO installation inside a Docker image (i.e. download the
4343
# binaries, then compile against these).
44-
docker:
44+
dynamic_binaries:
4545
name: From binaries
4646
runs-on: ubuntu-latest
4747
strategy:
@@ -62,6 +62,37 @@ jobs:
6262
- name: Build the Docker image
6363
run: docker build . --tag openvino-rs:${{ matrix.OS }}-${{ matrix.version }}-$(date +%s) --build-arg OS=${{ matrix.os }} --build-arg VERSION=${{ matrix.version }}
6464

65+
# Build and test from an existing OpenVINO installation inside a Docker image (i.e. download the
66+
# binaries, then compile against these).
67+
runtime_binaries:
68+
name: From runtime-linked binaries
69+
runs-on: ubuntu-18.04
70+
steps:
71+
- uses: actions/checkout@v2
72+
with:
73+
submodules: recursive
74+
lfs: true
75+
- name: Checkout LFS obects
76+
run: git lfs checkout
77+
- uses: abrown/install-openvino-action@v1
78+
- name: Build and run tests
79+
run: |
80+
source /opt/intel/openvino/bin/setupvars.sh
81+
cargo test --features openvino-sys/runtime-linking
82+
83+
# Build and test from an existing OpenVINO installation inside a Docker image (i.e. download the
84+
# binaries, then compile against these).
85+
docs:
86+
name: Documentation
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@v2
90+
with:
91+
submodules: recursive
92+
lfs: true
93+
- name: Build documentation
94+
run: cargo doc --no-deps --features openvino-sys/runtime-linking
95+
6596
# Build and test the openvino-tensor-converter tool separately from the regular library builds;
6697
# the OpenCV dependency is a bit fragile so the crate is not included by the default workspace
6798
# commands.

Cargo.lock

Lines changed: 106 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[workspace]
2-
members = ["crates/openvino", "crates/openvino-sys"]
2+
members = ["crates/openvino", "crates/openvino-sys", "crates/openvino-finder", "crates/xtask"]

0 commit comments

Comments
 (0)