cmake_minimum_required(VERSION 3.20)
project(cuframes
    VERSION 0.3.0
    DESCRIPTION "Zero-copy frame sharing via CUDA IPC"
    LANGUAGES C CXX CUDA
)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release)
endif()

if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
    set(CMAKE_CUDA_ARCHITECTURES "75;86;89;90;120")
endif()

option(BUILD_TESTING "Build tests" ON)
option(BUILD_EXAMPLES "Build examples" ON)
option(BUILD_FFMPEG_FILTER "Build FFmpeg vf_cuda_ipc_export filter (out-of-tree, требует patch FFmpeg)" OFF)
option(BUILD_PYTHON_BINDINGS "Build Python bindings (Phase 3+)" OFF)
option(BUILD_TOOLS "Build standalone tools (cuframes-rtsp-source)" ON)

enable_testing()

add_subdirectory(libcuframes)

if(BUILD_EXAMPLES)
    add_subdirectory(examples)
endif()

if(BUILD_FFMPEG_FILTER)
    add_subdirectory(filter)
endif()

if(BUILD_TOOLS)
    add_subdirectory(tools/cuframes-rtsp-source)
endif()
