Skip to content

Commit

Permalink
Update cmake build to use system deps and standard install paths (#8)
Browse files Browse the repository at this point in the history
* Update cmake build to use system deps and standard install paths

* Use edge channel where gimp plugin snap with updated command-chain is published
  • Loading branch information
frenchwr authored Jan 24, 2025
1 parent f8b13f6 commit 9956cda
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Snap build artifacts
*.snap
# logs from snapcraft remote-build
*.txt
2 changes: 1 addition & 1 deletion checkbox/bin/install-full-deps
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi

sudo DEBIAN_FRONTEND=noninteractive apt install -y intel-gpu-tools jq
sudo snap install intel-npu-driver --beta
sudo snap install openvino-ai-plugins-gimp --beta
sudo snap install openvino-ai-plugins-gimp --edge

# the content interfaces require manual connection
sudo snap connect openvino-sample-consumer:npu-libs intel-npu-driver:npu-libs
Expand Down
16 changes: 5 additions & 11 deletions command-chain/openvino-launch
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@
# and emits a warning if a node is inaccessible.
#

# Save positional args in a new variable as setupvars.sh consumes $@
cmd=("$@")

# Source OpenVINO script to export environment vars needed at runtime
if [ -f "${SNAP}/openvino/usr/setupvars.sh" ]; then
source "${SNAP}/openvino/usr/setupvars.sh"
else
echo "Warning: OpenVINO command-chain script not found."
CONTENT_PATH="${SNAP}/openvino"
if [ ! -d "${CONTENT_PATH}" ]; then
echo "Warning: ${CONTENT_PATH} not present inside ${SNAP_NAME} snap. Please connect the content interface at this path."
fi

# libOpenCL shared objects distributed with OpenVINO snap
export LD_LIBRARY_PATH="${SNAP}/openvino/usr/lib/x86_64-linux-gnu":$LD_LIBRARY_PATH
export PYTHONPATH="${SNAP}/openvino/usr/lib/python3/dist-packages":$PYTHONPATH

# Check user access to Intel accelerator devices (GPU and NPU)
check_user_access() {
Expand Down Expand Up @@ -53,4 +47,4 @@ check_user_access() {
check_user_access GPU /dev/dri/render render
check_user_access NPU /dev/accel/accel render

exec "${cmd[@]}"
exec "$@"
3 changes: 2 additions & 1 deletion sample-consumer/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ parts:
plugin: dump
source-type: git
source: https://github.com/canonical/openvino-toolkit-snap.git
source-tag: 2024.6.0-0
source-branch: frenchwr/cmake-best-practices
#source-tag: 2024.6.0-0
stage:
- command-chain/openvino-launch

Expand Down
31 changes: 21 additions & 10 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ adopt-info: openvino

platforms:
arm64:
build-on: [amd64]
amd64:

# the recommended mountpoint for the content is /openvino
Expand All @@ -31,19 +30,26 @@ parts:
- -DENABLE_PYTHON=ON
- -DPython3_EXECUTABLE=/usr/bin/python3.12
- -DCMAKE_INSTALL_PREFIX=/usr
- -DENABLE_SYSTEM_TBB=ON
- -DENABLE_SYSTEM_SNAPPY=ON
- -DENABLE_SNAPPY_COMPRESSION=ON
- -DCPACK_GENERATOR=DEB
- -DENABLE_SAMPLES=OFF
- -DENABLE_PYTHON_PACKAGING=ON
override-pull: |
craftctl default
git submodule update --init --recursive
craftctl set version="$(git describe --tags)"
override-build: |
craftctl default
rm -rf ${CRAFT_PART_INSTALL}/usr/{share,include,bin}
build-packages:
- ca-certificates
- file
- build-essential
- ninja-build
- scons
- ccache
- gcc-multilib
- g++-multilib
- pkgconf
- git
- shellcheck
Expand All @@ -66,16 +72,21 @@ parts:
- libffi-dev
- python3-enchant
- wget
- libsnappy-dev
stage-packages:
- ocl-icd-libopencl1
- libtbb12
- libsnappy1v5

lint:
ignore:
- library:
# These are needed but are flagged
# by the linter because they are not
# explicitly linked to any binary or
# shared object
- usr/runtime/3rdparty/tbb/lib/libtbbbind*
- usr/runtime/3rdparty/tbb/lib/libtbbmalloc*
- usr/runtime/3rdparty/tbb/lib/libhwloc.so.15.6.4
# OpenVINO libs consumed by other snaps
- usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libopenvino*
# Linked by libopenvino_tensorflow_frontend
- usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libsnappy*
# Not explicitly linked but dlopen'd
- usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libtbbbind*
- usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libtbbmalloc*
# Linked by libtbbbind
- usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libhwloc*

0 comments on commit 9956cda

Please sign in to comment.