Files
Jungfraujoch/preview/CMakeLists.txt
T
leonarski_f 6dfe065365
Build Packages / Create release (push) Successful in 16s
Build Packages / build:rugnux:aarch64 (cross) (push) Successful in 8m27s
Build Packages / build:rugnux-tgz (x86_64) (push) Successful in 9m15s
Build Packages / build:viewer-tgz:cpu (push) Successful in 10m11s
Build Packages / build:viewer-tgz:cuda (push) Successful in 12m6s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 15m44s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 16m1s
Build Packages / build:windows:nocuda (push) Successful in 17m29s
Build Packages / build:windows:cuda (push) Successful in 19m58s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 24m7s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 19m8s
Build Packages / build:rugnux:windows (push) Successful in 10m58s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 20m46s
Build Packages / Generate python client (push) Successful in 53s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 20m13s
Build Packages / Build documentation (push) Successful in 1m36s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 19m57s
Build Packages / build:rpm (rocky8) (push) Successful in 18m7s
Build Packages / build:rpm (rocky9) (push) Successful in 18m54s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 19m32s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 17m30s
Build Packages / Unit tests (push) Successful in 1h39m2s
v1.0.0-rc.172 (#82)
* Fixed `jfjoch_broker` cancelling every data collection with a CUDA "out of memory" error after long operation: GPU memory no longer leaks with each collection.
* Rugnux scales a rotation sweep until the per-frame scales settle instead of for a fixed three rounds, and says so when they did not - merged intensities, and the space group, resolution cut and frame rejection read off them, change accordingly; `--scaling-iterations` is now the cap on that loop (default 100).
* Rugnux places every frame of a marCCD, SMV or miniCBF series at the spindle angle its own header states, so a series with missing frames, or with angles written modulo 360, is no longer read at the wrong geometry or refused.
* Every rotation run writes two diagnostic files beside its reflections: `<prefix>_detector.jpg`, the detector projection with the pixel mask and the detected beam-stop shadow drawn on it, and `<prefix>_plot.txt`, one row per image.

Reviewed-on: #82
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
2026-09-22 06:48:37 +02:00

85 lines
3.8 KiB
CMake

include(ExternalProject)
find_package(ZLIB REQUIRED)
# libjpeg-turbo: upstream does NOT support add_subdirectory/FetchContent inclusion, so build and
# install it out-of-line and import the static lib. (Adapted from aseprite's FindJpegTurbo.cmake.)
# The static lib is `jpeg-static.lib` on MSVC and `libjpeg.a` elsewhere.
IF (MSVC)
SET(LIBJPEG_TURBO_STATIC_SUFFIX "-static")
ELSE()
SET(LIBJPEG_TURBO_STATIC_SUFFIX "")
ENDIF()
SET(LIBJPEG_TURBO_DIR "${CMAKE_CURRENT_BINARY_DIR}/libjpeg-turbo")
SET(LIBJPEG_TURBO_LIBRARY "${LIBJPEG_TURBO_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}jpeg${LIBJPEG_TURBO_STATIC_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
SET(LIBJPEG_TURBO_INCLUDE_DIRS "${LIBJPEG_TURBO_DIR}/include")
# An ExternalProject is a separate cmake invocation and inherits nothing, so without these it
# configures for the BUILD host: a cross build would link an x86_64 libjpeg.a into an aarch64
# binary and only fail at the final link, and a macOS build would get a libjpeg.a for another
# architecture or deployment target than the binary it goes into. CMAKE_SYSTEM_NAME only when
# actually cross-compiling: setting it is what PUTS a build into cross mode (same as zlib-ng in the
# top-level CMakeLists). libjpeg-turbo picks its own SIMD from the target arch, so NEON comes for
# free on aarch64 and nasm is simply not consulted there.
SET(LIBJPEG_TURBO_FORWARD CMAKE_TOOLCHAIN_FILE CMAKE_C_COMPILER
CMAKE_OSX_ARCHITECTURES CMAKE_OSX_SYSROOT CMAKE_OSX_DEPLOYMENT_TARGET)
IF (CMAKE_CROSSCOMPILING)
LIST(APPEND LIBJPEG_TURBO_FORWARD CMAKE_SYSTEM_NAME CMAKE_SYSTEM_PROCESSOR)
ENDIF()
SET(LIBJPEG_TURBO_FORWARD_ARGS "")
FOREACH (_var IN LISTS LIBJPEG_TURBO_FORWARD)
IF (${_var})
LIST(APPEND LIBJPEG_TURBO_FORWARD_ARGS "-D${_var}:STRING=${${_var}}")
ENDIF()
ENDFOREACH()
ExternalProject_Add(libjpeg-turbo-project
URL https://github.com/libjpeg-turbo/libjpeg-turbo/archive/refs/tags/3.2.0.tar.gz
URL_HASH SHA256=980dd81f425082aa6d7c9e47fef27554ce7a9ffc8e2f6e863b97d263c5c50858
PREFIX "${LIBJPEG_TURBO_DIR}"
INSTALL_DIR "${LIBJPEG_TURBO_DIR}"
BUILD_BYPRODUCTS "${LIBJPEG_TURBO_LIBRARY}"
CMAKE_CACHE_ARGS
-DENABLE_SHARED:BOOL=OFF
-DENABLE_STATIC:BOOL=ON
-DWITH_ARITH_DEC:BOOL=ON
-DWITH_ARITH_ENC:BOOL=ON
-DWITH_JPEG8:BOOL=OFF
-DWITH_JPEG7:BOOL=OFF
-DWITH_TURBOJPEG:BOOL=OFF
# Lazy SIMD: use NASM-accelerated SIMD when nasm is present, otherwise warn and build a
# scalar libjpeg (REQUIRE_SIMD=OFF is libjpeg-turbo's default; pinned here to be explicit).
-DWITH_SIMD:BOOL=ON
-DREQUIRE_SIMD:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_INSTALL_LIBDIR:PATH=<INSTALL_DIR>/lib
${LIBJPEG_TURBO_FORWARD_ARGS})
# Create the include dir up front so setting INTERFACE_INCLUDE_DIRECTORIES below does not fail.
FILE(MAKE_DIRECTORY ${LIBJPEG_TURBO_INCLUDE_DIRS})
ADD_LIBRARY(JPEG::JPEG STATIC IMPORTED GLOBAL)
SET_TARGET_PROPERTIES(JPEG::JPEG PROPERTIES
IMPORTED_LOCATION "${LIBJPEG_TURBO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBJPEG_TURBO_INCLUDE_DIRS}")
ADD_LIBRARY(JFJochPreview STATIC
JFJochTIFF.cpp JFJochTIFF.h
JFJochJPEG.cpp JFJochJPEG.h
PreviewCounter.cpp PreviewCounter.h
PreviewImage.cpp PreviewImage.h
ZMQPreviewSocket.cpp
ZMQPreviewSocket.h
ZMQMetadataSocket.cpp
ZMQMetadataSocket.h
)
# JPEG::JPEG is an IMPORTED target, so the build-order dependency on the ExternalProject must be
# attached to the consuming target instead.
ADD_DEPENDENCIES(JFJochPreview libjpeg-turbo-project)
TARGET_LINK_LIBRARIES(JFJochPreview PUBLIC JFJochZMQ JFJochCommon CBORStream2FrameSerialize)
TARGET_LINK_LIBRARIES(JFJochPreview PUBLIC JPEG::JPEG tiff tiffxx ZLIB::ZLIB)