From b0e28d27bd990393e22ca3f474c340e77a08357b Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Mon, 18 Dec 2023 20:42:30 +0800 Subject: Unix install sets plugin dir to system library dir because (at least) the vlc/plugins dirs are inside it in the same way it's been inside llplugin. This is so the app can find system VLC plugins. And for this, BUILD_SHARED_LIBS set on must work first on Linux (has already been working on FreeBSD), since libmedia_plugin_libvlc is a shared library (which now gets installed to system library dir too, on both OSes). --- indra/cmake/LibraryInstall.cmake | 9 ++++++++- indra/cmake/UnixInstall.cmake | 8 +++++--- indra/llfilesystem/CMakeLists.txt | 2 +- indra/llfilesystem/lldir_linux.cpp | 4 ++++ indra/llprimitive/llphysicsextensions/CMakeLists.txt | 9 ++++++++- indra/media_plugins/libvlc/CMakeLists.txt | 5 +---- 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/indra/cmake/LibraryInstall.cmake b/indra/cmake/LibraryInstall.cmake index 01838fe42e..b94841897c 100644 --- a/indra/cmake/LibraryInstall.cmake +++ b/indra/cmake/LibraryInstall.cmake @@ -2,5 +2,12 @@ list(REMOVE_ITEM ${PROJECT_NAME}_HEADER_FILES CMakeLists.txt) #install(FILES ${${PROJECT_NAME}_HEADER_FILES} # DESTINATION include/${PROJECT_NAME}) if (BUILD_SHARED_LIBS) - install(TARGETS ${PROJECT_NAME} DESTINATION lib) + if (EXISTS ${CMAKE_SYSROOT}/usr/lib/${ARCH}-linux-gnu) + set(_LIB lib/${ARCH}-linux-gnu) + elseif (EXISTS /lib64) + set(_LIB lib64) + else () + set(_LIB lib) + endif () + install(TARGETS ${PROJECT_NAME} DESTINATION ${_LIB}) endif () diff --git a/indra/cmake/UnixInstall.cmake b/indra/cmake/UnixInstall.cmake index 55b6889836..a748237c5b 100644 --- a/indra/cmake/UnixInstall.cmake +++ b/indra/cmake/UnixInstall.cmake @@ -9,11 +9,13 @@ if (INSTALL) set(INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Top-level installation directory.") - if (EXISTS /lib64) + if (EXISTS ${CMAKE_SYSROOT}/usr/lib/${ARCH}-linux-gnu) + set(_LIB lib/${ARCH}-linux-gnu) + elseif (EXISTS /lib64) set(_LIB lib64) - else (EXISTS /lib64) + else () set(_LIB lib) - endif (EXISTS /lib64) + endif () set(INSTALL_LIBRARY_DIR ${INSTALL_PREFIX}/${_LIB} CACHE PATH "Installation directory for read-only shared files.") diff --git a/indra/llfilesystem/CMakeLists.txt b/indra/llfilesystem/CMakeLists.txt index 9a69a833c0..7db1971460 100644 --- a/indra/llfilesystem/CMakeLists.txt +++ b/indra/llfilesystem/CMakeLists.txt @@ -37,7 +37,7 @@ if (LINUX OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") if (INSTALL) set_source_files_properties(lldir_linux.cpp PROPERTIES COMPILE_FLAGS - "-DAPP_RO_DATA_DIR=\\\"${APP_SHARE_DIR}\\\" -DAPP_LIBEXEC_DIR=\\\"${APP_LIBEXEC_DIR}\\\"" + "-DAPP_RO_DATA_DIR=\\\"${APP_SHARE_DIR}\\\" -DAPP_LIBEXEC_DIR=\\\"${APP_LIBEXEC_DIR}\\\" -DAPP_PLUGIN_DIR=\\\"${INSTALL_LIBRARY_DIR}\\\"" ) endif (INSTALL) endif (LINUX OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") diff --git a/indra/llfilesystem/lldir_linux.cpp b/indra/llfilesystem/lldir_linux.cpp index 7e8fe157ba..c343728505 100644 --- a/indra/llfilesystem/lldir_linux.cpp +++ b/indra/llfilesystem/lldir_linux.cpp @@ -137,7 +137,11 @@ LLDir_Linux::LLDir_Linux() } } +#ifdef APP_PLUGIN_DIR + mLLPluginDir = APP_PLUGIN_DIR; +#else mLLPluginDir = mExecutableDir + mDirDelimiter + "llplugin"; +#endif // *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something. mTempDir = "/tmp"; diff --git a/indra/llprimitive/llphysicsextensions/CMakeLists.txt b/indra/llprimitive/llphysicsextensions/CMakeLists.txt index fb15e7b782..258cea5dd7 100644 --- a/indra/llprimitive/llphysicsextensions/CMakeLists.txt +++ b/indra/llprimitive/llphysicsextensions/CMakeLists.txt @@ -80,7 +80,14 @@ list(REMOVE_ITEM ${PROJECT_NAME}_HEADER_FILES LLPhysicsExtensionsStubImpl.h) #install(FILES ${${PROJECT_NAME}_HEADER_FILES} DESTINATION include/${PROJECT_NAME}) if (BUILD_SHARED_LIBS) - install(TARGETS ${PROJECT_NAME}stub DESTINATION lib) + if (EXISTS ${CMAKE_SYSROOT}/usr/lib/${ARCH}-linux-gnu) + set(_LIB lib/${ARCH}-linux-gnu) + elseif (EXISTS /lib64) + set(_LIB lib64) + else () + set(_LIB lib) + endif () + install(TARGETS ${PROJECT_NAME}stub DESTINATION ${_LIB}) endif () if (LINUX) diff --git a/indra/media_plugins/libvlc/CMakeLists.txt b/indra/media_plugins/libvlc/CMakeLists.txt index 84fac1634c..9e5c0abb62 100644 --- a/indra/media_plugins/libvlc/CMakeLists.txt +++ b/indra/media_plugins/libvlc/CMakeLists.txt @@ -56,7 +56,4 @@ if (DARWIN) endif (DARWIN) -if (INSTALL) - install(TARGETS ${PROJECT_NAME} DESTINATION - libexec/${VIEWER_BINARY_NAME}/llplugin) -endif () +include(LibraryInstall) -- cgit v1.2.3