# SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
# SPDX-License-Identifier: GPL-3.0-only

ADD_LIBRARY(Rugnux STATIC
        Rugnux.cpp
        RugnuxDefaults.cpp
        RugnuxDefaults.h
        Rugnux.h
        RugnuxCalibration.cpp
        RugnuxCalibration.h
        RugnuxCommandLine.cpp
        RugnuxCommandLine.h
        ModelValidation.cpp
        ModelValidation.h
        ResultReport.cpp
        ResultReport.h
)

TARGET_LINK_LIBRARIES(Rugnux JFJochReader JFJochImageAnalysis JFJochWriter gemmi)

# rugnux is the single offline analysis CLI; --mode picks what it does: mx (the full pipeline, the
# default), azint, scale (re-scale/merge stored reflections) or calibration (powder-ring geometry).
ADD_EXECUTABLE(rugnux rugnux_cli.cpp)
TARGET_LINK_LIBRARIES(rugnux Rugnux JFJochReader JFJochImageAnalysis JFJochWriter)
INSTALL(TARGETS rugnux RUNTIME COMPONENT viewer)

# On Windows this CLI gets getopt/getopt_long from the vendored wingetopt shim (libc has none).
IF (WIN32)
    TARGET_LINK_LIBRARIES(rugnux wingetopt)
ENDIF()
