Files
Jungfraujoch/viewer/CMakeLists.txt
T
leonarski_fandClaude Opus 5 38f1c1a387
Build Packages / build:viewer-tgz:cpu (push) Successful in 7m14s
Build Packages / build:viewer-tgz:cuda (push) Successful in 8m3s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 11m29s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 11m30s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 11m42s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 9m20s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 10m16s
Build Packages / build:rpm (rocky8) (push) Successful in 10m49s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 11m25s
Build Packages / build:rpm (rocky9) (push) Successful in 11m46s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 11m21s
Build Packages / Generate python client (push) Successful in 25s
Build Packages / Build documentation (push) Successful in 1m2s
Build Packages / Create release (push) Skipped
Build Packages / build:rpm (ubuntu2404) (push) Successful in 11m30s
Build Packages / XDS test (durin plugin) (push) Successful in 7m52s
Build Packages / DIALS test (push) Successful in 12m25s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m38s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 8m16s
Build Packages / Unit tests (push) Successful in 1h2m14s
Build Packages / build:windows:nocuda (push) Canceled after 0s
Build Packages / build:windows:cuda (push) Canceled after 0s
Revert "Viewer: read the data-analysis algorithm documentation from Help"
This reverts commit 681e80e46.

Dropped for now: QTextBrowser::setMarkdown leaves the inline LaTeX in
CPU_DATA_ANALYSIS.md as raw "$...$" source, and the document's own HTML/math
rendering wants sorting out first. Reverted rather than rewritten so the
implementation stays available in history to bring back afterwards.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-26 22:08:45 +02:00

217 lines
9.6 KiB
CMake

# SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
# SPDX-License-Identifier: GPL-3.0-only
SET(CMAKE_AUTOMOC ON)
SET(CMAKE_AUTOUIC ON)
# D-Bus (single-instance / remote control) is Linux-only: Qt6::DBus does not
# exist on Windows or macOS. Default ON on Linux, OFF elsewhere.
IF(UNIX AND NOT APPLE)
OPTION(JFJOCH_VIEWER_DBUS "Build viewer with D-Bus support (Linux only)" ON)
ELSE()
OPTION(JFJOCH_VIEWER_DBUS "Build viewer with D-Bus support (Linux only)" OFF)
ENDIF()
SET(JFJOCH_VIEWER_QT_COMPONENTS Core Gui Widgets Charts Concurrent OpenGL OpenGLWidgets)
IF(JFJOCH_VIEWER_DBUS)
LIST(APPEND JFJOCH_VIEWER_QT_COMPONENTS DBus)
ENDIF()
FIND_PACKAGE(Qt6 COMPONENTS ${JFJOCH_VIEWER_QT_COMPONENTS} REQUIRED)
QT_ADD_RESOURCES(APP_RESOURCES resources/resources.qrc)
ADD_EXECUTABLE(jfjoch_viewer jfjoch_viewer.cpp JFJochViewerWindow.cpp JFJochViewerWindow.h
JFJochViewerMenu.cpp
JFJochViewerMenu.h
image_viewer/JFJochDiffractionImage.cpp
image_viewer/JFJochDiffractionImage.h
image_viewer/JFJochSimpleImage.cpp
image_viewer/JFJochSimpleImage.h
JFJochImageReadingWorker.cpp
JFJochImageReadingWorker.h
JFJochHttpReader.cpp
JFJochHttpReader.h
RunData.h
JFJochProcessController.cpp
JFJochProcessController.h
JFJochViewerDatasetInfo.cpp
JFJochViewerDatasetInfo.h
JFJochViewerSidePanel.cpp
JFJochViewerSidePanel.h
widgets/TitleLabel.cpp
widgets/TitleLabel.h
charts/JFJochDatasetInfoChartView.cpp
charts/JFJochDatasetInfoChartView.h
widgets/JFJochViewerImageStatistics.cpp
widgets/JFJochViewerImageStatistics.h
charts/JFJochSimpleChartView.cpp
charts/JFJochSimpleChartView.h
JFJochViewerStatusBar.cpp
JFJochViewerStatusBar.h
windows/JFJochViewerImageListWindow.cpp
windows/JFJochViewerImageListWindow.h
widgets/NumericComboBox.cpp
widgets/NumericComboBox.h
windows/JFJochViewerMetadataWindow.cpp
windows/JFJochViewerMetadataWindow.h
windows/JFJochMergeStatsWindow.cpp
windows/JFJochMergeStatsWindow.h
widgets/NumberLineEdit.cpp
widgets/NumberLineEdit.h
widgets/SliderPlusBox.cpp
widgets/SliderPlusBox.h
widgets/JFJochViewerSidePanelChart.cpp
widgets/JFJochViewerSidePanelChart.h
widgets/JFJochViewerSettingsDock.cpp
widgets/JFJochViewerSettingsDock.h
widgets/CollapsibleSection.cpp
widgets/CollapsibleSection.h
widgets/ToolbarIcons.cpp
widgets/ToolbarIcons.h
widgets/JFJochViewerImageStrip.cpp
widgets/JFJochViewerImageStrip.h
windows/JFJochViewerSpotListWindow.cpp
windows/JFJochViewerSpotListWindow.h
image_viewer/JFJochAzIntImage.cpp
image_viewer/JFJochAzIntImage.h
windows/JFJochViewerReflectionListWindow.cpp
windows/JFJochViewerReflectionListWindow.h
toolbar/JFJochViewerToolbarImage.cpp
toolbar/JFJochViewerToolbarImage.h
toolbar/JFJochViewerToolbarDisplay.cpp
toolbar/JFJochViewerToolbarDisplay.h
SimpleImage.h
windows/JFJochCalibrationWindow.cpp
windows/JFJochCalibrationWindow.h
windows/JFJochHelperWindow.cpp
windows/JFJochHelperWindow.h
windows/JFJochLicenseWindow.cpp
windows/JFJochLicenseWindow.h
image_viewer/JFJochImage.cpp
image_viewer/JFJochImage.h
image_viewer/JFJochFollowerImage.cpp
image_viewer/JFJochFollowerImage.h
windows/JFJoch2DAzintImageWindow.cpp
windows/JFJoch2DAzintImageWindow.h
widgets/JFJochViewerROIResult.cpp
widgets/JFJochViewerROIResult.h
widgets/JFJochViewerROIList.cpp
widgets/JFJochViewerROIList.h
widgets/ResolutionRingWidget.cpp
widgets/ResolutionRingWidget.h
image_viewer/JFJochGridScanImage.cpp
image_viewer/JFJochGridScanImage.h
widgets/PowderCalibrationWidget.cpp
widgets/PowderCalibrationWidget.h
${APP_RESOURCES}
windows/JFJochViewerReciprocalSpaceWindow.cpp
windows/JFJochViewerReciprocalSpaceWindow.h
windows/JFJochMagnifierWindow.cpp
windows/JFJochMagnifierWindow.h
windows/JFJochProcessingJobsWindow.cpp
windows/JFJochProcessingJobsWindow.h
)
TARGET_LINK_LIBRARIES(jfjoch_viewer Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Charts Qt6::Concurrent
Qt6::OpenGL Qt6::OpenGLWidgets
JFJochReader JFJochLogger JFJochCommon JFJochWriter JFJochImageAnalysis Rugnux
fftw3f libcurl_static) # vendored static libcurl by concrete name, not the CURL::libcurl
# alias, which a system libcurl can shadow (see top-level CMakeLists)
# Native GUI app per platform: a .app bundle on macOS, GUI subsystem (no console window) on
# Windows. Each property is ignored on the platforms it does not apply to, so set both always.
SET_TARGET_PROPERTIES(jfjoch_viewer PROPERTIES
MACOSX_BUNDLE ON
WIN32_EXECUTABLE ON)
# Application icon: embedded into the .exe via a Windows resource script, and copied into
# the macOS .app bundle (referenced from Info.plist through MACOSX_BUNDLE_ICON_FILE).
IF(WIN32)
TARGET_SOURCES(jfjoch_viewer PRIVATE resources/jfjoch.rc)
ELSEIF(APPLE)
SET(_viewer_icns ${CMAKE_CURRENT_SOURCE_DIR}/resources/jfjoch.icns)
TARGET_SOURCES(jfjoch_viewer PRIVATE ${_viewer_icns})
SET_SOURCE_FILES_PROPERTIES(${_viewer_icns} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
SET_TARGET_PROPERTIES(jfjoch_viewer PROPERTIES MACOSX_BUNDLE_ICON_FILE jfjoch.icns)
ENDIF()
INSTALL(TARGETS jfjoch_viewer
BUNDLE DESTINATION . COMPONENT viewer # macOS .app bundle
RUNTIME DESTINATION bin COMPONENT viewer) # Windows .exe / Linux binary
IF(JFJOCH_VIEWER_DBUS)
TARGET_SOURCES(jfjoch_viewer PRIVATE dbus/JFJochViewerAdaptor.cpp dbus/JFJochViewerAdaptor.h)
TARGET_LINK_LIBRARIES(jfjoch_viewer Qt6::DBus)
TARGET_COMPILE_DEFINITIONS(jfjoch_viewer PRIVATE JFJOCH_VIEWER_DBUS)
INSTALL(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/dbus/ch.psi.jfjoch_viewer.service
DESTINATION share/dbus-1/services
COMPONENT viewer
)
ENDIF()
INSTALL(
FILES resources/jfjoch.png
DESTINATION share/pixmaps
COMPONENT viewer
)
INSTALL(
FILES jfjoch_viewer.desktop
DESTINATION share/applications
COMPONENT viewer
)
# Platform integration plugin: XCB on Linux, native plugin on Windows/macOS.
IF(WIN32)
qt_import_plugins(jfjoch_viewer INCLUDE Qt::QWindowsIntegrationPlugin)
ELSEIF(APPLE)
qt_import_plugins(jfjoch_viewer INCLUDE Qt::QCocoaIntegrationPlugin)
ELSE()
qt_import_plugins(jfjoch_viewer INCLUDE Qt::QXcbIntegrationPlugin)
ENDIF()
# Bundle the Qt runtime into the install tree at install time: this drives windeployqt on Windows
# and macdeployqt on macOS, copying the Qt shared libraries + plugins next to the app. With a
# static Qt (e.g. our Linux build) there is nothing to copy, so it is a no-op. Requires Qt >= 6.5,
# which is when the OUTPUT_SCRIPT signature and the Linux deploy path landed (6.3/6.4 used the older
# FILENAME_VARIABLE and had no Linux support); skipped on older Qt. NO_UNSUPPORTED_PLATFORM_ERROR
# keeps it from hard-failing on configurations it does not handle.
IF(Qt6_VERSION VERSION_GREATER_EQUAL "6.5")
qt_generate_deploy_app_script(
TARGET jfjoch_viewer
OUTPUT_SCRIPT jfjoch_viewer_deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR)
INSTALL(SCRIPT ${jfjoch_viewer_deploy_script} COMPONENT viewer)
ENDIF()
# Bundle the cuFFT runtime next to the viewer so the installed app runs on hosts that have an NVIDIA
# driver but no CUDA toolkit. cuFFT is the ONLY CUDA component we link dynamically (cudart and the
# fast-feedback indexer are static), so it is the one runtime file the toolkit would otherwise have to
# provide; it is self-contained (Windows: depends only on KERNEL32; Linux: only libc/libstdc++ and the
# always-present driver libcuda). GPU build only. macOS has no CUDA, so it is excluded.
IF(JFJOCH_CUDA_AVAILABLE)
IF(WIN32)
# CUDA 13 keeps redistributable DLLs in bin/x64, earlier toolkits in bin -- glob both.
FILE(GLOB _cufft_dll
"${CUDAToolkit_BIN_DIR}/x64/cufft64_*.dll"
"${CUDAToolkit_BIN_DIR}/cufft64_*.dll")
IF(NOT _cufft_dll)
MESSAGE(FATAL_ERROR "cuFFT runtime DLL not found under ${CUDAToolkit_BIN_DIR}")
ENDIF()
INSTALL(FILES ${_cufft_dll} DESTINATION bin COMPONENT viewer)
ELSEIF(UNIX AND NOT APPLE AND JFJOCH_VIEWER_ONLY)
# Only the self-contained Linux .tar.gz (JFJOCH_VIEWER_ONLY) bundles cuFFT: it has no package
# manager, so it must carry its runtime deps, and we want that set really minimal. The .deb/.rpm
# builds deliberately do NOT bundle it - CUDA there is centrally managed by the distro's packages.
# Ship libcufft.so beside the binary and add an $ORIGIN rpath so the loader finds the bundled copy
# (the same self-contained-app idea as the Windows DLL). CUDA::cufft is an UNKNOWN imported target,
# so install its file directly, resolving the symlink chain (libcufft.so -> .so.<major> -> real
# file) so the libcufft.so.<major> the binary is linked against lands in bin.
INSTALL(CODE
"file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/bin\" TYPE SHARED_LIBRARY FOLLOW_SYMLINK_CHAIN FILES \"${CUDA_cufft_LIBRARY}\")"
COMPONENT viewer)
SET_TARGET_PROPERTIES(jfjoch_viewer PROPERTIES INSTALL_RPATH "$ORIGIN")
ENDIF()
ENDIF()