obs-studio/deps/glad/CMakeLists.txt
Kurt Kartaltepe f4a820a4ea deps/glad: update Glad for EGL with new extensions
This updates glad for EGL and adds in several extensions.

EGL_EXT_platform_base
EGL_EXT_platform_xcb
EGL_KHR_image_base
EGL_KHR_image_pixmap

The xcb platform extension is unused but good to include if we want to
try removing more Xlib dependencies. platform_base is included for good
measure as other platform extensions technically build on it. image_base
and image_pixmap are for upcoming xcomposite over EGL support.

It also drops the unused create_context_no_error extensions.
2022-05-15 09:08:53 -03:00

53 lines
1.3 KiB
CMake

project(glad)
find_package(OpenGL REQUIRED)
add_library(glad SHARED)
add_library(OBS::obsglad ALIAS glad)
target_sources(glad PRIVATE src/glad.c include/glad/glad.h)
target_include_directories(glad PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(glad PRIVATE GLAD_GLAPI_EXPORT_BUILD)
target_link_libraries(glad PUBLIC OpenGL::GL)
set_target_properties(
glad
PROPERTIES OUTPUT_NAME obsglad
FOLDER "deps"
VERSION "${OBS_VERSION_MAJOR}"
SOVERSION "1")
if(OS_WINDOWS)
set(MODULE_DESCRIPTION "Glad OpenGL Loading Library")
configure_file(${CMAKE_SOURCE_DIR}/cmake/bundle/windows/obs-module.rc.in
obsglad.rc)
target_sources(glad PRIVATE src/glad_wgl.c include/glad/glad_wgl.h obsglad.rc)
elseif(OS_POSIX AND NOT OS_MACOS)
find_package(OpenGL REQUIRED)
find_package(X11 REQUIRED)
target_link_libraries(glad PRIVATE X11::X11)
target_sources(glad PRIVATE src/glad_glx.c include/glad/glad_glx.h)
if(TARGET OpenGL::EGL)
target_sources(glad PRIVATE src/glad_egl.c include/EGL/eglplatform.h
include/glad/glad_egl.h)
target_link_libraries(glad PRIVATE OpenGL::EGL)
endif()
endif()
if(NOT MSVC)
target_compile_options(glad PRIVATE -fvisibility=hidden)
endif()
setup_binary_target(glad)