Files
Jungfraujoch/common/CMakeLists.txt
T
leonarski_fandClaude Opus 5 e4edcd6fa9 Carry the sample transformation chain as DetectorTransformation
Replaces the start-message TransformationAxis of the previous commit, which was
the wrong shape in two ways.

DetectorTransformation (common/) mirrors a NeXus NXtransformations axis and holds
nothing else: name, type, units, vector, offset, depends_on and the positions
themselves. Deliberately without cleverness - the values are either a single
number for an axis that does not move or one per image, and nothing derives a
position from a start and an increment. That is the point: a producer will later
want to report where a stage actually WENT rather than where it was told to go,
and a structure that stores start+increment cannot express that. A million images
cost 4 MB per axis, which is not a reason to be clever.

Hence also the move to the END message: measured positions are only known once
the run is over.

And hence no metadata version bump, which the previous commit did make. The chain
is optional; when it is absent the writer builds the identical chain from the
start message, exactly as before. Nothing on the wire changes for a producer that
does not send it, so a broker and a writer of different releases still interwork -
the constraint the previous version stated is withdrawn.

The writer transcribes a chain it is given, without recomputing an angle, which
is what makes measured positions possible end to end.

JFJochReader_TransformationChain_SentAndBuilt writes the same run both ways and
checks the two files read back the same, chi/phi included.
CBORSerialize_End_Transformations covers the wire 1:1, asserting the order
survives and that a moving axis keeps one value per image while a stationary one
keeps a single value.

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

156 lines
4.9 KiB
CMake

# git header
# the commit's SHA1, and whether the building workspace was dirty or not
FIND_PACKAGE(Git)
EXECUTE_PROCESS(COMMAND
"${GIT_EXECUTABLE}" describe --match=NeVeRmAtCh --always --abbrev=8
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_SHA1
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
# the date of the commit
EXECUTE_PROCESS(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%ad --date=local
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
set (THREADS_PREFER_PTHREAD_FLAG ON)
find_package (Threads REQUIRED)
MESSAGE(STATUS "Jungfraujoch git SHA1: ${GIT_SHA1}")
MESSAGE(STATUS "Jungfraujoch git date: ${GIT_DATE}")
MESSAGE(STATUS "Jungfraujoch version: ${JFJOCH_VERSION}")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/GitInfo.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/GitInfo.cpp" @ONLY)
ADD_LIBRARY(JFJochVersion STATIC
${CMAKE_CURRENT_BINARY_DIR}/GitInfo.cpp GitInfo.h)
set_target_properties(JFJochVersion PROPERTIES
POSITION_INDEPENDENT_CODE ON
)
ADD_LIBRARY(JFJochLogger STATIC
Logger.cpp Logger.h
)
TARGET_LINK_LIBRARIES(JFJochLogger PUBLIC spdlog::spdlog JFJochVersion)
ADD_LIBRARY(JFJochZMQ STATIC ZMQWrappers.cpp ZMQWrappers.h)
ADD_LIBRARY(JFJochCommon STATIC
Coord.cpp Coord.h
DiffractionExperiment.cpp DiffractionExperiment.h
RawToConvertedGeometry.h
JFJochException.h
Definitions.h
ThreadSafeFIFO.h
DiffractionSpot.cpp DiffractionSpot.h
StatusVector.cpp StatusVector.h
SpotToSave.h
NetworkAddressConvert.h NetworkAddressConvert.cpp
DetectorGeometry.h
DetectorModuleGeometry.cpp DetectorModuleGeometry.h
DetectorSetup.h DetectorSetup.cpp ZeroCopyReturnValue.h Histogram.h DiffractionGeometry.h
CUDAWrapper.cpp CUDAWrapper.h
ADUHistogram.cpp ADUHistogram.h
RawToConvertedGeometryCore.h
Plot.h
../fpga/pcie_driver/jfjoch_fpga.h
DatasetSettings.cpp DatasetSettings.h
ROIMap.cpp ROIMap.h
ROIElement.cpp ROIElement.h
ROICircle.cpp ROICircle.h
ROIBox.cpp ROIBox.h
ImageBuffer.cpp ImageBuffer.h
time_utc.h
PixelMask.cpp PixelMask.h
InstrumentMetadata.cpp InstrumentMetadata.h
ImageFormatSettings.cpp
ImageFormatSettings.h
DetectorSettings.cpp
DetectorSettings.h
AzimuthalIntegrationSettings.cpp
AzimuthalIntegrationSettings.h
AzimuthalIntegrationProfile.h
AzimuthalIntegrationProfile.cpp
AzimuthalIntegrationMapping.h
AzimuthalIntegrationMapping.cpp
CheckPath.h
AutoIncrVector.h
ModuleSummation.cpp
ModuleSummation.h
ROIDefinition.cpp
ROIDefinition.h
ZeroCopyReturnValue.cpp
ColorScale.cpp ColorScale.h
FileWriterSettings.cpp
FileWriterSettings.h
MovingAverage.cpp
MovingAverage.h
DiffractionGeometry.cpp
ROIAzimuthal.cpp
ROIAzimuthal.h
print_license.h
DetectorGeometryModular.cpp
DetectorGeometryModular.h
DetectorGeometryFixed.cpp
DetectorGeometryFixed.h
GridScanSettings.cpp
GridScanSettings.h
JFJochMessages.h
GoniometerAxis.cpp
GoniometerAxis.h
DetectorTransformation.cpp
DetectorTransformation.h
CompressedImage.cpp
CompressedImage.h
Reflection.h
MultiLinePlot.cpp
MultiLinePlot.h
IndexingSettings.cpp
IndexingSettings.h
CrystalLattice.cpp
CrystalLattice.h
ScanResult.cpp
ScanResult.h
ScanResultGenerator.cpp
ScanResultGenerator.h
BraggIntegrationSettings.cpp
BraggIntegrationSettings.h
SpotToSave.cpp
XrayFluorescenceSpectrum.cpp
XrayFluorescenceSpectrum.h
ResolutionShells.cpp
ResolutionShells.h
DarkMaskSettings.cpp
DarkMaskSettings.h
TopPixels.cpp
TopPixels.h
hkl_key.h
JfjochTCP.h
BrokerStatus.h
ScalingSettings.cpp
ScalingSettings.h
UnitCell.cpp
UnitCell.h
CorrelationCoefficient.cpp
CorrelationCoefficient.h
JFJochReceiverPlots.cpp
JFJochReceiverPlots.h
)
# librt is Linux/glibc-only (older glibc keeps clock_gettime/timer_*/sem_* there, and some
# distros are picky about it for pthreads); it does not exist on macOS/Windows.
TARGET_LINK_LIBRARIES(JFJochCommon JFJochLogger Compression JFCalibration gemmi Threads::Threads
$<$<PLATFORM_ID:Linux>:rt>)
TARGET_LINK_LIBRARIES(JFJochZMQ "$<BUILD_INTERFACE:libzmq-static>")
IF (JFJOCH_CUDA_AVAILABLE)
TARGET_SOURCES(JFJochCommon PRIVATE CUDAWrapper.cu )
TARGET_LINK_LIBRARIES(JFJochCommon CUDA::cudart_static
${CMAKE_DL_LIBS} $<$<PLATFORM_ID:Linux>:rt>)
ENDIF()