# Copyright 2025 Digitalwerk GmbH.
#
#     This Source Code Form is subject to the terms of the Mozilla
#     Public License, v. 2.0. If a copy of the MPL was not distributed
#     with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# If it is not possible or desirable to put the notice in a particular file, then
# You may include the notice in a location (such as a LICENSE file in a
# relevant directory) where a recipient would be likely to look for such a notice.
#
# You may add additional accurate notices of copyright ownership.

find_package(adtf_sdk 3.21 REQUIRED COMPONENTS systemsdk filtersdk)

configure_file(version.py.in "${CMAKE_CURRENT_BINARY_DIR}/version.py")

add_library(adtf_system_python_bindings STATIC
        session.h
        session.cpp
        streaming_types.h
        streaming_types.cpp
        sample_streams.h
        sample_streams.cpp
        future.h
        future.cpp
        graph_utils_compat.h
)

target_link_libraries(adtf_system_python_bindings PUBLIC pybind11::module PRIVATE adtf::systemsdk adtf::filtersdk decoder)
if (NOT WIN32)
    target_link_libraries(adtf_system_python_bindings PUBLIC "-Wl,-z,undefs")
endif ()

set_target_properties(adtf_system_python_bindings PROPERTIES POSITION_INDEPENDENT_CODE True)
target_include_directories(adtf_system_python_bindings PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
target_compile_features(adtf_system_python_bindings PUBLIC cxx_std_17)
target_compile_definitions(adtf_system_python_bindings PUBLIC MODULE_RELEASE_ABI_VERSION=${MODULE_RELEASE_ABI_VERSION})

pybind11_add_module(_adtf MODULE adtf_python_module.cpp)
target_link_libraries(_adtf PRIVATE adtf_system_python_bindings Python::Module)

install_module(adtf --enum-class-locations LogLevel:_adtf --enum-class-locations Items:_adtf)
