cmake_minimum_required(VERSION 3.22...3.25) legacy_check() add_library(libobs-opengl SHARED) add_library(OBS::libobs-opengl ALIAS libobs-opengl) if(NOT TARGET OBS::glad) add_subdirectory("${CMAKE_SOURCE_DIR}/deps/glad" "${CMAKE_BINARY_DIR}/deps/glad") endif() if(OS_LINUX OR OS_FREEBSD OR OS_OPENBSD) find_package(X11 REQUIRED) # cmake-format: off find_package(xcb REQUIRED xcb) # cmake-format: on find_package(x11-xcb REQUIRED) if(ENABLE_WAYLAND) find_package(OpenGL REQUIRED EGL) find_package(Wayland REQUIRED) endif() endif() target_sources( libobs-opengl PRIVATE # cmake-format: sortable $<$,$>:gl-wayland-egl.c> $<$:gl-cocoa.m> $<$:gl-egl-common.c> $<$:gl-nix.c> $<$:gl-x11-egl.c> $<$:gl-windows.c> gl-helpers.c gl-helpers.h gl-indexbuffer.c gl-shader.c gl-shaderparser.c gl-shaderparser.h gl-stagesurf.c gl-subsystem.c gl-subsystem.h gl-texture2d.c gl-texture3d.c gl-texturecube.c gl-vertexbuffer.c gl-zstencil.c) target_compile_options(libobs-opengl PRIVATE $<$:-Wno-strict-prototypes>) target_compile_definitions(libobs-opengl PRIVATE $<$:GL_SILENCE_DEPRECATION>) target_link_libraries( libobs-opengl PRIVATE OBS::libobs OBS::glad "$<$:$>" "$<$:$>" $<$:xcb::xcb> $<$:X11::x11-xcb> $<$,$>:OpenGL::EGL> $<$,$>:Wayland::EGL>) if(OS_WINDOWS) configure_file(cmake/windows/obs-module.rc.in libobs-opengl.rc) target_sources(libobs-opengl PRIVATE libobs-opengl.rc) endif() target_enable_feature(libobs "OpenGL renderer") # cmake-format: off set_target_properties_obs( libobs-opengl PROPERTIES FOLDER core VERSION 0 PREFIX "" SOVERSION "${OBS_VERSION_MAJOR}") # cmake-format: on