update AppDir structure on linux

This commit is contained in:
alemuntoni 2022-11-29 16:14:23 +01:00
parent 35afe2086a
commit fb25f39ca0
5 changed files with 50 additions and 20 deletions

View File

@ -43,12 +43,18 @@ chmod +x $INSTALL_PATH/usr/bin/meshlab
for plugin in $INSTALL_PATH/usr/lib/meshlab/plugins/*.so
do
patchelf --set-rpath '$ORIGIN/../../:$ORIGIN' $plugin
# allow plugins to find linked libraries in usr/lib, usr/lib/meshlab and usr/lib/meshlab/plugins
patchelf --set-rpath '$ORIGIN/../../:$ORIGIN/../:$ORIGIN' $plugin
done
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INSTALL_PATH/usr/lib
$RESOURCES_PATH/linux/linuxdeploy --appdir=$INSTALL_PATH \
--plugin qt
# after deploy, all required libraries are placed into usr/lib, therefore we can remove the ones in
# usr/lib/meshlab (except for the ones that are loaded at runtime)
shopt -s extglob
cd $INSTALL_PATH/usr/lib/meshlab
rm -v !("libIFXCore.so"|"libIFXExporting.so"|"libIFXScheduling.so")
#at this point, distrib folder contains all the files necessary to execute meshlab
echo "$INSTALL_PATH is now a self contained meshlab application"

View File

@ -31,7 +31,6 @@ case $i in
esac
done
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INSTALL_PATH/usr/lib
$RESOURCES_PATH/linux/linuxdeploy --appdir=$INSTALL_PATH \
--output appimage

View File

@ -43,8 +43,8 @@ if (MESHLAB_USE_DEFAULT_BUILD_AND_INSTALL_DIRS) # otherwise, we assume that all
include(GNUInstallDirs)
if(INSTALL_TO_UNIX_LAYOUT)
set(MESHLAB_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR})
set(MESHLAB_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
set(MESHLAB_PLUGIN_INSTALL_DIR ${MESHLAB_LIB_INSTALL_DIR}/meshlab/plugins)
set(MESHLAB_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/meshlab)
set(MESHLAB_PLUGIN_INSTALL_DIR ${MESHLAB_LIB_INSTALL_DIR}/plugins)
set(MESHLAB_SHADER_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}/meshlab/shaders)
elseif(APPLE)
set(MESHLAB_BIN_INSTALL_DIR .)
@ -60,7 +60,7 @@ if (MESHLAB_USE_DEFAULT_BUILD_AND_INSTALL_DIRS) # otherwise, we assume that all
### Install Settings
if (NOT APPLE)
set(CMAKE_INSTALL_RPATH $ORIGIN/../${MESHLAB_LIB_INSTALL_DIR};$ORIGIN/../${CMAKE_INSTALL_LIBDIR})
set(CMAKE_INSTALL_RPATH $ORIGIN/../lib/meshlab)
else()
SET(CMAKE_INSTALL_RPATH @executable_path/../Frameworks)
endif()

View File

@ -180,6 +180,6 @@ if(MESHLAB_ENABLE_DEBUG_LOG_FILE)
endif()
set_target_properties(meshlab-common PROPERTIES
INSTALL_RPATH "${MESHLAB_LIB_INSTALL_DIR}:${INSTALL_RPATH}")
INSTALL_RPATH "$ORIGIN")
install(TARGETS meshlab-common DESTINATION ${MESHLAB_LIB_INSTALL_DIR})

View File

@ -35,22 +35,35 @@
#include <QSettings>
#include <IDTF/Converter.h>
#ifdef __linux__
#define _GNU_SOURCE
#include <stdio.h>
#include <dlfcn.h>
/**
* @brief returns the path of the shared object file that contains this function, which is
* the path where the shared object (libio_u3d.so) is placed in the system.
*/
std::string getLibPath() {
Dl_info dlInfo;
dladdr((void*)getLibPath, &dlInfo);
if (dlInfo.dli_sname != NULL && dlInfo.dli_saddr != NULL) {
// the full path, included libio_u3d.so
std::string path = dlInfo.dli_fname;
// remove from the path everything after the last occurrence of '/'
path = path.substr(0, path.find_last_of('/'));
return path;
}
else {
return std::string(".");
}
}
#endif
using namespace std;
using namespace vcg;
#ifdef BUILD_MODE
const std::string LIB_IDTF_PATH = "../external/downloads/u3d-1.5.0";
#else
#ifdef __APPLE__
const std::string LIB_IDTF_PATH = "../Frameworks";
#elif __linux__
const std::string LIB_IDTF_PATH = "../lib";
#else
const std::string LIB_IDTF_PATH = ".";
#endif
#endif
U3DIOPlugin::U3DIOPlugin() :
QObject(), IOPlugin()
{
@ -75,6 +88,18 @@ void U3DIOPlugin::save(
const RichParameterList & par,
vcg::CallBackPos *)
{
#ifdef BUILD_MODE
const std::string LIB_IDTF_PATH = "../external/downloads/u3d-1.5.1";
#else
#ifdef __APPLE__
const std::string LIB_IDTF_PATH = "../Frameworks";
#elif __linux__
const std::string LIB_IDTF_PATH = getLibPath() + "/..";
#else
const std::string LIB_IDTF_PATH = ".";
#endif
#endif
vcg::tri::Allocator<CMeshO>::CompactVertexVector(m.cm);
vcg::tri::Allocator<CMeshO>::CompactFaceVector(m.cm);