Generate proper DL_OPENGL value for linux

Since we rely on the dynamic linker to find the library for us via
dlopen(), we need to have DL_OPENGL be .so.N, not the full library
filename, as ldconfig doesn't cache the full filename

Use of TARGET_SONAME_FILE requires the library to be marked as SHARED,
not MODULE

This closes pull request #370
This commit is contained in:
Kevin Tardif 2015-02-13 20:13:52 -05:00 committed by jp9000
parent 2cc4c6e8d3
commit c293c17620
2 changed files with 20 additions and 7 deletions

View File

@ -521,10 +521,17 @@ function(define_graphic_modules target)
foreach(dl_lib opengl d3d9 d3d11)
string(TOUPPER ${dl_lib} dl_lib_upper)
if(TARGET libobs-${dl_lib})
target_compile_definitions(${target}
PRIVATE
DL_${dl_lib_upper}="$<TARGET_FILE_NAME:libobs-${dl_lib}>"
)
if(UNIX AND UNIX_STRUCTURE)
target_compile_definitions(${target}
PRIVATE
DL_${dl_lib_upper}="$<TARGET_SONAME_FILE_NAME:libobs-${dl_lib}>"
)
else()
target_compile_definitions(${target}
PRIVATE
DL_${dl_lib_upper}="$<TARGET_FILE_NAME:libobs-${dl_lib}>"
)
endif()
else()
target_compile_definitions(${target}
PRIVATE

View File

@ -67,9 +67,15 @@ set(libobs-opengl_HEADERS
gl-shaderparser.h
gl-subsystem.h)
add_library(libobs-opengl MODULE
${libobs-opengl_SOURCES}
${libobs-opengl_HEADERS})
if(WIN32 OR APPLE)
add_library(libobs-opengl MODULE
${libobs-opengl_SOURCES}
${libobs-opengl_HEADERS})
else()
add_library(libobs-opengl SHARED
${libobs-opengl_SOURCES}
${libobs-opengl_HEADERS})
endif()
if(WIN32 OR APPLE)
set_target_properties(libobs-opengl