
SET(ADM_LIB ADM_render6)
ADD_LIBRARY(${ADM_LIB} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/GUI_render.cpp)

SET_TARGET_PROPERTIES(${ADM_LIB} PROPERTIES OUTPUT_NAME ADM_render6_${QT_LIBRARY_EXTENSION})
TARGET_SOURCES(${ADM_LIB} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/GUI_simpleRender.cpp)
TARGET_LINK_LIBRARIES(${ADM_LIB} PUBLIC ${QT_QTGUI_LIBRARY})
IF(USE_OPENGL)
  INCLUDE(admOpenGl)
  INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/ADM_openGL/include/)
  ADM_OPEN_GL(${ADM_LIB})
  TARGET_SOURCES(${ADM_LIB} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/GUI_qtGlRender.cpp)
ENDIF()

TARGET_SOURCES(${ADM_LIB} PRIVATE GUI_renderFactory_common.cpp)

IF(APPLE)
  #TARGET_SOURCES(${ADM_LIB} PRIVATE GUI_renderFactory_mac.cpp)
  IF(USE_SDL)
    TARGET_SOURCES(${ADM_LIB} PRIVATE GUI_sdlRenderHelper.m)
  ENDIF()
ELSEIF(WIN32)
  TARGET_SOURCES(${ADM_LIB} PRIVATE GUI_renderFactory_win32.cpp)
ELSE() # linux
  TARGET_SOURCES(${ADM_LIB} PRIVATE GUI_renderFactory_linux.cpp)
ENDIF()
IF(USE_XV)
  TARGET_SOURCES(${ADM_LIB} PRIVATE GUI_xvRender.cpp)
  TARGET_LINK_LIBRARIES(${ADM_LIB} PUBLIC ${XVIDEO_LIBRARY_DIR} ${XEXT_LIBRARY_DIR})
ENDIF()
IF(USE_SDL3)
  MESSAGE(STATUS "SDL3 enabled, disabling SDL2 to avoid symbol conflicts.")
  TARGET_SOURCES(${ADM_LIB} PRIVATE GUI_sdl3Render.cpp)
  TARGET_INCLUDE_DIRECTORIES(${ADM_LIB} PRIVATE ${SDL3_INCLUDE_DIRS})
  TARGET_LINK_LIBRARIES(${ADM_LIB} PUBLIC ${SDL3_LIBRARIES})
ELSEIF(USE_SDL)
  TARGET_SOURCES(${ADM_LIB} PRIVATE GUI_sdlRender.cpp)
  SDLify(GUI_sdlRender.cpp)
  TARGET_LINK_LIBRARIES(${ADM_LIB} PUBLIC ${SDL2_LIBRARY})
ENDIF()

IF(USE_VDPAU)
  ADD_CORE_INCLUDE(ADM_coreVdpau)
  TARGET_SOURCES(${ADM_LIB} PRIVATE GUI_vdpauRender.cpp)
  TARGET_LINK_LIBRARIES(${ADM_LIB} PUBLIC ADM_coreVDPAU6)
ENDIF()
IF(USE_DXVA2)
  ADD_SUBDIRECTORY(ADM_coreDxva2)
  INCLUDE_DIRECTORIES(ADM_coreDxva2/include)
  TARGET_LINK_LIBRARIES(${ADM_LIB} PUBLIC ADM_coreDxva26)
  ADD_CORE_INCLUDE(ADM_coreDxva2)
  TARGET_SOURCES(${ADM_LIB} PRIVATE GUI_dxva2Render.cpp)
ENDIF()
IF(USE_LIBVA)
  ADD_CORE_INCLUDE(ADM_coreLibVA)
  TARGET_SOURCES(${ADM_LIB} PRIVATE GUI_libvaRender.cpp)
ENDIF()

TARGET_LINK_LIBRARIES(${ADM_LIB} PUBLIC ADM_core6 ADM_coreUI6 ADM_coreImage6 ADM_coreUtils6 adm_gettext ADM_qtx_${QT_EXTENSION})
TARGET_INCLUDE_DIRECTORIES(${ADM_LIB} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

ADD_LIBRARY(ADM_render6_interface INTERFACE)
TARGET_INCLUDE_DIRECTORIES(ADM_render6_interface INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})


# ?? ADM_COND_LINK(GETTEXT_FOUND ${GETTEXT_LIBRARY_DIR})
ADM_INSTALL_LIB(${ADM_LIB})
# EOF
