# The Flutter tooling requires that developers have CMake 3.10 or later
# installed. You should not increase this version, as doing so will cause
# the plugin to fail to compile for some customers of the plugin.
cmake_minimum_required(VERSION 3.10)

project(flutter_webrtcvad_library VERSION 0.0.1 LANGUAGES C CXX)

file(GLOB_RECURSE WEBRTC_SOURCES
    "webrtc/common_audio/signal_processing/*.c"
    "webrtc/common_audio/third_party/*.c"
    "webrtc/common_audio/vad/*.c"
    "webrtc/rtc_base/*.cc"
)

if(WIN32)
    add_definitions(-D_WIN32 -DWEBRTC_WIN)
else()
    add_definitions(-DWEBRTC_POSIX)
endif()

include_directories(".")


add_library(flutter_webrtcvad SHARED
  "flutter_webrtcvad.c" ${WEBRTC_SOURCES}
)

set_target_properties(flutter_webrtcvad PROPERTIES
  PUBLIC_HEADER flutter_webrtcvad.h
  OUTPUT_NAME "flutter_webrtcvad"
  LINKER_LANGUAGE CXX
)

target_compile_definitions(flutter_webrtcvad PUBLIC DART_SHARED_LIB)
