Merge pull request #2078 from AnyOldName3/cmake-13.1-osg-lib-fix

Adapt to CMake 3.13's new meaning of OSGDB_LIBRARY
pull/541/head
Chris Djali 6 years ago committed by GitHub
commit 066b74eb43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -269,8 +269,14 @@ set(USED_OSG_PLUGINS
osgdb_tga
)
get_filename_component(OSG_LIB_DIR ${OSGDB_LIBRARY} DIRECTORY)
set(OSGPlugins_LIB_DIR "${OSG_LIB_DIR}/osgPlugins-${OPENSCENEGRAPH_VERSION}")
set(OSGPlugins_LIB_DIR "")
foreach(OSGDB_LIB ${OSGDB_LIBRARY})
# Skip library type names
if(EXISTS ${OSGDB_LIB} AND NOT IS_DIRECTORY ${OSGDB_LIB})
get_filename_component(OSG_LIB_DIR ${OSGDB_LIB} DIRECTORY)
list(APPEND OSGPlugins_LIB_DIR "${OSG_LIB_DIR}/osgPlugins-${OPENSCENEGRAPH_VERSION}")
endif()
endforeach(OSGDB_LIB)
if(OSG_STATIC)
add_definitions(-DOSG_LIBRARY_STATIC)
@ -823,15 +829,24 @@ if (OPENMW_OSX_DEPLOYMENT AND APPLE AND DESIRED_QT_VERSION MATCHES 5)
set(ABSOLUTE_PLUGINS "")
set(OSGPlugins_DONT_FIND_DEPENDENCIES 1)
find_package(OSGPlugins REQUIRED COMPONENTS ${USED_OSG_PLUGINS})
foreach (PLUGIN_NAME ${USED_OSG_PLUGINS})
set(PLUGIN_ABS "${OSGPlugins_LIB_DIR}/${PLUGIN_NAME}.so")
string(TOUPPER ${PLUGIN_NAME} PLUGIN_NAME_UC)
if(${PLUGIN_NAME_UC}_LIBRARY_RELEASE)
set(PLUGIN_ABS ${${PLUGIN_NAME_UC}_LIBRARY_RELEASE})
elseif(${PLUGIN_NAME_UC}_LIBRARY)
set(PLUGIN_ABS ${${PLUGIN_NAME_UC}_LIBRARY})
else()
message(FATAL_ERROR "Can't find library file for ${PLUGIN_NAME}")
# We used to construct the path manually from OSGPlugins_LIB_DIR and the plugin name.
# Maybe that could be restored as a fallback?
endif()
set(ABSOLUTE_PLUGINS ${PLUGIN_ABS} ${ABSOLUTE_PLUGINS})
endforeach ()
get_filename_component(OSG_PLUGIN_PREFIX_DIR "${OSGPlugins_LIB_DIR}" NAME)
if (NOT OSG_PLUGIN_PREFIX_DIR)
message(FATAL_ERROR "Can't get directory name for OSG plugins from '${OSGPlugins_LIB_DIR}'")
endif()
set(OSG_PLUGIN_PREFIX_DIR "osgPlugins-${OPENSCENEGRAPH_VERSION}")
# installs used plugins in bundle at given path (bundle_path must be relative to ${CMAKE_INSTALL_PREFIX})
# and returns list of install paths for all installed plugins

@ -1,5 +1,6 @@
# This module accepts the following env variable
# OSGPlugins_LIB_DIR - <OpenSceneGraph>/lib/osgPlugins-<X.X.X> , path to search plugins
# OSGPlugins_DONT_FIND_DEPENDENCIES - Set to skip also finding png, zlib and jpeg
#
# Once done this will define
# OSGPlugins_FOUND - System has the all required components.
@ -41,10 +42,12 @@ foreach(_library ${OSGPlugins_FIND_COMPONENTS})
list(APPEND OSGPlugins_PROCESS_LIBS ${_component}_LIBRARY)
endforeach()
foreach(_dependency PNG ZLIB JPEG) # needed by osgdb_png or osgdb_jpeg
if(NOT DEFINED OSGPlugins_DONT_FIND_DEPENDENCIES)
foreach(_dependency PNG ZLIB JPEG) # needed by osgdb_png or osgdb_jpeg
libfind_package(OSGPlugins ${_dependency})
set(${_dependency}_LIBRARY_OPTS ${_dependency}_LIBRARY)
#list(APPEND OSGPlugins_PROCESS_LIBS ${_dependency}_LIBRARY)
endforeach()
endforeach()
endif()
libfind_process(OSGPlugins)

Loading…
Cancel
Save