cmake_minimum_required(VERSION 3.18)
project(ntsc_encoder LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(pybind11 CONFIG REQUIRED)
find_package(OpenCV REQUIRED)

# NOTE: wrapper.cpp currently includes encoder.cpp, so encoder.cpp must NOT be
# compiled as a separate translation unit (otherwise you get duplicate symbols).
pybind11_add_module(ntsc_encoder src/wrapper.cpp)

target_link_libraries(ntsc_encoder PRIVATE ${OpenCV_LIBS})

# scikit-build-core builds wheels from CMake install() output.
# Without this, you can end up with a wheel that installs no extension module.
install(TARGETS ntsc_encoder
  LIBRARY DESTINATION .
  RUNTIME DESTINATION .
  ARCHIVE DESTINATION .
)
