Skip to content

Commit

Permalink
Gcc version parametrized
Browse files Browse the repository at this point in the history
  • Loading branch information
PhysicsX committed Dec 4, 2024
1 parent 9722255 commit a3d2959
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
24 changes: 16 additions & 8 deletions QtJetsonNx6.6.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# Use an x86 Ubuntu base image
FROM ubuntu:20.04
# Use an x86 Ubuntu base image with a specified version
ARG UBUNTU_VERSION=20.04
FROM ubuntu:${UBUNTU_VERSION}

# Avoid interactive prompts by setting the environment variable
ENV DEBIAN_FRONTEND=noninteractive

# Define build arguments for GCC version and other configurable packages
ARG GCC_VERSION=9

# Update system and install necessary libraries
RUN { \
echo "deb http://archive.ubuntu.com/ubuntu/ focal main universe restricted multiverse" > /etc/apt/sources.list && \
echo "deb http://archive.ubuntu.com/ubuntu/ focal-updates main universe restricted multiverse" >> /etc/apt/sources.list && \
echo "deb http://archive.ubuntu.com/ubuntu/ focal-security main universe restricted multiverse" >> /etc/apt/sources.list && \
echo "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc) main universe restricted multiverse" > /etc/apt/sources.list && \
echo "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc)-updates main universe restricted multiverse" >> /etc/apt/sources.list && \
echo "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc)-security main universe restricted multiverse" >> /etc/apt/sources.list && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y software-properties-common && \
apt-get update && \
apt-get install -y --no-install-recommends \
'.*libxcb.*' \
libxrender-dev \
gcc-9 g++-9 \
gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu \
gcc-${GCC_VERSION} g++-${GCC_VERSION} \
gcc-${GCC_VERSION}-aarch64-linux-gnu g++-${GCC_VERSION}-aarch64-linux-gnu \
libxi-dev \
libfontconfig1-dev \
'^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxkbcommon-dev libxkbcommon-x11-dev \
Expand Down Expand Up @@ -147,6 +151,9 @@ RUN cd /qt6/src && \
tar xf qtshadertools-everywhere-src-6.8.0.tar.xz -C /qt6/nx-build && \
tar xf qtdeclarative-everywhere-src-6.8.0.tar.xz -C /qt6/nx-build

ARG GCC_VERSION

# Build Qt for the target using the toolchain file
RUN { \
echo "Compile qtbase for nx" | tee -a /build.log && \
cd /qt6/nx-build/qtbase-everywhere-src-6.8.0 && \
Expand All @@ -159,11 +166,12 @@ RUN { \
-DCMAKE_STAGING_PREFIX=/qt6/nx \
-DCMAKE_INSTALL_PREFIX=/usr/local/qt6 \
-DCMAKE_TOOLCHAIN_FILE=/opt/toolchain.cmake \
-DGCC_VERSION=${GCC_VERSION} \ # Pass GCC version to the toolchain
-DFEATURE_xcb_xlib=ON \
-DQT_FEATURE_xlib=ON && \
ninja && \
ninja install; \
} 2>&1 | tee -a /build.log
} 2>&1 | tee -a /build.log

RUN { \
echo "Compile qtshadertools for nx" | tee -a /build.log && \
Expand Down
9 changes: 7 additions & 2 deletions QtJetsonNx6.6.3/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/usr/lib/${TARGE
set(ENV{PKG_CONFIG_LIBDIR} "/usr/lib/pkgconfig:/usr/share/pkgconfig:${CMAKE_SYSROOT}/usr/lib/${TARGET_ARCHITECTURE}/pkgconfig:${CMAKE_SYSROOT}/usr/lib/pkgconfig")
set(ENV{PKG_CONFIG_SYSROOT_DIR} "${CMAKE_SYSROOT}")

# Define a configurable GCC version, defaulting to 11 if not set
if(NOT GCC_VERSION)
set(GCC_VERSION 9)
endif()

# Set the C and C++ compilers
set(CMAKE_C_COMPILER ${TARGET_ARCHITECTURE}-gcc-9)
set(CMAKE_CXX_COMPILER ${TARGET_ARCHITECTURE}-g++-9)
set(CMAKE_C_COMPILER ${TARGET_ARCHITECTURE}-gcc-${GCC_VERSION})
set(CMAKE_CXX_COMPILER ${TARGET_ARCHITECTURE}-g++-${GCC_VERSION})

# Define additional compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -isystem=/usr/include -isystem=/usr/local/include -isystem=/usr/include/${TARGET_ARCHITECTURE}")
Expand Down

0 comments on commit a3d2959

Please sign in to comment.