Files
Jungfraujoch/common/CMakeLists.txt
T
leonarski_fandClaude Opus 5 22d75e2f01 build: take the project version from the VERSION file, and read it once
PROJECT() carried a hardcoded 1.0.0 next to a JFJOCH_VERSION read from the VERSION file,
so PROJECT_VERSION was free to drift from the version everything else uses. It cannot
simply be handed the same string - project(VERSION) accepts numeric major.minor.patch
only, and rejects a pre-release suffix such as -rc.161 - so cut the numeric part out of
the same file instead of writing it down a second time.

common/ then read ../VERSION again into PACKAGE_VERSION, purely to interpolate it into
GitInfo.cpp. That is the same file read twice with two variable names, one of them a
common enough name to be set by something else in the parent scope. Use JFJOCH_VERSION,
which is already in scope there.

The CUDA architecture note claimed the list "embeds no PTX". A bare entry in
CMAKE_CUDA_ARCHITECTURES emits SASS and PTX both, so the newest entry has been the
forward-compatibility path all along: on a GPU newer than anything listed, the driver
JIT-compiles that PTX at first launch. Adding sm_121 still buys native code on Spark
instead of a JIT, which is what the comment should have said.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 20:52:09 +02:00

154 lines
4.8 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
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()