Skip to content

Commit

Permalink
cppSlint: Add GPU build arg support
Browse files Browse the repository at this point in the history
This is useful for machines that use proprietary GPU drivers and
libraries.

Related-to: toradex#51
Signed-off-by: Matheus Castello <matheus.castello@toradex.com>
  • Loading branch information
microhobby committed Jun 13, 2023
1 parent 908160d commit f1b3897
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
22 changes: 21 additions & 1 deletion cppSlint/Dockerfile
Expand Up @@ -11,11 +11,17 @@ ARG IMAGE_ARCH=
##
ARG APP_EXECUTABLE=__change__

##
# Board GPU vendor prefix
##
ARG GPU=


# BUILD ------------------------------------------------------------------------
FROM torizon/debian-cross-toolchain-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} As Build

ARG IMAGE_ARCH
ARG GPU
ARG COMPILER_ARCH
ENV IMAGE_ARCH ${IMAGE_ARCH}

Expand Down Expand Up @@ -109,9 +115,10 @@ RUN mkdir -p build \


# DEPLOY ------------------------------------------------------------------------
FROM --platform=linux/${IMAGE_ARCH} torizon/wayland-base:${BASE_VERSION} AS Deploy
FROM --platform=linux/${IMAGE_ARCH} torizon/wayland-base${GPU}:${BASE_VERSION} AS Deploy

ARG IMAGE_ARCH
ARG GPU
ARG APP_EXECUTABLE
ENV APP_EXECUTABLE ${APP_EXECUTABLE}

Expand All @@ -123,6 +130,19 @@ RUN apt-get update \
# copy Slint library
COPY --from=Build /usr/lib/libslint* /usr/lib

# for vivante GPU we need some "special" sauce
RUN apt-get -q -y update && \
if [ "${GPU}" = "-vivante" ]; then \
apt-get -q -y install \
imx-gpu-viv-wayland-dev \
; else \
apt-get -q -y install \
libgl1 \
; fi \
&& \
apt-get clean && apt-get autoremove && \
rm -rf /var/lib/apt/lists/*

RUN apt-get -y update && apt-get install -y --no-install-recommends \
# DOES NOT REMOVE THIS LABEL: this is used for VS Code automation
# __torizon_packages_prod_start__
Expand Down
22 changes: 21 additions & 1 deletion cppSlint/Dockerfile.debug
Expand Up @@ -26,6 +26,11 @@ ARG SSH_DEBUG_PORT=
##
ARG SSHUSERNAME=

##
# Board GPU vendor prefix
##
ARG GPU=

ARG CROSS_SDK_BASE_TAG=3-bookworm

# BUILD ------------------------------------------------------------------------
Expand All @@ -36,6 +41,7 @@ ARG CROSS_SDK_BASE_TAG=3-bookworm
FROM torizon/debian-cross-toolchain-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} As Build

ARG IMAGE_ARCH
ARG GPU
# FIXME: remove?
#ARG BASE_VERSION
#ARG APP_EXECUTABLE
Expand Down Expand Up @@ -125,9 +131,10 @@ RUN RUST_TOOLCHAIN_ARCH=$(cat /rust-toolchain-arch.txt) && \
# Deploy Step
##
FROM --platform=linux/${IMAGE_ARCH} \
torizon/wayland-base:${BASE_VERSION} AS Debug
torizon/wayland-base${GPU}:${BASE_VERSION} AS Debug

ARG IMAGE_ARCH
ARG GPU
ARG SSH_DEBUG_PORT
ARG APP_EXECUTABLE
ARG SSHUSERNAME
Expand All @@ -138,6 +145,19 @@ EXPOSE ${SSH_DEBUG_PORT}
# Make sure we don't get notifications we can't answer during building.
ENV DEBIAN_FRONTEND="noninteractive"

# for vivante GPU we need some "special" sauce
RUN apt-get -q -y update && \
if [ "${GPU}" = "-vivante" ]; then \
apt-get -q -y install \
imx-gpu-viv-wayland-dev \
; else \
apt-get -q -y install \
libgl1 \
; fi \
&& \
apt-get clean && apt-get autoremove && \
rm -rf /var/lib/apt/lists/*

# your regular RUN statements here

# Install Slint dependencies
Expand Down
3 changes: 3 additions & 0 deletions cppSlint/Dockerfile.sdk
Expand Up @@ -4,10 +4,13 @@ ARG BASE_VERSION=3-bookworm

ARG IMAGE_ARCH=

ARG GPU=

# BUILD ------------------------------------------------------------------------
FROM torizon/debian-cross-toolchain-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} As Build

ARG IMAGE_ARCH
ARG GPU

# Install an up-to-date cmake as well as ninja and make
RUN apt-get update && \
Expand Down

0 comments on commit f1b3897

Please sign in to comment.