cmake_minimum_required(VERSION 3.16)
project(remoter_wayland_helpers C)
set(CMAKE_C_STANDARD 11)

find_package(PkgConfig REQUIRED)

# ---- Capture helper (PipeWire + libportal) ----

pkg_check_modules(PORTAL REQUIRED libportal gio-2.0 glib-2.0 gobject-2.0)
pkg_check_modules(PW REQUIRED libpipewire-0.3)

add_executable(remoter-capture-wayland main.c)

target_include_directories(remoter-capture-wayland PRIVATE
    ${PORTAL_INCLUDE_DIRS}
    ${PW_INCLUDE_DIRS}
)

target_link_libraries(remoter-capture-wayland PRIVATE
    ${PORTAL_LIBRARIES}
    ${PW_LIBRARIES}
    pthread
)

target_compile_options(remoter-capture-wayland PRIVATE
    ${PORTAL_CFLAGS_OTHER}
    ${PW_CFLAGS_OTHER}
    -Wall -Wextra
)

# ---- Control helper (libei + liboeffis) ----

pkg_check_modules(EI REQUIRED libei-1.0)
pkg_check_modules(OEFFIS REQUIRED liboeffis-1.0)
pkg_check_modules(XKB REQUIRED xkbcommon)

add_executable(remoter-control-wayland remoter-control-wayland.c)

target_include_directories(remoter-control-wayland PRIVATE
    ${EI_INCLUDE_DIRS}
    ${OEFFIS_INCLUDE_DIRS}
    ${XKB_INCLUDE_DIRS}
)

target_link_libraries(remoter-control-wayland PRIVATE
    ${EI_LIBRARIES}
    ${OEFFIS_LIBRARIES}
    ${XKB_LIBRARIES}
    pthread
)

target_compile_options(remoter-control-wayland PRIVATE
    ${EI_CFLAGS_OTHER}
    ${OEFFIS_CFLAGS_OTHER}
    -Wall -Wextra
)

