BICCN/cell-locator

Release Installer size is larger than expected

jcfr opened this issue · 2 comments

jcfr commented

Description

The size of the installer (843MB vs 215MB) is partially explained by the fact the MNI atlas is now shipped with the application. We noticed that the install rules were installing the complete download folders instead of selectively installing the relevant MNI files.

See https://github.com/BICCN/cell-locator/releases

Screenshots

image

image

jcfr commented

the install rules for the data files are implemented here:

function(CellLocator_install_datafiles datafile)
install(
FILES ${datafile} ${ARGN}
DESTINATION "${Slicer_INSTALL_QTSCRIPTEDMODULES_LIB_DIR}/"
COMPONENT RuntimeLibraries
)
endfunction()

That said the problem is related to the install rule of the scripted modules.

Indeed, the content of the D:\D\P\CL-0-build\Slicer-build\E\Modules\Scripted\Home\cmake_install.cmake file generated is the following. Despite of selectively listing the data files, the parent folder is systematically copied.

[...]

if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xRuntimeLibrariesx" OR NOT CMAKE_INSTALL_COMPONENT)
  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/./lib/CellLocator-4.13/qt-scripted-modules" TYPE DIRECTORY FILES "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/" USE_SOURCE_PERMISSIONS)
endif()

if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xRuntimeLibrariesx" OR NOT CMAKE_INSTALL_COMPONENT)
  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/./lib/CellLocator-4.13/qt-scripted-modules" TYPE FILE FILES
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/ccf_average_template_25.nrrd"
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/ccf_annotation_25_contiguous.nrrd"
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/ccf_annotation_color_table.txt"
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/ccf_annotation_color_allen2slicer_mapping.json"
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/ccf_annotation_color_slicer2allen_mapping.json"
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/ccf-ontology-formatted.json"
    )
endif()

if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xRuntimeLibrariesx" OR NOT CMAKE_INSTALL_COMPONENT)
  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/./lib/CellLocator-4.13/qt-scripted-modules" TYPE FILE FILES
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/mni_icbm152_t1_tal_nlin_sym_09b_hires.nii"
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/mni_annotation_contiguous.nrrd"
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/mni_annotation_color_table.txt"
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/mni_annotation_color_allen2slicer_mapping.json"
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/mni_annotation_color_slicer2allen_mapping.json"
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/mni-ontology-formatted.json"
    )
endif()

if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xRuntimeLibrariesx" OR NOT CMAKE_INSTALL_COMPONENT)
  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/./lib/CellLocator-4.13/qt-scripted-modules" TYPE FILE FILES
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/ccf_annotation_layer_color_table.txt"
    "D:/D/P/CL-0-build/Slicer-build/lib/CellLocator-4.13/qt-scripted-modules/CellLocatorData/ccf-layer-ontology-formatted.json"
    )
endif()
jcfr commented

The macro responsible for installing the module is slicerMacroBuildScriptedModule:

slicerMacroBuildScriptedModule(
NAME ${MODULE_NAME}
SCRIPTS ${MODULE_PYTHON_SCRIPTS} ${MODULE_PYTHON_QRC_RESOURCES}
RESOURCES ${MODULE_PYTHON_RESOURCES}
WITH_GENERIC_TESTS
)

and looking at the implementation, we can observe that the directory is always installed:

https://github.com/KitwareMedical/Slicer/blob/7fde09a0168d0b2e6f2a12ad01a18ac2889da7a1/CMake/SlicerMacroBuildScriptedModule.cmake#L105-L106

Fixing ctkMacroCompilePythonScript used in slicerMacroBuildScriptedModule to explicitly install each files would be ideal.

But since this may be a more involved change, we could look into few approaches:

  • Check why the sub directory are installed ... this is seems to be a "bug" because we do not pass the WITH_SUBDIR to slicerMacroBuildScriptedModule

  • Update slicerMacroBuildScriptedModule to add a NO_INSTALL to fully skip the install of script and instead explicitly install relevant scripts.

References: