yolobs-studio/deps/glad/CMakeLists.txt

70 lines
1.3 KiB
CMake
Raw Permalink Normal View History

2016-02-23 23:16:51 +00:00
project(glad)
find_package(OpenGL)
if(NOT WIN32 AND NOT APPLE)
find_package(X11)
endif()
set(glad_SOURCES
src/glad.c
include/glad/glad.h)
if(WIN32)
2020-05-27 20:57:19 +00:00
set(MODULE_DESCRIPTION "Glad OpenGL Loading Library")
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in obsglad.rc)
2016-02-23 23:16:51 +00:00
set(glad_PLATFORM_SOURCES
src/glad_wgl.c
2020-05-27 20:57:19 +00:00
include/glad/glad_wgl.h
obsglad.rc)
2016-02-23 23:16:51 +00:00
elseif(NOT APPLE)
set(glad_PLATFORM_SOURCES
src/glad_glx.c
include/glad/glad_glx.h)
endif()
2018-02-19 19:54:37 +00:00
set(glad_include_dirs
PRIVATE ${OPENGL_INCLUDE_DIR})
if (UNIX AND NOT APPLE)
list (APPEND glad_include_dirs
PRIVATE ${X11_X11_INCLUDE_PATH})
endif()
2016-02-23 23:16:51 +00:00
add_library(glad SHARED
${glad_SOURCES}
${glad_PLATFORM_SOURCES})
set_target_properties(glad PROPERTIES
2020-10-01 20:15:25 +00:00
FOLDER "deps"
2016-02-23 23:16:51 +00:00
OUTPUT_NAME obsglad
VERSION "0"
2020-10-01 20:15:25 +00:00
SOVERSION "0"
POSITION_INDEPENDENT_CODE ON)
2016-02-23 23:16:51 +00:00
target_include_directories(glad
PUBLIC include
2018-02-19 19:54:37 +00:00
${glad_include_dirs})
2016-02-23 23:16:51 +00:00
target_compile_definitions(glad
PRIVATE GLAD_GLAPI_EXPORT_BUILD)
if(NOT MSVC)
target_compile_options(glad
PRIVATE -DPIC -fvisibility=hidden)
endif()
if(NOT WIN32 AND NOT APPLE)
set(glad_PLATFORM_DEPS
${X11_X11_LIB})
# only link to libdl on linux
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(glad_PLATFORM_DEPS
${glad_PLATFORM_DEPS}
-ldl)
endif()
endif()
target_link_libraries(glad
${glad_PLATFORM_DEPS}
${OPENGL_gl_LIBRARY})
install_obs_core(glad)