Skip to content

Commit

Permalink
cppQML: Add GPU build arg support
Browse files Browse the repository at this point in the history
This fixes the build for machines that use a different docker image
with special libs for the specific vendor GPU.

Related-to: toradex#51
Signed-off-by: Matheus Castello <matheus.castello@toradex.com>
  • Loading branch information
microhobby committed May 18, 2023
1 parent eae95bd commit 49e7804
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 4 deletions.
24 changes: 22 additions & 2 deletions cppQML/Dockerfile
Expand Up @@ -16,13 +16,19 @@ ARG APP_EXECUTABLE=__change__
##
ARG IMAGE_ARCH=

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

# TODO: cross compile x86 to arm
# We will use emulation here
# BUILD ------------------------------------------------------------------------
FROM --platform=linux/${IMAGE_ARCH} \
torizon/wayland-base:${SDK_BASE_VERSION} AS Build
torizon/wayland-base${GPU}:${SDK_BASE_VERSION} AS Build

ARG IMAGE_ARCH
ARG GPU

# __deps__
RUN apt-get -q -y update && \
Expand Down Expand Up @@ -56,9 +62,10 @@ RUN qmake6 -o build/Makefile && \
# Deploy Step
##
FROM --platform=linux/${IMAGE_ARCH} \
torizon/wayland-base:${BASE_VERSION} AS Deploy
torizon/wayland-base${GPU}:${BASE_VERSION} AS Deploy

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

Expand All @@ -69,6 +76,19 @@ ARG SSHUSERNAME=torizon
# 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 required packages
RUN apt-get -q -y update && \
Expand Down
21 changes: 20 additions & 1 deletion cppQML/Dockerfile.debug
Expand Up @@ -26,14 +26,20 @@ ARG SSH_DEBUG_PORT=
##
ARG SSHUSERNAME=

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

# BUILD ------------------------------------------------------------------------
##
# 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 @@ -44,6 +50,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 required packages
RUN apt-get -q -y update && \
Expand Down
18 changes: 17 additions & 1 deletion cppQML/Dockerfile.sdk
Expand Up @@ -3,14 +3,30 @@ ARG BASE_VERSION=3

ARG IMAGE_ARCH=

ARG GPU=

# TODO: cross compile x86 to arm
# Qt 6 cross toolchain
# We will use emulation here
# BUILD ------------------------------------------------------------------------
FROM --platform=linux/${IMAGE_ARCH} \
torizon/wayland-base:${BASE_VERSION} AS Build
torizon/wayland-base${GPU}:${BASE_VERSION} AS Build

ARG IMAGE_ARCH
ARG GPU

# 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/*

# __deps__
RUN apt-get -q -y update && \
Expand Down

0 comments on commit 49e7804

Please sign in to comment.