# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.

add_library(sensor_imx623_driver
    IMX623.cpp
)
add_library(uddf-cdd::sensor_imx623_driver ALIAS sensor_imx623_driver)

target_compile_features(sensor_imx623_driver PUBLIC cxx_std_17)

# --- Include Directories ---
target_include_directories(sensor_imx623_driver
    PUBLIC
        ${CMAKE_CURRENT_SOURCE_DIR}
        ${UDDF_CDD_COMMON_UTILS}
        ${UDDF_CDD_DRIVER}
)

target_link_libraries(sensor_imx623_driver PUBLIC uddf::uddf)

# -- HSL Compilation --
# TODO: tmake recompiles this driver per module (each shared library gets its own
# copy with potentially different HSL). CMake compiles once, so modules needing
# different HSL (e.g. C2SIM623 vs R0SIM623) require separate variant targets.
if(UDDF_CDD_HSL_OVERRIDE_sensor_imx623_driver)
  set(_hsl_src ../../../${UDDF_CDD_HSL_OVERRIDE_sensor_imx623_driver})
  unset(UDDF_CDD_HSL_OVERRIDE_sensor_imx623_driver CACHE)
  hsl_add_driver_sources(sensor_imx623_driver
    SOURCES ${_hsl_src}
    NAMESPACE uddf::cdd::imx623::hsl
    OUTPUT_NAMES "${_hsl_src}=IMX623Hsl"
    DEPENDENCIES IMX623Hsl.py
  )
else()
  hsl_add_driver_sources(sensor_imx623_driver
    SOURCES IMX623Hsl.py
    NAMESPACE uddf::cdd::imx623::hsl
  )
endif()
