# 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
        Rugnux.h
        RugnuxCommandLine.cpp
        RugnuxCommandLine.h
)

TARGET_LINK_LIBRARIES(Rugnux JFJochReader JFJochImageAnalysis JFJochWriter)

# rugnux is the single offline analysis CLI: full pipeline by default, plus --azint-only
# (azimuthal integration) and --scale (re-scale/merge stored reflections) modes.
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()
