From e18d5a14e7f6d07d1812d653125bf21a2066e172 Mon Sep 17 00:00:00 2001 From: = Date: Wed, 8 Mar 2023 14:41:07 +0100 Subject: [PATCH 1/4] [DEB] debug .deb package for Ubuntu --- packaging/Packaging.cmake | 12 ++--- packaging/linux/DEB.cmake | 14 +----- packaging/linux/GeneratorConfig.cmake.in | 27 ---------- packaging/linux/LinuxPackaging.cmake | 41 +++++---------- .../linux/PostArchiveCleanupScript.cmake.in | 31 ++++-------- packaging/linux/RPM.cmake | 14 +----- packaging/linux/medInria.desktop.in | 13 ++--- packaging/linux/postinst.in | 22 ++------ packaging/linux/prerm.in | 5 +- packaging/unix/Launchers.cmake | 50 ++++++------------- packaging/unix/medInria.sh.in | 37 ++------------ 11 files changed, 56 insertions(+), 210 deletions(-) delete mode 100644 packaging/linux/GeneratorConfig.cmake.in mode change 100644 => 100755 packaging/linux/postinst.in mode change 100644 => 100755 packaging/linux/prerm.in diff --git a/packaging/Packaging.cmake b/packaging/Packaging.cmake index 62b294384c..870c8e3fe9 100644 --- a/packaging/Packaging.cmake +++ b/packaging/Packaging.cmake @@ -11,18 +11,13 @@ # ################################################################################ -# Set common CPACK variables - set(CPACK_PACKAGE_NAME medInria CACHE STRING "Name of the package for the superproject") mark_as_advanced(CPACK_PACKAGE_NAME) - -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_PACKAGE_NAME} - medical image visualisation and processing tool") - +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Medical image visualisation and processing tool") set(CPACK_PACKAGE_DESCRIPTION - "${CPACK_PACKAGE_NAME} is a medical image visualization and processing tool developed at Inria by the teams Asclepios, Athena, Parietal and Visages.") - + "A tool developed at Inria by the teams Epione, Athena, Parietal and Visages.") set(CPACK_PACKAGE_VENDOR http://med.inria.fr/) -set(CPACK_PACKAGE_CONTACT "medInria Team ") +set(CPACK_PACKAGE_CONTACT "medInria team ") set(CPACK_PACKAGE_VERSION_MAJOR ${${PROJECT_NAME}_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${${PROJECT_NAME}_VERSION_MINOR}) @@ -67,6 +62,5 @@ if (UNIX) endif() # Include cpack modules - include (InstallRequiredSystemLibraries) include (CPack) diff --git a/packaging/linux/DEB.cmake b/packaging/linux/DEB.cmake index c005050e50..545ae990c0 100644 --- a/packaging/linux/DEB.cmake +++ b/packaging/linux/DEB.cmake @@ -11,17 +11,5 @@ # ################################################################################ - -set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5-sql-sqlite, libqt5-webkit") - -# TODO: Remove this when we will not support old ubuntu distribs. - -set(CPACK_DEBIAN_PACKAGE_REPLACES - "dcmtk-inria, itk-inria-build, medinria-plugins, medinria-plugins-asclepios, medinria-visages-plugins, vtk-inria-build") - -set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_PACKAGE_VENDOR}) -set(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) -set(CPACK_DEBIAN_PACKAGE_PROVIDES ${CPACK_PACKAGE_NAME}) -set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) - set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_BINARY_DIR}/packaging/linux/prerm;${CMAKE_BINARY_DIR}/packaging/linux/postinst) +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libstdc++6, libgcc-s1, qtbase5-dev, libqt5quick5") diff --git a/packaging/linux/GeneratorConfig.cmake.in b/packaging/linux/GeneratorConfig.cmake.in deleted file mode 100644 index 208ddd942e..0000000000 --- a/packaging/linux/GeneratorConfig.cmake.in +++ /dev/null @@ -1,27 +0,0 @@ -############################################################################## -# -# medInria -# -# Copyright (c) INRIA 2013-2014. All rights reserved. -# See LICENSE.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even -# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. -# -################################################################################ - - -# This file gets re-included as CPack iterates through its generator list -# setting CPACK_GENERATOR to the current generator -# -# For more details see : http://www.cmake.org/cmake/help/v2.8.9/cmake.html#module:CPack - -if (CPACK_GENERATOR STREQUAL "ZIP") - # we install everything at the root of the archive - set(CPACK_PACKAGING_INSTALL_PREFIX "") -endif() - -# we prepare the archive cleanup script -configure_file(@CURRENT_SRC_DIR@/PostArchiveCleanupScript.cmake.in @CURRENT_BIN_DIR@/PostArchiveCleanupScript.cmake @ONLY) - diff --git a/packaging/linux/LinuxPackaging.cmake b/packaging/linux/LinuxPackaging.cmake index 7d70129e92..254d3476d8 100644 --- a/packaging/linux/LinuxPackaging.cmake +++ b/packaging/linux/LinuxPackaging.cmake @@ -33,49 +33,34 @@ set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${DISTRIBUTOR_ID}_${RELEASE}-${ARCH}") # Set the right package generator - set(CPACK_GENERATOR DEB) if(${DISTRIBUTOR_ID} MATCHES fc|fedora|Fedora|Centos|centos|SUSE|Suse|suse) set(CPACK_GENERATOR RPM) endif() -# For the 3.0 release, disable RPM/DEB as we're too far behind Ubuntu/Fedora -# releases on the build farm, will re-enable if we ever manage to get up to date - -set(CPACK_GENERATOR "ZIP") +set (CPACK_PACKAGING_INSTALL_PREFIX /opt/medInria CACHE STRING "Prefix where the package will be installed") +mark_as_advanced(CPACK_PACKAGING_INSTALL_PREFIX) # Remember the linux packaging source dir - set(CURRENT_SRC_DIR ${CMAKE_SOURCE_DIR}/packaging/linux) set(CURRENT_BIN_DIR ${CMAKE_BINARY_DIR}/packaging/linux) -# Generate CPACK_PROJECT_CONFIG_FILE - -configure_file(${CURRENT_SRC_DIR}/GeneratorConfig.cmake.in - ${CURRENT_BIN_DIR}/GeneratorConfig.cmake - @ONLY) -set(CPACK_PROJECT_CONFIG_FILE ${CURRENT_BIN_DIR}/GeneratorConfig.cmake) - -# Set directory where the package will be installed - -set (CPACK_PACKAGING_INSTALL_PREFIX /usr/local/medInria CACHE STRING "Prefix where the package will be installed") -mark_as_advanced(CPACK_PACKAGING_INSTALL_PREFIX) - -# Add postinst and prerm script - -configure_file(${CURRENT_SRC_DIR}/postinst.in ${CURRENT_BIN_DIR}/postinst) +# The postinst and prerm scripts are run at package installation for both, or uninstallation for prerm configure_file(${CURRENT_SRC_DIR}/prerm.in ${CURRENT_BIN_DIR}/prerm) +configure_file(${CURRENT_SRC_DIR}/postinst.in ${CURRENT_BIN_DIR}/postinst) -# include settings specific to DEB and RPM - +# Include settings specific to DEB and RPM include(${CURRENT_SRC_DIR}/RPM.cmake) include(${CURRENT_SRC_DIR}/DEB.cmake) -# Generate desktop file. - +# Generate desktop file configure_file(${CURRENT_SRC_DIR}/medInria.desktop.in ${CURRENT_BIN_DIR}/medInria.desktop @ONLY) -install(FILES ${CURRENT_BIN_DIR}/medInria.desktop - DESTINATION share/applications) +install(FILES ${CURRENT_BIN_DIR}/medInria.desktop DESTINATION .) +install(FILES ${CMAKE_SOURCE_DIR}/src/app/medInria/resources/medInria.png DESTINATION .) + +# Configure a cleaning script run after the creation of the archive to be packaged +configure_file(${CURRENT_SRC_DIR}/PostArchiveCleanupScript.cmake.in ${CURRENT_BIN_DIR}/PostArchiveCleanupScript.cmake @ONLY) +install(CODE "include(${CURRENT_BIN_DIR}/PostArchiveCleanupScript.cmake)") # Add project to package @@ -99,8 +84,6 @@ foreach(dir ${PRIVATE_PLUGINS_LEGACY_DIRS}) set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${dir} ${dir} ALL "/bin") endforeach() -install(CODE "include(${CURRENT_BIN_DIR}/PostArchiveCleanupScript.cmake)") - # force the medinria-superproject install target to run last so we can use it # to cleanup set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${backup_CPACK_INSTALL_CMAKE_PROJECTS}) diff --git a/packaging/linux/PostArchiveCleanupScript.cmake.in b/packaging/linux/PostArchiveCleanupScript.cmake.in index 6727f25ffc..88d64a7e4b 100644 --- a/packaging/linux/PostArchiveCleanupScript.cmake.in +++ b/packaging/linux/PostArchiveCleanupScript.cmake.in @@ -1,34 +1,21 @@ -set(DIR @CPACK_PACKAGE_DIRECTORY@/_CPack_Packages/Linux/@CPACK_GENERATOR@/@CPACK_PACKAGE_FILE_NAME@) +set(DIR @CMAKE_BINARY_DIR@/_CPack_Packages/Linux/@CPACK_GENERATOR@/@CPACK_PACKAGE_FILE_NAME@/@CPACK_PACKAGING_INSTALL_PREFIX@) -# Removing useless directories +# Removing useless files and directories file(REMOVE_RECURSE ${DIR}/cmake) file(REMOVE_RECURSE ${DIR}/etc) file(REMOVE_RECURSE ${DIR}/include) file(REMOVE_RECURSE ${DIR}/share) - -# Cleaning up useless stuff in /lib +file(REMOVE_RECURSE ${DIR}/plugins) +file(REMOVE_RECURSE ${DIR}/wrp) file(REMOVE_RECURSE ${DIR}/lib/cmake) file(REMOVE_RECURSE ${DIR}/lib64/cmake) -file(REMOVE_RECURSE ${DIR}/lib/vtk-8.0/CMake) -file(REMOVE_RECURSE ${DIR}/lib/vtk-8.0/doc) -file(REMOVE_RECURSE ${DIR}/lib/vtk-8.0/doxygen) -file(REMOVE_RECURSE ${DIR}/lib/vtk-8.0/testing) -file(GLOB LIB_JUNK ${DIR}/lib/*.cmake ${DIR}/lib/vtk-8.0/*.cmake) - -if (LIB_JUNK) - list(LENGTH LIB_JUNK LIB_JUNK_LENGTH) - if (LIB_JUNK_LENGTH GREATER 0) - file(REMOVE ${LIB_JUNK}) - endif() -endif() +file(GLOB_RECURSE LIB_JUNK ${DIR}/lib/*.cmake ${DIR}/lib64/*.cmake) +file(REMOVE ${LIB_JUNK}) -# Cleaning up binaries in /bin -file(GLOB BINARIES RELATIVE ${DIR}/bin/ ${DIR}/bin/*) - -foreach(bin ${BINARIES}) - if(NOT bin MATCHES "^med") +file(GLOB BIN_JUNK RELATIVE ${DIR}/bin/ ${DIR}/bin/*) +foreach(bin ${BIN_JUNK}) + if((NOT bin MATCHES "^med") AND (NOT bin MATCHES "^plugins")) file(REMOVE ${DIR}/bin/${bin}) endif() endforeach() - diff --git a/packaging/linux/RPM.cmake b/packaging/linux/RPM.cmake index b66cee7c79..f0012427f0 100644 --- a/packaging/linux/RPM.cmake +++ b/packaging/linux/RPM.cmake @@ -11,19 +11,9 @@ # ################################################################################ -set(CPACK_RPM_PACKAGE_REQUIRES "qt, qtwebkit") -if(${DISTRIBUTOR_ID} MATCHES 14|15) - set(CPACK_RPM_PACKAGE_REQUIRES "qt, qt-webkit") -endif() - -# TODO: Remove this when we will not support old fedora distribs. - -set(CPACK_RPM_PACKAGE_OBSOLETES - "dcmtk-inria, itk-inria-build, medinria-plugins, medinria-plugins-asclepios, medinria-visages-plugins, vtk-inria-build") - +set(CPACK_RPM_PACKAGE_REQUIRES "qt5-qtsvg-devel, mesa-libGLU-devel") set(CPACK_RPM_PACKAGE_PROVIDES "${CPACK_PACKAGE_NAME} = ${CPACK_PACKAGE_VERSION}") set(CPACK_RPM_PACKAGE_LICENSE BSD) -set (CPACK_RPM_PACKAGE_ARCHITECTURE ${ARCH}) - +set(CPACK_RPM_PACKAGE_ARCHITECTURE ${ARCH}) set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_BINARY_DIR}/packaging/linux/postinst) set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_BINARY_DIR}/packaging/linux/prerm) diff --git a/packaging/linux/medInria.desktop.in b/packaging/linux/medInria.desktop.in index 125dfde2ec..67ff9691f6 100644 --- a/packaging/linux/medInria.desktop.in +++ b/packaging/linux/medInria.desktop.in @@ -1,11 +1,8 @@ [Desktop Entry] +Version=@CPACK_PACKAGE_VERSION@ Type=Application -Name=medInria -GenericName=Medical Imaging Platform -Comment=Process and Visualize Medical Images -Icon=@CPACK_PACKAGING_INSTALL_PREFIX@/share/icons/medInria.png -Exec=medInria %U Terminal=false -Categories=Graphics;Science;MedicalSoftware;Qt;Viewer; -MimeType=dcm;img;mha;nii;nii.gz;vtk;fib;roi; -Version=@CPACK_PACKAGE_VERSION@ +Exec=@CPACK_PACKAGING_INSTALL_PREFIX@/bin/medInria_launcher.sh +Name=@CPACK_PACKAGE_NAME@ +Comment=@CPACK_PACKAGE_DESCRIPTION_SUMMARY@ +Icon=@CPACK_PACKAGING_INSTALL_PREFIX@/medInria.png diff --git a/packaging/linux/postinst.in b/packaging/linux/postinst.in old mode 100644 new mode 100755 index 386f78e8ab..13ff5dcbe2 --- a/packaging/linux/postinst.in +++ b/packaging/linux/postinst.in @@ -1,23 +1,7 @@ #!/bin/sh set -e -# Remove unwanted files. -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/cmake -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/include -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/share/qtdcm -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/plugins/designer -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/*.cmake -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/vtk-8.0/testing -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/vtk-8.0/doxygen -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/vtk-8.0/doc -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/vtk-8.0/CMake -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/vtk-8.0/*.cmake -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/lib/InsightToolkit/*.cmake -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/bin/vtk* -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/bin/ttk* -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/bin/itk* -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/bin/dtk* - -# Create Symbolic link -ln -s @CPACK_PACKAGING_INSTALL_PREFIX@/share/applications/medInria.desktop /usr/share/applications/medInria.desktop +ln -s @CPACK_PACKAGING_INSTALL_PREFIX@/medInria.desktop /usr/share/applications/medInria.desktop +chmod +x /usr/share/applications/medInria.desktop ln -s @CPACK_PACKAGING_INSTALL_PREFIX@/bin/medInria_launcher.sh /usr/bin/medInria +echo "The application is installed and set up." diff --git a/packaging/linux/prerm.in b/packaging/linux/prerm.in old mode 100644 new mode 100755 index dba1921d15..35b9af5ede --- a/packaging/linux/prerm.in +++ b/packaging/linux/prerm.in @@ -1,5 +1,6 @@ #!/bin/sh set -e -[ -h /usr/share/applications/medInria.desktop ] && rm -f /usr/share/applications/medInria.desktop -[ -h /usr/bin/medInria ] && rm -f /usr/bin/medInria +echo "Cleaning of the installation..." +rm -f /usr/share/applications/medInria.desktop +rm -f /usr/bin/medInria diff --git a/packaging/unix/Launchers.cmake b/packaging/unix/Launchers.cmake index c70684778e..f796b901cb 100644 --- a/packaging/unix/Launchers.cmake +++ b/packaging/unix/Launchers.cmake @@ -16,46 +16,24 @@ set(CURRENT_BIN_DIR ${CMAKE_BINARY_DIR}/packaging/unix) # Install a launcher scripts for the application with right environment variable -# For developpers. - -foreach (dir ${PRIVATE_PLUGINS_DIRS}) - set(DEV_PLUGINS_DIRS "${DEV_PLUGINS_DIRS}:${dir}/bin/plugins") -endforeach() - -foreach (dir ${PRIVATE_PLUGINS_LEGACY_DIRS}) - set(DEV_PLUGINS_LEGACY_DIRS "${DEV_PLUGINS_LEGACY_DIRS}:${dir}/bin/plugins_legacy") -endforeach() - -ExternalProject_Get_Property(medInria binary_dir) - -set(LOCATE "") -set(MEDINRIA_DIR ${CMAKE_BINARY_DIR}) - -if (APPLE) - set(MEDINRIA_BIN ${binary_dir}/bin/medInria.app/Contents/MacOS/medInria) -else() - set(MEDINRIA_BIN ${binary_dir}/bin/medInria) -endif() - -set(MEDINRIA_PLUGINS_DIRS "${binary_dir}/bin/plugins:${DEV_PLUGINS_DIRS}") -set(MEDINRIA_PLUGINS_LEGACY_DIRS "${binary_dir}/bin/plugins_legacy:${DEV_PLUGINS_LEGACY_DIRS}") - -configure_file(${CURRENT_SRC_DIR}/medInria.sh.in medInria.sh @ONLY) - -# For end users. - +## For developpers -> not needed on linux at least, use ./medInria-build/bin/medInria +# ExternalProject_Get_Property(medInria binary_dir) +# set(LOCATE "") +# set(MEDINRIA_DIR ${CMAKE_BINARY_DIR}) +# if (APPLE) +# set(MEDINRIA_BIN ${binary_dir}/bin/medInria.app/Contents/MacOS/medInria) +# else() +# set(MEDINRIA_BIN ${binary_dir}/bin/medInria) +# endif() +# configure_file(${CURRENT_SRC_DIR}/medInria.sh.in medInria.sh @ONLY) # for superbuild + +## For end users file(READ "${CURRENT_SRC_DIR}/locate_bin.sh" LOCATE) set(MEDINRIA_DIR "$(locate)") - if (APPLE) set(MEDINRIA_BIN "\${MEDINRIA_DIR}/bin/medInria.app/Contents/MacOS/medInria") else() set(MEDINRIA_BIN "\${MEDINRIA_DIR}/bin/medInria") endif() - -set(MEDINRIA_PLUGINS_DIRS "\${MEDINRIA_DIR}/plugins:\${MEDINRIA_DIR}/bin/plugins:\${MEDINRIA_USER_PLUGINS_DIRS}") -set(MEDINRIA_PLUGINS_LEGACY_DIRS "\${MEDINRIA_DIR}/bin/plugins_legacy:\${MEDINRIA_USER_PLUGINS_DIRS_LEGACY}") - -configure_file(${CURRENT_SRC_DIR}/medInria.sh.in ${CURRENT_BIN_DIR}/medInria_launcher.sh @ONLY) -install(PROGRAMS ${CURRENT_BIN_DIR}/medInria_launcher.sh - DESTINATION bin) +configure_file(${CURRENT_SRC_DIR}/medInria.sh.in ${CURRENT_BIN_DIR}/medInria_launcher.sh @ONLY) # for package +install(PROGRAMS ${CURRENT_BIN_DIR}/medInria_launcher.sh DESTINATION bin) diff --git a/packaging/unix/medInria.sh.in b/packaging/unix/medInria.sh.in index 7d58a4747d..1968d16f4b 100755 --- a/packaging/unix/medInria.sh.in +++ b/packaging/unix/medInria.sh.in @@ -1,38 +1,9 @@ #!/bin/bash -usage() { - local ret="$1" - echo "Usage: $0 [--prefix prefix_command] [--debug] [--help] parameters" - exit ${ret} -} - +# Set the library path @LOCATE@ - -if [ "$1" == "--help" ]; then - usage 0 -fi - -med_prefix="" -if [ "$1" == "--prefix" ]; then - shift - med_prefix="$1" - shift -fi - -if [ "$1" == "--debug" ]; then - med_prefix="gdb --args" -fi - -# Locate the directory containing this script. - MEDINRIA_DIR="@MEDINRIA_DIR@" -MEDINRIA_BIN="@MEDINRIA_BIN@" - -# Set the plugins and library paths. -export MEDINRIA_PLUGINS_DIR="@MEDINRIA_PLUGINS_DIRS@" -export MEDINRIA_PLUGINS_DIR_LEGACY="@MEDINRIA_PLUGINS_LEGACY_DIRS@" -export LD_LIBRARY_PATH=${MEDINRIA_DIR}/lib:${MEDINRIA_DIR}/lib64:${MEDINRIA_DIR}/plugins_legacy:$LD_LIBRARY_PATH - -# Call medInria +export LD_LIBRARY_PATH=${MEDINRIA_DIR}/lib:${MEDINRIA_DIR}/lib64:$LD_LIBRARY_PATH -exec ${med_prefix} "${MEDINRIA_BIN}" $* +# Call medInria +exec "@MEDINRIA_BIN@" $* From 4738d1d4bedbbb044b193add041ce554ff4dd5e2 Mon Sep 17 00:00:00 2001 From: Mathilde Merle Date: Fri, 17 Mar 2023 14:24:36 +0100 Subject: [PATCH 2/4] {Packaging deb/rpm} script for macOS & clean private-plugins var --- packaging/apple/ApplePackScript.cmake.in | 2 +- packaging/linux/LinuxPackaging.cmake | 8 ------- packaging/unix/Launchers.cmake | 27 +++++++++++++----------- packaging/unix/medInria.sh.in | 4 ++++ packaging/windows/WindowsLaunchers.cmake | 8 ------- packaging/windows/WindowsPackaging.cmake | 23 -------------------- superbuild/CMakeLists.txt | 3 --- 7 files changed, 20 insertions(+), 55 deletions(-) diff --git a/packaging/apple/ApplePackScript.cmake.in b/packaging/apple/ApplePackScript.cmake.in index 34c8d47d74..95a6441f73 100644 --- a/packaging/apple/ApplePackScript.cmake.in +++ b/packaging/apple/ApplePackScript.cmake.in @@ -1,2 +1,2 @@ execute_process(COMMAND rm -f @PROJECT_BINARY_DIR@/medInria-@@PROJECT_NAME@_VERSION@.dmg) -execute_process(COMMAND @PROJECT_BINARY_DIR@/packaging/apple/mac_packager.sh @medInria_BINARY_DIR@/bin/plugins @medInria_BINARY_DIR@/bin/plugins_legacy @PRIVATE_PLUGINS_DIRS@ @PRIVATE_PLUGINS_LEGACY_DIRS@) +execute_process(COMMAND @PROJECT_BINARY_DIR@/packaging/apple/mac_packager.sh @medInria_BINARY_DIR@/bin/plugins @medInria_BINARY_DIR@/bin/plugins_legacy) diff --git a/packaging/linux/LinuxPackaging.cmake b/packaging/linux/LinuxPackaging.cmake index 254d3476d8..5c2f3d7ad4 100644 --- a/packaging/linux/LinuxPackaging.cmake +++ b/packaging/linux/LinuxPackaging.cmake @@ -76,14 +76,6 @@ foreach(external_project ${external_projects}) endif() endforeach() -foreach(dir ${PRIVATE_PLUGINS_DIRS}) - set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${dir} ${dir} ALL "/bin") -endforeach() - -foreach(dir ${PRIVATE_PLUGINS_LEGACY_DIRS}) - set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${dir} ${dir} ALL "/bin") -endforeach() - # force the medinria-superproject install target to run last so we can use it # to cleanup set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${backup_CPACK_INSTALL_CMAKE_PROJECTS}) diff --git a/packaging/unix/Launchers.cmake b/packaging/unix/Launchers.cmake index f796b901cb..001bec119a 100644 --- a/packaging/unix/Launchers.cmake +++ b/packaging/unix/Launchers.cmake @@ -16,18 +16,21 @@ set(CURRENT_BIN_DIR ${CMAKE_BINARY_DIR}/packaging/unix) # Install a launcher scripts for the application with right environment variable -## For developpers -> not needed on linux at least, use ./medInria-build/bin/medInria -# ExternalProject_Get_Property(medInria binary_dir) -# set(LOCATE "") -# set(MEDINRIA_DIR ${CMAKE_BINARY_DIR}) -# if (APPLE) -# set(MEDINRIA_BIN ${binary_dir}/bin/medInria.app/Contents/MacOS/medInria) -# else() -# set(MEDINRIA_BIN ${binary_dir}/bin/medInria) -# endif() -# configure_file(${CURRENT_SRC_DIR}/medInria.sh.in medInria.sh @ONLY) # for superbuild +## For developpers +# Needed on macOS to find plugins. On linux you can also directly use ./medInria-build/bin/medInria +ExternalProject_Get_Property(medInria binary_dir) +set(LOCATE "") +set(MEDINRIA_DIR ${CMAKE_BINARY_DIR}) +if (APPLE) + set(MEDINRIA_BIN ${binary_dir}/bin/medInria.app/Contents/MacOS/medInria) +else() + set(MEDINRIA_BIN ${binary_dir}/bin/medInria) +endif() +set(MEDINRIA_PLUGINS_DIRS "${binary_dir}/bin/plugins") +set(MEDINRIA_PLUGINS_LEGACY_DIRS "${binary_dir}/bin/plugins_legacy") +configure_file(${CURRENT_SRC_DIR}/medInria.sh.in medInria.sh @ONLY) -## For end users +## For end users / packaging file(READ "${CURRENT_SRC_DIR}/locate_bin.sh" LOCATE) set(MEDINRIA_DIR "$(locate)") if (APPLE) @@ -35,5 +38,5 @@ if (APPLE) else() set(MEDINRIA_BIN "\${MEDINRIA_DIR}/bin/medInria") endif() -configure_file(${CURRENT_SRC_DIR}/medInria.sh.in ${CURRENT_BIN_DIR}/medInria_launcher.sh @ONLY) # for package +configure_file(${CURRENT_SRC_DIR}/medInria.sh.in ${CURRENT_BIN_DIR}/medInria_launcher.sh @ONLY) install(PROGRAMS ${CURRENT_BIN_DIR}/medInria_launcher.sh DESTINATION bin) diff --git a/packaging/unix/medInria.sh.in b/packaging/unix/medInria.sh.in index 1968d16f4b..74818e7094 100755 --- a/packaging/unix/medInria.sh.in +++ b/packaging/unix/medInria.sh.in @@ -5,5 +5,9 @@ MEDINRIA_DIR="@MEDINRIA_DIR@" export LD_LIBRARY_PATH=${MEDINRIA_DIR}/lib:${MEDINRIA_DIR}/lib64:$LD_LIBRARY_PATH +# Needed for macOS to find plugins +export MEDINRIA_PLUGINS_DIR="@MEDINRIA_PLUGINS_DIRS@" +export MEDINRIA_PLUGINS_DIR_LEGACY="@MEDINRIA_PLUGINS_LEGACY_DIRS@" + # Call medInria exec "@MEDINRIA_BIN@" $* diff --git a/packaging/windows/WindowsLaunchers.cmake b/packaging/windows/WindowsLaunchers.cmake index 6c960a5c9e..b205284c18 100644 --- a/packaging/windows/WindowsLaunchers.cmake +++ b/packaging/windows/WindowsLaunchers.cmake @@ -13,14 +13,6 @@ set(CURRENT_SRC_DIR ${CMAKE_SOURCE_DIR}/packaging/windows) -foreach (dir ${PRIVATE_PLUGINS_DIRS}) - set(DEV_PLUGINS_DIRS "${DEV_PLUGINS_DIRS}:${dir}/plugins/%1") -endforeach() - -foreach (dir ${PRIVATE_PLUGINS_LEGACY_DIRS}) - set(DEV_PLUGINS_LEGACY_DIRS "${DEV_PLUGINS_LEGACY_DIRS}:${dir}/plugins_legacy/%1") -endforeach() - set(WIN_TYPE x86) if (CMAKE_GENERATOR MATCHES "Win64") set(WIN_TYPE x64) diff --git a/packaging/windows/WindowsPackaging.cmake b/packaging/windows/WindowsPackaging.cmake index 04d881fec7..e7768e65be 100644 --- a/packaging/windows/WindowsPackaging.cmake +++ b/packaging/windows/WindowsPackaging.cmake @@ -65,27 +65,6 @@ set(CPACK_NSIS_DELETE_ICONS_EXTRA " Delete '\$SMPROGRAMS\\\\$MUI_TEMP\\\\*.*' ") -if (NOT PRIVATE_PLUGINS_DIRS STREQUAL "") - foreach(pluginpath ${PRIVATE_PLUGINS_DIRS}) - file(TO_CMAKE_PATH ${pluginpath} pluginpath) -# Add an extra slash, otherwise we copy the folder, not its content - set(pluginpath "${pluginpath}/") - message("Adding ${pluginpath} to the plugins dirs...") - install(DIRECTORY ${pluginpath} DESTINATION bin/plugins COMPONENT Runtime FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}") - endforeach() -endif() - -if (NOT PRIVATE_PLUGINS_LEGACY_DIRS STREQUAL "") - foreach(pluginpath ${PRIVATE_PLUGINS_LEGACY_DIRS}) - file(TO_CMAKE_PATH ${pluginpath} pluginpath) -# Add an extra slash, otherwise we copy the folder, not its content - set(pluginpath "${pluginpath}/") - message("Adding ${pluginpath} to the dirs...") - install(DIRECTORY ${pluginpath} DESTINATION bin/plugins_legacy COMPONENT Runtime FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}") - endforeach() -endif() - - if (NOT EXTERNAL_PROJECT_PLUGINS_LEGACY_DIRS STREQUAL "") foreach(pluginpath ${EXTERNAL_PROJECT_PLUGINS_LEGACY_DIRS}) file(TO_CMAKE_PATH ${pluginpath} pluginpath) @@ -96,8 +75,6 @@ if (NOT EXTERNAL_PROJECT_PLUGINS_LEGACY_DIRS STREQUAL "") endforeach() endif() - - set(APP "\${CMAKE_INSTALL_PREFIX}/bin/medInria.exe") set(QT_BINARY_DIR "${Qt5_DIR}/../../../bin") set(QT_PLUGINS_DIR "${Qt5_DIR}/../../../plugins") diff --git a/superbuild/CMakeLists.txt b/superbuild/CMakeLists.txt index 64c2321ab1..a76fb33c68 100644 --- a/superbuild/CMakeLists.txt +++ b/superbuild/CMakeLists.txt @@ -143,9 +143,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ) -set(PRIVATE_PLUGINS_DIRS "" CACHE PATH "Folders containing private plugins, separated by ';'") -set(PRIVATE_PLUGINS_LEGACY_DIRS "" CACHE PATH "Folders containing legacy private plugins, separated by ';'") - ## ############################################################################# ## Add Targets ## ############################################################################# From ff83d044b0ee16b05fd9d00c18a3c19f5c00638a Mon Sep 17 00:00:00 2001 From: = Date: Fri, 7 Apr 2023 13:27:29 +0200 Subject: [PATCH 3/4] [ITKeigen] packaging management for eigen --- packaging/linux/LinuxPackaging.cmake | 12 ++++++------ superbuild/projects_modules/ITK.cmake | 9 +++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packaging/linux/LinuxPackaging.cmake b/packaging/linux/LinuxPackaging.cmake index 5c2f3d7ad4..48d0125ed4 100644 --- a/packaging/linux/LinuxPackaging.cmake +++ b/packaging/linux/LinuxPackaging.cmake @@ -69,13 +69,13 @@ set(backup_CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${CMAKE_ #clear it set(CPACK_INSTALL_CMAKE_PROJECTS "") -foreach(external_project ${external_projects}) - if(NOT USE_SYSTEM_${external_project} AND BUILD_SHARED_LIBS_${external_project}) - ExternalProject_Get_Property(${external_project} binary_dir) - set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${binary_dir} ${external_project} ALL "/") - endif() +foreach(external_project ${external_projects}) + if(NOT USE_SYSTEM_${external_project} AND BUILD_SHARED_LIBS_${external_project}) + ExternalProject_Get_Property(${external_project} binary_dir) + set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${binary_dir} ${external_project} ALL "/") + endif() endforeach() # force the medinria-superproject install target to run last so we can use it # to cleanup -set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${backup_CPACK_INSTALL_CMAKE_PROJECTS}) +set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${backup_CPACK_INSTALL_CMAKE_PROJECTS}) \ No newline at end of file diff --git a/superbuild/projects_modules/ITK.cmake b/superbuild/projects_modules/ITK.cmake index bf0d42857e..c8650b307c 100644 --- a/superbuild/projects_modules/ITK.cmake +++ b/superbuild/projects_modules/ITK.cmake @@ -51,6 +51,8 @@ if (UNIX) set(${ep}_cxx_flags "${${ep}_cxx_flags} -w -fpermissive") endif() +set(CPACK_PACKAGING_INSTALL_PREFIX /opt/medInria) + set(cmake_args ${ep_common_cache_args} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE_ExtProjs} @@ -58,7 +60,6 @@ set(cmake_args -DCMAKE_CXX_FLAGS=${${ep}_cxx_flags} -DCMAKE_MACOSX_RPATH:BOOL=OFF -DCMAKE_SHARED_LINKER_FLAGS=${${ep}_shared_linker_flags} - -DCMAKE_INSTALL_PREFIX= -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS_${ep}} -DBUILD_EXAMPLES:BOOL=OFF -DBUILD_TESTING:BOOL=OFF @@ -66,8 +67,12 @@ set(cmake_args -DModule_ITKReview:BOOL=ON -DModule_ITKVtkGlue:BOOL=ON -DITK_LEGACY_REMOVE:BOOL=ON + # ThirdParty packaging + -DCMAKE_PREFIX_PATH=${EP_PATH_BUILD}/${ep} + -DCMAKE_INSTALL_PREFIX=${CPACK_PACKAGING_INSTALL_PREFIX} + -DITK_INSTALL_PACKAGE_DIR=${CPACK_PACKAGING_INSTALL_PREFIX} ) - + set(cmake_cache_args -DVTK_DIR:PATH=${VTK_DIR} ) From 3c6258f0638529a1cc3d3d0c70cae27c8c77c5d3 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 11 Apr 2023 16:43:48 +0200 Subject: [PATCH 4/4] [Packaging] newline --- packaging/linux/LinuxPackaging.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/linux/LinuxPackaging.cmake b/packaging/linux/LinuxPackaging.cmake index 48d0125ed4..03e108b025 100644 --- a/packaging/linux/LinuxPackaging.cmake +++ b/packaging/linux/LinuxPackaging.cmake @@ -78,4 +78,4 @@ endforeach() # force the medinria-superproject install target to run last so we can use it # to cleanup -set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${backup_CPACK_INSTALL_CMAKE_PROJECTS}) \ No newline at end of file +set(CPACK_INSTALL_CMAKE_PROJECTS ${CPACK_INSTALL_CMAKE_PROJECTS} ${backup_CPACK_INSTALL_CMAKE_PROJECTS})