# 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(uddf_tegra_deser_power_library SHARED TegraDeserPowerLibrary.cpp)
add_library(uddf-cdd::uddf_tegra_deser_power_library ALIAS uddf_tegra_deser_power_library)

target_compile_features(uddf_tegra_deser_power_library PUBLIC cxx_std_17)

target_include_directories(uddf_tegra_deser_power_library
    PUBLIC
        ${UDDF_CDD_DRIVER}/tegra-deser-power
        ${UDDF_CDD_DRIVER}/tegra-deser-power/native-gpio
)

# Default to L4T platform for host compile-check and Orin Linux targets.
# Override by passing -DPOWER_PLATFORM=QNX or -DPOWER_PLATFORM=EMBEDDED_LINUX.
if(NOT DEFINED POWER_PLATFORM OR POWER_PLATFORM STREQUAL "L4T")
    target_compile_definitions(uddf_tegra_deser_power_library PRIVATE POWER_PLATFORM_L4T)
elseif(POWER_PLATFORM STREQUAL "QNX")
    target_compile_definitions(uddf_tegra_deser_power_library PRIVATE POWER_PLATFORM_QNX)
elseif(POWER_PLATFORM STREQUAL "EMBEDDED_LINUX")
    target_compile_definitions(uddf_tegra_deser_power_library PRIVATE POWER_PLATFORM_EMBEDDED_LINUX)
endif()

target_link_libraries(uddf_tegra_deser_power_library
    PUBLIC
        uddf::uddf
        uddf-cdd::uddf_drivers_tegra_deser_power_native_gpio
)
