Files
Jungfraujoch/image_analysis/indexing/CMakeLists.txt
T
leonarski_fandClaude Opus 5 491312f263
Build Packages / build:rugnux:aarch64 (cross) (push) Failing after 2m8s
Build Packages / build:rugnux:windows (push) Successful in 14m6s
Build Packages / build:rugnux-tgz (x86_64) (push) Failing after 15m4s
Build Packages / build:windows:nocuda (push) Successful in 16m1s
Build Packages / build:windows:cuda (push) Successful in 18m48s
Build Packages / build:viewer-tgz:cpu (push) Successful in 20m9s
Build Packages / build:viewer-tgz:cuda (push) Successful in 23m1s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 22m54s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 24m23s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 27m45s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 27m49s
Build Packages / build:rpm (rocky8) (push) Canceled after 7m42s
Build Packages / XDS test (durin plugin) (push) Canceled after 0s
Build Packages / XDS test (JFJoch plugin) (push) Canceled after 0s
Build Packages / XDS test (neggia plugin) (push) Canceled after 0s
Build Packages / Generate python client (push) Canceled after 0s
Build Packages / Build documentation (push) Canceled after 0s
Build Packages / Create release (push) Canceled after 0s
Build Packages / build:rpm (ubuntu2204) (push) Canceled after 4m8s
Build Packages / build:rpm (ubuntu2404) (push) Canceled after 2m52s
Build Packages / build:rpm (rocky8_sls9) (push) Canceled after 15m38s
Build Packages / build:rpm (rocky9) (push) Canceled after 7m40s
Build Packages / build:rpm (rocky9_sls9) (push) Canceled after 10m37s
Build Packages / DIALS test (push) Canceled after 2m45s
Build Packages / Unit tests (push) Canceled after 30m48s
Fix the packaging split where it was only exercised on one configuration
Three failures, all from validating the rugnux path alone and assuming the rest
followed.

viewer/CMakeLists.txt had an unbalanced ENDIF: removing the cuFFT bundling block
took its opening IF(JFJOCH_CUDA_AVAILABLE) with it and left the closer behind, so
every configuration that adds viewer/ died on "flow control statements are not
properly nested" -- both Windows jobs and the viewer tarball.

The cross toolchain could not find Eigen. CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY
confines find_package to the target roots, and the ubuntu2404 image installs Eigen
from source in /opt/eigen-3.4 rather than as libeigen3-dev, so it sat outside them.
It is header-only, so serving it from outside the target roots is safe; the root is
now listed explicitly.

Static cuFFT is not available everywhere. The Windows toolkit ships no
cufft_static.lib, so CUDA::cufft_static does not exist there and linking it fails
at generate time. Condition on the target rather than the platform, so a toolkit
that gains or loses the static library needs no further change, and restore the
Windows DLL bundling for both products -- now in the top-level CMakeLists, since
rugnux needs it too and does not add viewer/. rugnux.exe therefore ships beside
cufft64_*.dll rather than alone; the Linux and cross artifacts are still one file.

That condition also has to keep the JFJOCH_PORTABLE_ONLY half. Testing only for
the target quietly moved the SERVER build onto static cuFFT as well, where every
executable -- broker, tests, tools -- would then need the CUDA device-link step and
would fail on an undefined __cudaRegisterLinkedBinary_* at link. Configure still
succeeds, so nothing catches that until the link; the server build keeps libcufft.so
exactly as before.

Checked by configuring all four flavours in the image CI actually uses -- rugnux,
viewer and server on x86_64 plus the aarch64 cross -- and confirming each links the
cuFFT it should.

The rugnux archives now also carry their target architecture, since that build
produces more than one: rugnux-<version>-linux-x86_64-cuda13.tar.gz beside the
aarch64 one. CMAKE_SYSTEM_PROCESSOR is the target's, never the build host's. The
viewer is x86_64-only and keeps its existing name.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SQjneRUssfhi1k9rq8Ts3h
2026-08-25 20:53:49 +02:00

66 lines
3.1 KiB
CMake

ADD_LIBRARY(JFJochIndexing STATIC
Indexer.h
Indexer.cpp
IndexerFactory.h
IndexerFactory.cpp
IndexerThreadPool.cpp
IndexerThreadPool.h
AnalyzeIndexing.cpp
AnalyzeIndexing.h
FitProfileRadius.cpp
FitProfileRadius.h
PostIndexingRefinement.h
FFTResult.h
FFTIndexer.cpp
FFTIndexer.h
PostIndexingRefinement.cpp
MultiLatticeSearch.cpp
MultiLatticeSearch.h)
TARGET_LINK_LIBRARIES(JFJochIndexing JFJochCommon JFJochLatticeSearch)
IF (JFJOCH_CUDA_AVAILABLE)
# GIT_SUBMODULES "" -> do not fetch ffbidx's bundled eigen submodule; it would add_subdirectory
# a second Eigen3::Eigen target. ffbidx instead resolves Eigen via the project-level Eigen3
# (the find_package(Eigen3) at the top of image_analysis/CMakeLists.txt).
FetchContent_Declare(
fast-indexer
GIT_REPOSITORY https://github.com/paulscherrerinstitute/fast-feedback-indexer/
GIT_TAG a94fd4f5c55289e70860feea358182d2072e02b5
GIT_SUBMODULES ""
)
FetchContent_MakeAvailable(fast-indexer)
TARGET_SOURCES(JFJochIndexing PRIVATE
CUDAMemHelpers.h
FFTIndexerGPU.cu FFTIndexerGPU.h
FFBIDXIndexer.cpp FFBIDXIndexer.h)
# Link cuFFT statically where a static cuFFT exists. It is the only CUDA component that was
# ever dynamic (cudart and the fast-feedback indexer are already static), and as a .so it forced
# every self-contained artifact to carry the library beside its executables and find it again
# through an $ORIGIN rpath -- machinery that silently failed for any executable that was not the
# one the rpath had been set on. Static, a Linux artifact is one file that runs, and a cross
# build has no alternative anyway: NVIDIA's cross-linux-sbsa packages ship libcufft_static.a and
# no libcufft.so at all.
#
# The Windows CUDA toolkit ships no cufft_static.lib, so CUDA::cufft_static does not exist there
# and the dynamic library is the only option; the top-level CMakeLists installs the DLL beside
# the executable for the self-contained builds. Test the target rather than the platform, so a
# toolkit that gains or loses the static library is handled without another special case.
# Both halves matter: the server build keeps the shared library (its .deb/.rpm take CUDA from the
# distro, and every executable there -- broker, tests, tools -- would otherwise need the device
# link below), and Windows has no static cuFFT to link even for the portable products.
IF (JFJOCH_PORTABLE_ONLY AND TARGET CUDA::cufft_static)
TARGET_LINK_LIBRARIES(JFJochIndexing fast_indexer_static CUDA::cufft_static)
ELSE()
TARGET_LINK_LIBRARIES(JFJochIndexing fast_indexer_static CUDA::cufft)
ENDIF()
ELSE()
MESSAGE(WARNING "CUDA is strongly recommended for image analysis." )
TARGET_LINK_LIBRARIES(JFJochIndexing Eigen3::Eigen)
ENDIF()
# FFTW (fftw3f) is always available via FetchContent -> the CPU FFT indexer is always built.
TARGET_SOURCES(JFJochIndexing PRIVATE FFTIndexerCPU.cpp FFTIndexerCPU.h)
TARGET_LINK_LIBRARIES(JFJochIndexing fftw3f)