build(docker): call ./app/build_log4qt.sh from Dockerfile; move Log4Qt build out of Dockerfile\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This commit is contained in:
torsten committed 2026-07-17 13:17:07 +02:00
1 parent fd7ba24128
commit 13eab6258d
1 file changed
+4 -27
+4 -27
View File
@@ -58,33 +58,10 @@ RUN python3 -m venv /opt/venv \
&& /opt/venv/bin/python -m aqt install-qt linux desktop "${QT_VERSION}" "${QT_ARCH}" -m qtmultimedia qtserialport qtimageformats qtwebsockets qtwebengine qtpdf qtwebview --outputdir "${QT_BASE_DIR}" \
&& test -f "${QT_ROOT}/lib/cmake/Qt6/Qt6Config.cmake"
# Build and install Log4Qt from source (provides headers + shared libs)
RUN set -eux; \
git clone --depth 1 https://github.com/MEONMedical/Log4Qt.git /tmp/log4qt; \
mkdir -p /tmp/log4qt/build; \
cd /tmp/log4qt/build; \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_EXTENSIONS=OFF -DCMAKE_PREFIX_PATH="${QT_ROOT}" -DCMAKE_INSTALL_PREFIX=/usr/local ..; \
cmake --build . -- -j$(nproc); \
cmake --install .; \
# create a minimal CMake config file so find_package(Log4Qt) finds the installed library
mkdir -p /usr/local/lib/cmake/Log4Qt; \
libpath="$((ls /usr/local/lib/libLog4Qt.so* 2>/dev/null || ls /usr/local/lib/liblog4qt.so* 2>/dev/null) | head -n1 || true)"; \
if [ -n "$libpath" ]; then \
printf '%s\n' \
'# Minimal Log4QtConfig.cmake created by Dockerfile' \
'if (NOT TARGET Log4Qt::log4qt)' \
' add_library(Log4Qt::log4qt UNKNOWN IMPORTED)' \
' set_target_properties(Log4Qt::log4qt PROPERTIES' \
" IMPORTED_LOCATION \"${libpath}\"" \
' INTERFACE_INCLUDE_DIRECTORIES "/usr/local/include"' \
' )' \
'endif()' \
'set(Log4Qt_FOUND TRUE CACHE INTERNAL "Log4Qt found by package config")' \
'set(Log4Qt_INCLUDE_DIRS "/usr/local/include" CACHE INTERNAL "Log4Qt include dir")' \
"set(Log4Qt_LIBRARIES \"${libpath}\" CACHE INTERNAL \"Log4Qt library\")" \
> /usr/local/lib/cmake/Log4Qt/Log4QtConfig.cmake; \
fi; \
rm -rf /tmp/log4qt
# Build and install Log4Qt via script in /app (keeps Dockerfile small)
COPY build_log4qt.sh /app/build_log4qt.sh
RUN /app/build_log4qt.sh
# Install additional external dependencies required by Lts modules
# Attempt to install system packages first; then build Grantlee and KDReports from source if not available