From c293c17620cf5e7096eeaa0e9fe9e078c5946ef4 Mon Sep 17 00:00:00 2001 From: Kevin Tardif Date: Fri, 13 Feb 2015 20:13:52 -0500 Subject: [PATCH] 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 --- cmake/Modules/ObsHelpers.cmake | 15 +++++++++++---- libobs-opengl/CMakeLists.txt | 12 +++++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/cmake/Modules/ObsHelpers.cmake b/cmake/Modules/ObsHelpers.cmake index fdd83c12e..f951830bb 100644 --- a/cmake/Modules/ObsHelpers.cmake +++ b/cmake/Modules/ObsHelpers.cmake @@ -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}="$" - ) + if(UNIX AND UNIX_STRUCTURE) + target_compile_definitions(${target} + PRIVATE + DL_${dl_lib_upper}="$" + ) + else() + target_compile_definitions(${target} + PRIVATE + DL_${dl_lib_upper}="$" + ) + endif() else() target_compile_definitions(${target} PRIVATE diff --git a/libobs-opengl/CMakeLists.txt b/libobs-opengl/CMakeLists.txt index 7263f3522..a116c992d 100644 --- a/libobs-opengl/CMakeLists.txt +++ b/libobs-opengl/CMakeLists.txt @@ -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