From 41f7edab76a5f8e0d36ed5de1a225cd84d8f395f Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Wed, 18 Nov 2026 11:15:49 +0100 Subject: [PATCH] CMake: cuFFT static for jfjoch_fpga_stills_test alone The other builds link cuFFT as before (dynamic on the server build, static in the portable ones). jfjoch_fpga_stills_test is copied to the FPGA servers on its own: its JFJOCH_STATIC_CUFFT property makes the indexer and the beam-centre FFT, which choose by a generator expression on the linking target, give it libcufft_static.a, and it gets the device-link step that needs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UqXYdHHZ4cogS1mrGUtfN7 --- image_analysis/geom_refinement/CMakeLists.txt | 3 +++ image_analysis/indexing/CMakeLists.txt | 5 +++++ tools/CMakeLists.txt | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/image_analysis/geom_refinement/CMakeLists.txt b/image_analysis/geom_refinement/CMakeLists.txt index a82fee507..e17df4797 100644 --- a/image_analysis/geom_refinement/CMakeLists.txt +++ b/image_analysis/geom_refinement/CMakeLists.txt @@ -49,6 +49,9 @@ IF (JFJOCH_CUDA_AVAILABLE) # note in image_analysis/indexing/CMakeLists.txt. IF (JFJOCH_PORTABLE_ONLY AND TARGET CUDA::cufft_static) TARGET_LINK_LIBRARIES(JFJochGeomRefinement CUDA::cufft_static) + ELSEIF (TARGET CUDA::cufft_static) + TARGET_LINK_LIBRARIES(JFJochGeomRefinement + $>,CUDA::cufft_static,CUDA::cufft>) ELSE() TARGET_LINK_LIBRARIES(JFJochGeomRefinement CUDA::cufft) ENDIF() diff --git a/image_analysis/indexing/CMakeLists.txt b/image_analysis/indexing/CMakeLists.txt index e7d787197..e2e33ebaa 100644 --- a/image_analysis/indexing/CMakeLists.txt +++ b/image_analysis/indexing/CMakeLists.txt @@ -54,8 +54,13 @@ IF (JFJOCH_CUDA_AVAILABLE) # 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. + # One exception in the server build: an executable with the JFJOCH_STATIC_CUFFT property (set on + # jfjoch_fpga_stills_test, which is copied to the FPGA servers on its own) gets the static library. IF (JFJOCH_PORTABLE_ONLY AND TARGET CUDA::cufft_static) TARGET_LINK_LIBRARIES(JFJochIndexing fast_indexer_static CUDA::cufft_static) + ELSEIF (TARGET CUDA::cufft_static) + TARGET_LINK_LIBRARIES(JFJochIndexing fast_indexer_static + $>,CUDA::cufft_static,CUDA::cufft>) ELSE() TARGET_LINK_LIBRARIES(JFJochIndexing fast_indexer_static CUDA::cufft) ENDIF() diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 9fdf2e2a9..18379427a 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -70,6 +70,11 @@ IF(NOT JFJOCH_PORTABLE_ONLY) ADD_EXECUTABLE(jfjoch_fpga_stills_test jfjoch_fpga_stills_test.cpp) TARGET_LINK_LIBRARIES(jfjoch_fpga_stills_test JFJochReceiver JFJochReader) + # Copied to the FPGA servers on its own: cuFFT linked statically (see image_analysis/indexing/CMakeLists.txt), + # which needs the device-link step (see rugnux/CMakeLists.txt) + IF (JFJOCH_CUDA_AVAILABLE AND TARGET CUDA::cufft_static) + SET_TARGET_PROPERTIES(jfjoch_fpga_stills_test PROPERTIES JFJOCH_STATIC_CUFFT ON CUDA_RESOLVE_DEVICE_SYMBOLS ON) + ENDIF() INSTALL(TARGETS jfjoch_fpga_stills_test RUNTIME COMPONENT jfjoch) ADD_EXECUTABLE(jfjoch_simplon_test jfjoch_simplon_test.cpp)