project(lws-minimal-raw-webrtc-webcam C)
cmake_minimum_required(VERSION 3.10)
find_package(libwebsockets CONFIG REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${LWS_CMAKE_DIR})
include(LwsCheckRequirements)

set(SAMP lws-minimal-raw-webrtc-webcam)
set(SRCS minimal-raw-webrtc-webcam.c webcam-media.c)

set(requirements 1)
require_lws_config(LWS_ROLE_H1 1 requirements)
require_lws_config(LWS_ROLE_WS 1 requirements)
require_lws_config(LWS_WITH_DTLS 1 requirements)
require_lws_config(LWS_WITH_TRANSCODE 1 requirements)
require_lws_config(LWS_WITH_V4L2 1 requirements)

if (requirements)
	add_executable(${SAMP} ${SRCS})
	target_link_libraries(${SAMP} websockets opus alsa v4l2)
	if (UNIX)
		target_link_libraries(${SAMP} asound)
	endif()
endif()
