Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tools] Factorize and clean plugin list filtering #4748

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tools/postinstall-fixup/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
COMPONENT resources)
install(CODE "execute_process(COMMAND /bin/bash
\"${CMAKE_CURRENT_LIST_DIR}/linux-postinstall-fixup.sh\"
\"${CMAKE_CURRENT_LIST_DIR}\"
\"${CMAKE_BINARY_DIR}\"
\"\$ENV{DESTDIR\}\${CMAKE_INSTALL_PREFIX\}\"
\"${QT_LIB_DIR}\"
Expand All @@ -36,6 +37,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
include(macdeployqt) # set MACDEPLOYQT_EXECUTABLE
install(CODE "execute_process(COMMAND /bin/bash
\"${CMAKE_CURRENT_LIST_DIR}/macos-postinstall-fixup.sh\"
\"${CMAKE_CURRENT_LIST_DIR}\"
\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/../..\"
\"${QT_LIB_DIR}\"
\"${QT_DATA_DIR}\"
Expand All @@ -45,6 +47,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
else()
install(CODE "execute_process(COMMAND /bin/bash
\"${CMAKE_CURRENT_LIST_DIR}/macos-postinstall-fixup.sh\"
\"${CMAKE_CURRENT_LIST_DIR}\"
\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\"
\"${QT_LIB_DIR}\"
\"${QT_DATA_DIR}\"
Expand All @@ -59,6 +62,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL Windows)
COMPONENT resources)
install(CODE "execute_process(COMMAND bash
\"${CMAKE_CURRENT_LIST_DIR}/windows-postinstall-fixup.sh\"
\"${CMAKE_CURRENT_LIST_DIR}\"
\"${CMAKE_BINARY_DIR}\"
\"\$ENV{DESTDIR\}\${CMAKE_INSTALL_PREFIX\}\"
)"
Expand Down
43 changes: 43 additions & 0 deletions tools/postinstall-fixup/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

function clean_default_plugins()
{
# Keep plugin_list as short as possible
echo "" > "$1/plugin_list.conf"
disabled_plugins='plugins_ignored_by_default'
for plugin in \
ArticulatedSystemPlugin \
Geomagic \
BeamAdapter \
CGALPlugin \
CImgPlugin \
CollisionOBBCapsule \
CSparseSolvers \
DiffusionSolver \
image \
InvertibleFVM \
ManifoldTopologies \
ModelOrderReduction \
PluginExample \
Registration \
SceneCreator \
SensableEmulation \
ShapeMatchingPlugin \
SofaAssimp \
SofaCarving \
SofaCUDA \
SofaDistanceGrid \
SofaEulerianFluid \
SofaImplicitField \
SofaMatrix \
SoftRobots \
SofaSimpleGUI \
SofaSphFluid \
SofaValidation \
STLIB \
VolumetricRendering \
; do
disabled_plugins=$disabled_plugins'\|'$plugin
done
grep -v $disabled_plugins "$1/plugin_list.conf.default" >> "$1/plugin_list.conf"
}
57 changes: 16 additions & 41 deletions tools/postinstall-fixup/linux-postinstall-fixup.sh
Original file line number Diff line number Diff line change
@@ -1,59 +1,34 @@
#!/bin/bash

usage() {
echo "Usage: linux-postinstall-fixup.sh <build-dir> <install-dir> [qt-lib-dir] [qt-data-dir]"
echo "Usage: linux-postinstall-fixup.sh <script-dir> <build-dir> <install-dir> [qt-lib-dir] [qt-data-dir]"
}

if [ "$#" -ge 2 ]; then
BUILD_DIR="$(cd $1 && pwd)"
INSTALL_DIR="$(cd $2 && pwd)"
QT_LIB_DIR="$3"
QT_DATA_DIR="$4"
SCRIPT_DIR="$(cd $1 && pwd)"
BUILD_DIR="$(cd $2 && pwd)"
INSTALL_DIR="$(cd $3 && pwd)"
QT_LIB_DIR="$4"
QT_DATA_DIR="$5"
else
usage; exit 1
fi


echo "SCRIPT_DIR = $SCRIPT_DIR"
echo "BUILD_DIR = $BUILD_DIR"
echo "INSTALL_DIR = $INSTALL_DIR"
echo "QT_LIB_DIR = $QT_LIB_DIR"
echo "QT_DATA_DIR = $QT_DATA_DIR"


# Adapt INSTALL_DIR to IFW install
if [ -d "$INSTALL_DIR/packages/Runtime/data" ]; then
INSTALL_DIR="$INSTALL_DIR/packages/Runtime/data"
fi

# Keep plugin_list as short as possible
echo "" > "$INSTALL_DIR/lib/plugin_list.conf"
disabled_plugins='plugins_ignored_by_default'
for plugin in \
ArticulatedSystemPlugin \
CollisionOBBCapsule \
Compliant \
DiffusionSolver \
ExternalBehaviorModel \
Flexible \
Geomagic \
image \
InvertibleFVM \
LMConstraint \
ManifoldTopologies \
ManualMapping \
MultiThreading \
OptiTrackNatNet \
PluginExample \
Registration \
RigidScale \
SensableEmulation \
SofaAssimp \
SofaCUDA \
SofaCarving \
SofaDistanceGrid \
SofaEulerianFluid \
SofaImplicitField \
SofaPython \
SofaSimpleGUI \
SofaSphFluid \
THMPGSpatialHashing \
; do
disabled_plugins=$disabled_plugins'\|'$plugin
done
grep -v $disabled_plugins "$INSTALL_DIR/lib/plugin_list.conf.default" >> "$INSTALL_DIR/lib/plugin_list.conf"
source $SCRIPT_DIR/common.sh
clean_default_plugins "$INSTALL_DIR/lib"

echo "Fixing up libs..."

Expand Down
50 changes: 9 additions & 41 deletions tools/postinstall-fixup/macos-postinstall-fixup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
# set -o errexit # Exit on error

usage() {
echo "Usage: macos-postinstall-fixup.sh <install-dir> [qt-lib-dir] [qt-data-dir] [macdeployqt]"
echo "Usage: macos-postinstall-fixup.sh <script-dir> <install-dir> [qt-lib-dir] [qt-data-dir] [macdeployqt]"
}

if [ "$#" -ge 1 ]; then
INSTALL_DIR="$(cd $1 && pwd)"
QT_LIB_DIR="$2"
QT_DATA_DIR="$3"
MACDEPLOYQT_EXE="$4"
SCRIPT_DIR="$(cd $1 && pwd)"
INSTALL_DIR="$(cd $2 && pwd)"
QT_LIB_DIR="$3"
QT_DATA_DIR="$4"
MACDEPLOYQT_EXE="$5"
else
usage; exit 1
fi
Expand All @@ -19,48 +20,15 @@ if [[ $INSTALL_DIR == *".app" ]]; then
INSTALL_DIR=$INSTALL_DIR/Contents/MacOS
fi

echo "SCRIPT_DIR = $SCRIPT_DIR"
echo "INSTALL_DIR = $INSTALL_DIR"
echo "BUNDLE_DIR = $BUNDLE_DIR"
echo "QT_LIB_DIR = $QT_LIB_DIR"
echo "QT_DATA_DIR = $QT_DATA_DIR"
echo "MACDEPLOYQT_EXE = $MACDEPLOYQT_EXE"

# Keep plugin_list as short as possible
echo "" > "$INSTALL_DIR/lib/plugin_list.conf"
disabled_plugins='plugins_ignored_by_default'
for plugin in \
ArticulatedSystemPlugin \
CollisionOBBCapsule \
Compliant \
DiffusionSolver \
ExternalBehaviorModel \
Flexible \
Geomagic \
image \
InvertibleFVM \
LMConstraint \
ManifoldTopologies \
ManualMapping \
MultiThreading \
OptiTrackNatNet \
PluginExample \
Registration \
RigidScale \
SensableEmulation \
SofaAssimp \
SofaCUDA \
SofaCarving \
SofaDistanceGrid \
SofaEulerianFluid \
SofaImplicitField \
SofaPython \
SofaSimpleGUI \
SofaSphFluid \
THMPGSpatialHashing \
; do
disabled_plugins=$disabled_plugins'\|'$plugin
done
grep -v $disabled_plugins "$INSTALL_DIR/lib/plugin_list.conf.default" >> "$INSTALL_DIR/lib/plugin_list.conf"
source $SCRIPT_DIR/common.sh
clean_default_plugins "$INSTALL_DIR/lib"

# Make sure the bin folder exists and contains runSofa
if [ ! -d "$INSTALL_DIR/bin" ]; then
Expand Down
46 changes: 7 additions & 39 deletions tools/postinstall-fixup/windows-postinstall-fixup.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!bash

usage() {
echo "Usage: windows-postinstall-fixup.sh <build-dir> <install-dir>"
echo "Usage: windows-postinstall-fixup.sh <script-dir> <build-dir> <install-dir>"
}

if [ "$#" -ge 2 ]; then
BUILD_DIR="$(cd $1 && pwd)"
INSTALL_DIR="$(cd $2 && pwd)"
SCRIPT_DIR="$(cd $1 && pwd)"
BUILD_DIR="$(cd $2 && pwd)"
INSTALL_DIR="$(cd $3 && pwd)"
else
usage; exit 1
fi
Expand All @@ -18,46 +19,13 @@ if [[ "$INSTALL_DIR" == *"/NSIS/"* ]] && [[ -e "$INSTALL_DIR/../applications/bin
INSTALL_DIR_BIN="$INSTALL_DIR/applications/bin"
fi

echo "SCRIPT_DIR = $SCRIPT_DIR"
echo "BUILD_DIR = $BUILD_DIR"
echo "INSTALL_DIR = $INSTALL_DIR"
echo "INSTALL_DIR_BIN = $INSTALL_DIR_BIN"

# Keep plugin_list as short as possible
echo "" > "$INSTALL_DIR_BIN/plugin_list.conf"
disabled_plugins='plugins_ignored_by_default'
for plugin in \
ArticulatedSystemPlugin \
CollisionOBBCapsule \
Compliant \
DiffusionSolver \
ExternalBehaviorModel \
Flexible \
Geomagic \
image \
InvertibleFVM \
LMConstraint \
ManifoldTopologies \
ManualMapping \
MultiThreading \
OptiTrackNatNet \
PluginExample \
Registration \
RigidScale \
SensableEmulation \
SofaAssimp \
SofaCUDA \
SofaCarving \
SofaDistanceGrid \
SofaEulerianFluid \
SofaImplicitField \
SofaPython \
SofaSimpleGUI \
SofaSphFluid \
THMPGSpatialHashing \
; do
disabled_plugins=$disabled_plugins'\|'$plugin
done
grep -v $disabled_plugins "$INSTALL_DIR_BIN/plugin_list.conf.default" >> "$INSTALL_DIR_BIN/plugin_list.conf"
source $SCRIPT_DIR/common.sh
clean_default_plugins "$INSTALL_DIR_BIN"

# Copy all plugin libs in install/bin to make them easily findable
cd "$INSTALL_DIR" && find -name "*.dll" -path "*/plugins/*" | while read lib; do
Expand Down
Loading