set(MODULE_NAME video)

list(APPEND video_HEADERS 
    Video.h
    BasicVideoConverter.h
    IVideoConverter.h
    )

list(APPEND video_LIB_INCLUDES 
    Video.cpp
    BasicVideoConverter.cpp
    )
    
list(APPEND video_DEFINES "")

message(STATUS "Checking dependencies for module: " ${MODULE_NAME})
find_package(PkgConfig QUIET)
set(_HAS_FFMPEG Off)
if(PkgConfig_FOUND)
	pkg_check_modules(LIBAV IMPORTED_TARGET QUIET
	    libavdevice
	    libavfilter
	    libavformat
	    libavcodec
	    libswresample
	    libswscale
	    libavutil
	)    
	
	if (libavdevice_FOUND)
    	list(APPEND video_LIBS PkgConfig::LIBAV)
    	list(APPEND video_HEADERS 
    		FfmpegInterface.h
    		)
    	list(APPEND video_LIB_INCLUDES 
    		FfmegInterface.cpp
    		)
    	list(APPEND video_DEFINES "HAS_FFMPEG")
    	set(_HAS_FFMPEG ON)
    else()
        message(STATUS "ffmpeg not found - skipping support")
	endif()
else()
	message(STATUS "ffmpeg not found - skipping support")
endif()

add_library(${MODULE_NAME} SHARED ${video_LIB_INCLUDES} ${video_HEADERS})

target_include_directories(${MODULE_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties( video PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON )   

list(APPEND video_LIBS image)

target_link_libraries( video PUBLIC ${video_LIBS})

set_property(TARGET video PROPERTY FOLDER src/media)
