Skip to content

Commit

Permalink
[osg] Fix plugin installation and target locations (#26214)
Browse files Browse the repository at this point in the history
* [osg] Install plugins directly to plugins folder

This change removes the stage in portfile.cmake which relocates the osg  plugins from bin/ to plugins/. Instead, the OsgMacroUtils.cmake file is patched to install directly to the plugins folder.

This has two primary effects. The first is correcting the exported target locations, as they still pointed to bin/ after moving the plugins. The second is fixing the process on non-Windows platforms, as the plugins were not being moved in those cases.

* update version

* update version

* update version

* [osg] Update version

* [osg] Update port version

* [osg] Fix port version

Co-authored-by: Jonliu1993 <[email protected]>
  • Loading branch information
cbrl and JonLiu1993 authored Oct 9, 2022
1 parent 09d33fe commit 472e9f1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
11 changes: 0 additions & 11 deletions ports/osg/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,7 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(APPEND "${CURRENT_PACKAGES_DIR}/include/osg/Config" "#ifndef OSG_LIBRARY_STATIC\n#define OSG_LIBRARY_STATIC 1\n#endif\n")
endif()

# Move all osg plugins to [/debug]/plugins/osgPlugins-${OSG_VER},
# as a staging area for later deployment.
set(osg_plugins_subdir "osgPlugins-${OSG_VER}")
if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/${osg_plugins_subdir}")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/plugins")
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/${osg_plugins_subdir}" "${CURRENT_PACKAGES_DIR}/plugins/${osg_plugins_subdir}")
if(NOT VCPKG_BUILD_TYPE)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/plugins")
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/bin/${osg_plugins_subdir}" "${CURRENT_PACKAGES_DIR}/debug/plugins/${osg_plugins_subdir}")
endif()
endif()

if("tools" IN_LIST FEATURES)
set(osg_plugin_pattern "${VCPKG_TARGET_SHARED_LIBRARY_PREFIX}osgdb*${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}")
file(GLOB osg_plugins "${CURRENT_PACKAGES_DIR}/plugins/${osg_plugins_subdir}/${osg_plugin_pattern}")
Expand Down
19 changes: 14 additions & 5 deletions ports/osg/unofficial-export.patch
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,34 @@ index f6714c5..d58f6fd 100644
LIBRARY DESTINATION ${INSTALL_LIBDIR} COMPONENT libopenscenegraph
ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR} COMPONENT libopenscenegraph-dev
diff --git a/CMakeModules/OsgMacroUtils.cmake b/CMakeModules/OsgMacroUtils.cmake
index dcc1fe3..a12fcf1 100644
index dcc1fe37d..76429b85a 100644
--- a/CMakeModules/OsgMacroUtils.cmake
+++ b/CMakeModules/OsgMacroUtils.cmake
@@ -345,6 +345,7 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
@@ -345,18 +350,20 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
#the installation path are differentiated for win32 that install in bib versus other architecture that install in lib${LIB_POSTFIX}/${OSG_PLUGINS}
IF(WIN32)
INSTALL(TARGETS ${TARGET_TARGETNAME}
+ EXPORT osg-plugins
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
ARCHIVE DESTINATION lib/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
@@ -354,6 +355,7 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
- LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
+ LIBRARY DESTINATION plugins/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
IF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
- INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS RelWithDebInfo)
- INSTALL(FILES $<TARGET_PDB_FILE:${TARGET_TARGETNAME}> DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS Debug)
+ INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION plugins/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS RelWithDebInfo)
+ INSTALL(FILES $<TARGET_PDB_FILE:${TARGET_TARGETNAME}> DESTINATION plugins/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS Debug)
ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
ELSE(WIN32)
INSTALL(TARGETS ${TARGET_TARGETNAME}
+ EXPORT osg-plugins
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
- LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
+ LIBRARY DESTINATION plugins${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
ENDIF(WIN32)
ENDMACRO(SETUP_PLUGIN)

diff --git a/src/OpenThreads/pthreads/CMakeLists.txt b/src/OpenThreads/pthreads/CMakeLists.txt
index e18969c..5a8ad62 100644
--- a/src/OpenThreads/pthreads/CMakeLists.txt
Expand Down
2 changes: 1 addition & 1 deletion ports/osg/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "osg",
"version": "3.6.5",
"port-version": 17,
"port-version": 18,
"description": "The OpenSceneGraph is an open source high performance 3D graphics toolkit.",
"homepage": "https://www.openscenegraph.com/",
"license": null,
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5506,7 +5506,7 @@
},
"osg": {
"baseline": "3.6.5",
"port-version": 17
"port-version": 18
},
"osg-qt": {
"baseline": "Qt5",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/osg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "cb957f4950031c9c7fedfbcfe1ba698cc435dedd",
"version": "3.6.5",
"port-version": 18
},
{
"git-tree": "e29f8e57a49cb782817b890b77b3f0ec06afe3c0",
"version": "3.6.5",
Expand Down

0 comments on commit 472e9f1

Please sign in to comment.