{python3packages.py,}meshlab: 2023.12 -> 2025.07 + use system dependencies , and update dependencies (#445078)

This commit is contained in:
Jo
2025-10-28 21:22:17 +00:00
committed by GitHub
17 changed files with 609 additions and 321 deletions
@@ -1,106 +1,103 @@
{
stdenv,
lib,
stdenv,
fetchFromGitHub,
libGLU,
qtbase,
qtscript,
qtxmlpatterns,
lib3ds,
bzip2,
muparser,
eigen,
glew,
gmp,
levmar,
qhull,
fetchpatch,
# nativeBuildInputs
cmake,
cgal,
boost,
mpfr,
xercesc,
onetbb,
embree,
vcg,
libigl,
corto,
openctm,
structuresynth,
wrapQtAppsHook,
python3Packages,
# propagatedBuildInputs
meshlab,
# buildInputs
libsForQt5,
llvmPackages,
glew,
vcg,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "pymeshlab";
version = "2023.12";
version = "2025.7";
src = fetchFromGitHub {
owner = "cnr-isti-vclab";
repo = "pymeshlab";
rev = "v${finalAttrs.version}";
hash = "sha256-IOlRdXoUPOJt67g3HqsLchV5aL+JUEks2y1Sy+wpwsg=";
fetchSubmodules = true;
tag = "v${finalAttrs.version}";
hash = "sha256-LCR2/AyX9uVX4xhZareUL6YlpUsCFiGDMBB5nFp+H6k=";
};
buildInputs = [
libGLU
qtbase
qtscript
qtxmlpatterns
lib3ds
bzip2
muparser
eigen
glew
gmp
levmar
qhull
cgal
boost
mpfr
xercesc
onetbb
embree
vcg
libigl
corto
structuresynth
openctm
patches = [
# CMake: allow use of system-provided meshlab & pybind11
# ref. https://github.com/cnr-isti-vclab/PyMeshLab/pull/445
# merged upstream
(fetchpatch {
url = "https://github.com/cnr-isti-vclab/PyMeshLab/commit/b363caae4362746b3f9e9326fe7b72a2ec7824d9.patch";
hash = "sha256-euKfOx/T0qdeMx79dpEalzmdWsr4nbDFJfKdksvULBw=";
})
];
nativeBuildInputs = [
cmake
wrapQtAppsHook
python3Packages.pybind11
];
nativeCheckInputs = [
python3Packages.pythonImportsCheckHook
];
propagatedBuildInputs = [
meshlab
python3Packages.numpy
];
preConfigure = ''
substituteInPlace src/meshlab/src/external/libigl.cmake \
--replace-fail '$'{MESHLAB_EXTERNAL_DOWNLOAD_DIR}/libigl-2.4.0 ${libigl}
substituteInPlace src/meshlab/src/external/nexus.cmake \
--replace-fail '$'{NEXUS_DIR}/src/corto ${corto.src}
substituteInPlace src/meshlab/src/external/levmar.cmake \
--replace-fail '$'{LEVMAR_LINK} ${levmar.src} \
--replace-warn "MD5 ''${LEVMAR_MD5}" ""
substituteInPlace src/meshlab/src/external/ssynth.cmake \
--replace-fail '$'{SSYNTH_LINK} ${structuresynth.src} \
--replace-warn "MD5 ''${SSYNTH_MD5}" ""
'';
buildInputs = [
glew
libsForQt5.qtbase
vcg
]
++ lib.optionals stdenv.cc.isClang [
llvmPackages.openmp
];
dontWrapQtApps = true;
cmakeFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/${python3Packages.python.sitePackages}/pymeshlab"
"-DVCGDIR=${vcg.src}"
];
# Get io & filter plugins from meshlab, to avoild render, decorate & edit ones
postInstall =
let
plugins =
if stdenv.hostPlatform.isDarwin then
"Applications/meshlab.app/Contents/PlugIns"
else
"lib/meshlab/plugins";
pyPlugins = if stdenv.hostPlatform.isDarwin then "PlugIns" else "lib/plugins";
in
''
install -D -t $out/${python3Packages.python.sitePackages}/pymeshlab/${pyPlugins} \
${meshlab}/${plugins}/libio_* \
${meshlab}/${plugins}/libfilter_*
'';
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf \
--add-needed ${meshlab}/lib/meshlab/libmeshlab-common.so \
$out/${python3Packages.python.sitePackages}/pymeshlab/pmeshlab.*.so
'';
pythonImportsCheck = [ "pymeshlab" ];
meta = {
description = "Open source mesh processing python library";
homepage = "https://github.com/cnr-isti-vclab/PyMeshLab";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ nim65s ];
platforms = with lib.platforms; linux;
platforms = with lib.platforms; linux ++ darwin;
};
})
+24 -8
View File
@@ -2,26 +2,42 @@
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
cmake,
nix-update-script,
}:
stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
pname = "corto";
version = "0-unstable-2024-04-05";
version = "2025.07";
src = fetchFromGitHub {
owner = "cnr-isti-vclab";
repo = "corto";
rev = "d880519c490c88a39d12c31a914b6a687a7019c3";
hash = "sha256-0OUijrf+0ZNv3oYko2r8Kp9zgtg8b9RPL7DXHf15Ryc=";
tag = "v${finalAttrs.version}";
hash = "sha256-wfIZQdypBTfUZJgPE4DetSt1SUNSyZihmL1Uzapqh1o=";
};
patches = [
# CMake: exports
# ref. https://github.com/cnr-isti-vclab/corto/pull/47
# merged upstream
(fetchpatch {
name = "cmake-exports.patch";
url = "https://github.com/cnr-isti-vclab/corto/commit/169356e97b29587b278822118aef34ed742b6b37.patch";
hash = "sha256-imJfQ8JEhCcSkkO35N7Z3NtGElCyVxENPMDMWfNqdW0=";
})
];
nativeBuildInputs = [ cmake ];
meta = with lib; {
updateScript = nix-update-script { };
meta = {
description = "Mesh compression library, designed for rendering and speed";
homepage = "https://github.com/cnr-isti-vclab/corto";
license = licenses.mit;
maintainers = with maintainers; [ nim65s ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ nim65s ];
mainProgram = "corto";
};
}
})
+2 -2
View File
@@ -26,7 +26,7 @@ stdenv.mkDerivation (finalAttrs: {
installPhase = ''
mkdir -p $out/include $out/lib
cp lm.h $out/include
cp levmar.h lm.h $out/include
cp liblevmar.a $out/lib
'';
@@ -34,7 +34,7 @@ stdenv.mkDerivation (finalAttrs: {
description = "ANSI C implementations of Levenberg-Marquardt, usable also from C++";
homepage = "https://www.ics.forth.gr/~lourakis/levmar/";
license = lib.licenses.gpl2Plus;
maintainers = [ ];
maintainers = [ lib.maintainers.nim65s ];
platforms = lib.platforms.all;
};
})
+15 -5
View File
@@ -59,7 +59,7 @@ stdenv.mkDerivation (finalAttrs: {
];
cmakeFlags = [
"-DCMAKE_INSTALL_INCLUDEDIR=include/lib3mf"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include/lib3mf"
"-DUSE_INCLUDED_ZLIB=OFF"
"-DUSE_INCLUDED_LIBZIP=OFF"
"-DUSE_INCLUDED_GTEST=OFF"
@@ -95,9 +95,19 @@ stdenv.mkDerivation (finalAttrs: {
# functions are no longer in openssl, remove them from test cleanup function
substituteInPlace Tests/CPP_Bindings/Source/UnitTest_EncryptionUtils.cpp \
--replace-warn "RAND_cleanup();" "" \
--replace-warn "EVP_cleanup();" "" \
--replace-warn "CRYPTO_cleanup_all_ex_data();" ""
--replace-fail "RAND_cleanup();" "" \
--replace-fail "EVP_cleanup();" "" \
--replace-fail "CRYPTO_cleanup_all_ex_data();" ""
# Fix CMake export
# ref https://github.com/3MFConsortium/lib3mf/pull/434
substituteInPlace cmake/lib3mfConfig.cmake \
--replace-fail "$""{LIB3MF_ROOT_DIR}/include" "$""{LIB3MF_ROOT_DIR}/include/lib3mf" \
--replace-fail "$""{LIB3MF_ROOT_DIR}/lib" "$out/lib"
# Use absolute CMAKE_INSTALL_INCLUDEDIR
substituteInPlace lib3mf.pc.in \
--replace-fail "includedir=$""{prefix}/@CMAKE_INSTALL_INCLUDEDIR@" "includedir=@CMAKE_INSTALL_INCLUDEDIR@"
'';
doCheck = true;
@@ -109,7 +119,7 @@ stdenv.mkDerivation (finalAttrs: {
description = "Reference implementation of the 3D Manufacturing Format file standard";
homepage = "https://3mf.io/";
license = licenses.bsd2;
maintainers = [ ];
maintainers = with maintainers; [ nim65s ];
platforms = platforms.all;
};
})
+1
View File
@@ -20,6 +20,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
installPhase = ''
mkdir -p $out/include
cp -r include/igl $out/include
rm -rf $out/include/igl/opengl
'';
meta = with lib; {
@@ -1,14 +0,0 @@
[Desktop Entry]
Name=MeshLab
Version=@version@
Name[en_GB]=MeshLab
GenericName=Mesh processing
GenericName[en_GB]=Mesh processing
Comment=View and process meshes
Type=Application
Exec=@out@/bin/meshlab %U
TryExec=@out@/bin/meshlab
Icon=@out@/share/icons/hicolor/meshlab.png
Terminal=false
MimeType=model/mesh;application/x-3ds;image/x-3ds;model/x-ply;application/sla;model/x-quad-object;model/x-geomview-off;application/x-cyclone-ptx;application/x-vmi;application/x-bre;model/vnd.collada+xml;model/openctm;application/x-expe-binary;application/x-expe-ascii;application/x-xyz;application/x-gts;chemical/x-pdb;application/x-tri;application/x-asc;model/x3d+xml;model/x3d+vrml;model/vrml;model/u3d;model/idtf;
Categories=Graphics;3DGraphics;Viewer;Qt;
@@ -1,159 +0,0 @@
{
lib,
stdenv,
fetchFromGitHub,
llvmPackages,
libsForQt5,
libGLU,
lib3ds,
bzip2,
muparser,
eigen,
glew,
gmp,
levmar,
qhull,
cmake,
cgal,
boost,
mpfr,
xercesc,
onetbb,
embree,
libigl,
corto,
openctm,
structuresynth,
}:
let
tinygltf-src = fetchFromGitHub {
owner = "syoyo";
repo = "tinygltf";
tag = "v2.6.3";
hash = "sha256-IyezvHzgLRyc3z8HdNsQMqDEhP+Ytw0stFNak3C8lTo=";
};
# requires submodules to build
lib3mf-src = fetchFromGitHub {
owner = "3MFConsortium";
repo = "lib3mf";
tag = "v2.3.2";
fetchSubmodules = true;
hash = "sha256-pKjnN9H6/A2zPvzpFed65J+mnNwG/dkSE2/pW7IlN58=";
};
in
stdenv.mkDerivation {
pname = "meshlab-unstable";
version = "2023.12-unstable-2025-02-21";
src = fetchFromGitHub {
owner = "cnr-isti-vclab";
repo = "meshlab";
# note that this is in branch devel
rev = "72142583980b6dbfc5b85c6cca226a72f48497a9";
hash = "sha256-ev6b8sgJsjvD8KMBbC6kbrVvTxTxpqsXu/sK1Ih6+OA=";
# needed for an updated version of vcg in their submodule
fetchSubmodules = true;
};
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace src/meshlab/CMakeLists.txt \
--replace-fail "set_additional_settings_info_plist(" "# set_additional_settings_info_plist(" \
--replace-fail " TARGET meshlab" "# TARGET meshlab" \
--replace-fail " FILE \''${MESHLAB_BUILD_DISTRIB_DIR}/meshlab.app/Contents/Info.plist)" \
"# FILE \''${MESHLAB_BUILD_DISTRIB_DIR}/meshlab.app/Contents/Info.plist)"
'';
buildInputs = [
libGLU
libsForQt5.qtbase
libsForQt5.qtscript
libsForQt5.qtxmlpatterns
lib3ds
bzip2
muparser
eigen
glew
gmp
levmar
qhull
cgal
boost
mpfr
xercesc
onetbb
embree
libigl
corto
openctm
structuresynth
]
++ lib.optionals stdenv.cc.isClang [
llvmPackages.openmp
];
nativeBuildInputs = [
cmake
libsForQt5.wrapQtAppsHook
];
preConfigure = ''
mkdir src/external/downloads
cp -r --no-preserve=mode,ownership ${lib3mf-src} src/external/downloads/lib3mf-2.3.2
substituteAll ${./meshlab.desktop} resources/linux/meshlab.desktop
substituteInPlace src/external/tinygltf.cmake \
--replace-fail '$'{MESHLAB_EXTERNAL_DOWNLOAD_DIR}/tinygltf-2.6.3 ${tinygltf-src}
substituteInPlace src/external/libigl.cmake \
--replace-fail '$'{MESHLAB_EXTERNAL_DOWNLOAD_DIR}/libigl-'$'{LIBIGL_VER} ${libigl}
substituteInPlace src/external/nexus.cmake \
--replace-fail '$'{NEXUS_DIR}/src/corto ${corto.src}
substituteInPlace src/external/levmar.cmake \
--replace-fail '$'{LEVMAR_LINK} ${levmar.src} \
--replace-warn "MD5 ''${LEVMAR_MD5}" ""
substituteInPlace src/external/ssynth.cmake \
--replace-fail '$'{SSYNTH_LINK} ${structuresynth.src} \
--replace-warn "MD5 ''${SSYNTH_MD5}" ""
substituteInPlace src/common_gui/CMakeLists.txt \
--replace-warn "MESHLAB_LIB_INSTALL_DIR" "CMAKE_INSTALL_LIBDIR"
'';
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/{Applications,bin,lib}
mv $out/meshlab.app $out/Applications/
ln $out/Applications/meshlab.app/Contents/Frameworks/* $out/lib/
makeWrapper $out/{Applications/meshlab.app/Contents/MacOS,bin}/meshlab
'';
postFixup =
lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf --add-needed $out/lib/meshlab/libmeshlab-common.so $out/bin/.meshlab-wrapped
patchelf --add-needed $out/lib/meshlab/lib3mf.so $out/lib/meshlab/plugins/libio_3mf.so
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
wrapQtApp "$out/Applications/meshlab.app/Contents/MacOS/meshlab"
install_name_tool -change libopenctm.dylib "${lib.getOutput "out" openctm}/lib/libopenctm.dylib" \
"$out/Applications/meshlab.app/Contents/PlugIns/libio_ctm.so"
'';
# The hook will wrap all the plugin binaries, make they are not a
# valid plugin. So we have to wrap the main app manually.
# See: https://github.com/NixOS/nixpkgs/pull/396295#issuecomment-3137779781
dontWrapQtApps = stdenv.hostPlatform.isDarwin;
# display a black screen on wayland, so force XWayland for now.
# Might be fixed when upstream will be ready for Qt6.
qtWrapperArgs = lib.optionals stdenv.hostPlatform.isLinux [
"--set QT_QPA_PLATFORM xcb"
];
meta = {
description = "System for processing and editing 3D triangular meshes (unstable)";
mainProgram = "meshlab";
homepage = "https://www.meshlab.net/";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ pca006132 ];
platforms = with lib.platforms; linux ++ darwin;
};
}
@@ -0,0 +1,279 @@
From 1a617220a286c23ecac1ad7bd6aca0d2c68bd1f3 Mon Sep 17 00:00:00 2001
From: Guilhem Saurel <guilhem.saurel@laas.fr>
Date: Fri, 19 Sep 2025 08:43:18 +0200
Subject: [PATCH 1/6] CMake: allow system vcglib
---
src/CMakeLists.txt | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0398e8566..839a515be 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -75,7 +75,12 @@ endif()
### Enter subdirectories
# VCGLib -- required
-if (VCGDIR) # VCGDIR exists - using custom user vcglib path
+find_package(vcglib CONFIG)
+if(TARGET vcglib::vcglib)
+ message(STATUS "- VCGLib - using system provided library")
+ add_library(vcglib ALIAS vcglib::vcglib)
+ get_target_property(VCGDIR vcglib::vcglib INTERFACE_INCLUDE_DIRECTORIES)
+elseif (VCGDIR) # VCGDIR exists - using custom user vcglib path
if(EXISTS ${VCGDIR})
add_subdirectory(${VCGDIR} {CMAKE_CURRENT_BINARY_DIR}/vcglib)
message(STATUS "- VCGLib - using custom VCGDIR path library")
From 73debae9b9ca14554c25fa58480969bc7c3f61d1 Mon Sep 17 00:00:00 2001
From: Guilhem Saurel <guilhem.saurel@laas.fr>
Date: Tue, 16 Sep 2025 12:44:12 +0200
Subject: [PATCH 2/6] CMake: MESHLAB_ALLOW_SYSTEM_LEVMAR
---
src/external/levmar.cmake | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/external/levmar.cmake b/src/external/levmar.cmake
index cc639f09e..882b631db 100644
--- a/src/external/levmar.cmake
+++ b/src/external/levmar.cmake
@@ -3,8 +3,25 @@
# SPDX-License-Identifier: BSL-1.0
option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LEVMAR "Allow download and use of levmar source" ON)
+option(MESHLAB_ALLOW_SYSTEM_LEVMAR "Allow use of system-provided levmar" ON)
-if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LEVMAR)
+find_path(levmar_INCLUDE_DIR NAMES levmar.h PATHS ${levmar_PREFIX})
+find_library(levmar_LIBRARY NAMES levmar PATHS ${levmar_PREFIX})
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ levmar
+ DEFAULT_MSG
+ levmar_LIBRARY
+ levmar_INCLUDE_DIR
+)
+mark_as_advanced(levmar_INCLUDE_DIR levmar_LIBRARY)
+
+if(MESHLAB_ALLOW_SYSTEM_LEVMAR AND levmar_FOUND)
+ message(STATUS "- levmar - using system-provided library")
+ add_library(external-levmar INTERFACE)
+ target_link_libraries(external-levmar INTERFACE ${levmar_LIBRARY})
+ target_include_directories(external-levmar INTERFACE ${levmar_INCLUDE_DIR})
+elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LEVMAR)
set(LEVMAR_VERSION "2.6.1")
set(LEVMAR_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/levmar-${LEVMAR_VERSION}")
From 161d5dabad4cfdc3ec08d9e5dd2ee6c94b057c5c Mon Sep 17 00:00:00 2001
From: Guilhem Saurel <guilhem.saurel@laas.fr>
Date: Tue, 16 Sep 2025 15:15:11 +0200
Subject: [PATCH 3/6] CMake: MESHLAB_ALLOW_SYSTEM_LIB3MF
---
src/external/lib3mf.cmake | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/external/lib3mf.cmake b/src/external/lib3mf.cmake
index 1cd1b5dfa..f64a63aa5 100644
--- a/src/external/lib3mf.cmake
+++ b/src/external/lib3mf.cmake
@@ -22,8 +22,15 @@
#############################################################################
option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIB3MF "Allow download and use of lib3MF source" ON)
+option(MESHLAB_ALLOW_SYSTEM_LIB3MF "Allow use of system-provided lib3MF" ON)
-if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIB3MF)
+find_package(lib3mf)
+
+if(MESHLAB_ALLOW_SYSTEM_LIB3MF AND TARGET lib3mf::lib3mf)
+ message(STATUS "- Lib3MF - using system-provided library")
+ add_library(external-lib3mf INTERFACE)
+ target_link_libraries(external-lib3mf INTERFACE lib3mf::lib3mf)
+elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIB3MF)
set(LIB3MF_VERSION "2.4.1")
set(LIB3MF_DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/lib3mf-${LIB3MF_VERSION})
From c6662d486c1f8e5c9c89389abd630d8218b0fcb9 Mon Sep 17 00:00:00 2001
From: Guilhem Saurel <guilhem.saurel@laas.fr>
Date: Tue, 16 Sep 2025 15:42:59 +0200
Subject: [PATCH 4/6] CMake: MESHLAB_ALLOW_SYSTEM_LIBIGL
---
src/external/libigl.cmake | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/external/libigl.cmake b/src/external/libigl.cmake
index 3666f375d..8f84fea4f 100644
--- a/src/external/libigl.cmake
+++ b/src/external/libigl.cmake
@@ -3,10 +3,17 @@
# SPDX-License-Identifier: BSL-1.0
option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIBIGL "Allow download and use of LibIGL source" ON)
+option(MESHLAB_ALLOW_SYSTEM_LIBIGL "Allow use of system-provided LibIGL" ON)
set(LIBIGL_VER 2.4.0)
-if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIBIGL)
+find_path(libigl_INCLUDE_DIR NAMES igl_inline.h PATH_SUFFIXES igl PATHS ${libigl_PREFIX})
+
+if(MESHLAB_ALLOW_SYSTEM_LIBIGL AND libigl_INCLUDE_DIR)
+ message(STATUS "- LibIGL - using system-provided library")
+ add_library(external-libigl INTERFACE)
+ target_include_directories(external-libigl INTERFACE ${libigl_INCLUDE_DIR})
+elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIBIGL)
set(LIBIGL_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/libigl-${LIBIGL_VER}")
set(LIBIGL_CHECK "${LIBIGL_DIR}/include/igl/igl_inline.h")
From a26427e32af672d2554d662376f3f258c64941ca Mon Sep 17 00:00:00 2001
From: Guilhem Saurel <guilhem.saurel@laas.fr>
Date: Fri, 19 Sep 2025 08:58:16 +0200
Subject: [PATCH 5/6] CMake: MESHLAB_ALLOW_SYSTEM_NEXUS
---
src/external/nexus.cmake | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/external/nexus.cmake b/src/external/nexus.cmake
index 9fc92f714..1139d11e7 100644
--- a/src/external/nexus.cmake
+++ b/src/external/nexus.cmake
@@ -3,11 +3,18 @@
# SPDX-License-Identifier: BSL-1.0
option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_NEXUS "Allow download and use of nexus source" ON)
+option(MESHLAB_ALLOW_SYSTEM_NEXUS "Allow use of system-provided nexus and corto" ON)
set(CORTO_VER 2025.07)
set(NEXUS_VER 2025.05)
-if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_NEXUS)
+find_package(nexus CONFIG)
+
+if(MESHLAB_ALLOW_SYSTEM_NEXUS AND TARGET nexus::nexus)
+ message(STATUS "- nexus - using system-provided library")
+ add_library(external-nexus INTERFACE)
+ target_link_libraries(external-nexus INTERFACE nexus::nexus)
+elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_NEXUS)
set(NEXUS_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/nexus-${NEXUS_VER}")
set(NEXUS_CHECK "${NEXUS_DIR}/CMakeLists.txt")
set(CORTO_DIR "${NEXUS_DIR}/src/corto")
From 32be737316181bd84d8beac7cb6b74379965d2fe Mon Sep 17 00:00:00 2001
From: Guilhem Saurel <guilhem.saurel@laas.fr>
Date: Fri, 19 Sep 2025 11:26:36 +0200
Subject: [PATCH 6/6] CMake: install exports
---
src/CMakeLists.txt | 21 +++++++++++++++++++++
src/Config.cmake.in | 9 +++++++++
src/common/CMakeLists.txt | 18 ++++++++++++++----
src/meshlabplugins/io_base/CMakeLists.txt | 2 +-
4 files changed, 45 insertions(+), 5 deletions(-)
create mode 100644 src/Config.cmake.in
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 839a515be..c490ea960 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -229,6 +229,27 @@ endforeach()
set(COPIED_FILES)
if (NOT MESHLAB_BUILD_ONLY_LIBRARIES)
+ # headers
+ install(DIRECTORY common DESTINATION include FILES_MATCHING PATTERN "*.h")
+ # CMake exports
+ install(EXPORT meshlabTargets
+ DESTINATION lib/cmake/meshlab
+ NAMESPACE meshlab::
+ FILE meshlabTargets.cmake
+ )
+ include(CMakePackageConfigHelpers)
+ # generate the config file that includes the exports
+ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/meshlabConfig.cmake"
+ INSTALL_DESTINATION lib/cmake/vcglib
+ NO_SET_AND_CHECK_MACRO
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+ )
+ install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/meshlabConfig.cmake"
+ DESTINATION lib/cmake/meshlab
+ )
+
# shaders
set(SHADER_BASE_DIR "${MESHLAB_RESOURCES_DIR}/shaders")
file(
diff --git a/src/Config.cmake.in b/src/Config.cmake.in
new file mode 100644
index 000000000..63ba0ce97
--- /dev/null
+++ b/src/Config.cmake.in
@@ -0,0 +1,9 @@
+@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+find_dependency(GLEW)
+find_dependency(OpenGL)
+find_dependency(Qt5 COMPONENTS OpenGL Xml Network)
+find_dependency(vcglib)
+
+include ( "${CMAKE_CURRENT_LIST_DIR}/meshlabTargets.cmake" )
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 0e640fdd4..c74bd579b 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -198,7 +198,8 @@ endif()
target_include_directories(meshlab-common
PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}/..)
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
+ $<INSTALL_INTERFACE:include>)
target_link_libraries(
meshlab-common
@@ -208,10 +209,19 @@ target_link_libraries(
Qt5::Widgets
Qt5::Xml
Qt5::Network
- vcglib
- external-glew
+ PRIVATE
external-easyexif
)
+if(TARGET vcglib::vcglib)
+ target_link_libraries(meshlab-common PUBLIC vcglib::vcglib)
+else()
+ target_link_libraries(meshlab-common PUBLIC vcglib)
+endif()
+if(TARGET GLEW::GLEW)
+ target_link_libraries(meshlab-common PUBLIC GLEW::GLEW)
+else()
+ target_link_libraries(meshlab-common PUBLIC external-glew)
+endif()
set_property(TARGET meshlab-common PROPERTY FOLDER Core)
@@ -234,4 +244,4 @@ endif()
set_target_properties(meshlab-common PROPERTIES
INSTALL_RPATH "$ORIGIN")
-install(TARGETS meshlab-common DESTINATION ${MESHLAB_LIB_INSTALL_DIR})
+install(TARGETS meshlab-common EXPORT meshlabTargets DESTINATION ${MESHLAB_LIB_INSTALL_DIR})
diff --git a/src/meshlabplugins/io_base/CMakeLists.txt b/src/meshlabplugins/io_base/CMakeLists.txt
index 7a3137e63..64504d56d 100644
--- a/src/meshlabplugins/io_base/CMakeLists.txt
+++ b/src/meshlabplugins/io_base/CMakeLists.txt
@@ -27,4 +27,4 @@ set(SOURCES
add_meshlab_plugin(io_base ${SOURCES} ${HEADERS})
-target_link_libraries(io_base PRIVATE OpenGL::GLU)
+target_link_libraries(io_base PRIVATE OpenGL::GLU external-easyexif)
+12
View File
@@ -0,0 +1,12 @@
--- src/meshlab/CMakeLists.txt.orig 2025-10-05 23:04:12.786192073 +0200
+++ src/meshlab/CMakeLists.txt 2025-10-05 23:04:16.379256637 +0200
@@ -92,9 +92,6 @@
MACOSX_BUNDLE_COPYRIGHT "Copyright VCG-ISTI-CNR © 2005-2021. All rights reserved."
)
- set_additional_settings_info_plist(
- TARGET meshlab
- FILE ${MESHLAB_BUILD_DISTRIB_DIR}/meshlab.app/Contents/Info.plist)
endif()
install(
+31 -41
View File
@@ -6,6 +6,7 @@
libsForQt5,
libGLU,
lib3ds,
lib3mf,
bzip2,
muparser,
eigen,
@@ -25,16 +26,10 @@
corto,
openctm,
structuresynth,
vclab-nexus,
}:
let
tinygltf-src = fetchFromGitHub {
owner = "syoyo";
repo = "tinygltf";
tag = "v2.6.3";
hash = "sha256-IyezvHzgLRyc3z8HdNsQMqDEhP+Ytw0stFNak3C8lTo=";
};
downloads = [
"DLL_EMBREE"
"SOURCE_BOOST"
@@ -57,19 +52,18 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "meshlab";
version = "2023.12";
version = "2025.07";
src = fetchFromGitHub {
owner = "cnr-isti-vclab";
repo = "meshlab";
tag = "MeshLab-${finalAttrs.version}";
hash = "sha256-AdUAWS741RQclYaSE3Tz1/I0YSinNAnfSaqef+Tib8Y=";
hash = "sha256-6BozYzPCbBZ+btL4FCdzKlwKqTsvFWDfOXizzJSYo9s=";
};
nativeBuildInputs = [
cmake
libsForQt5.wrapQtAppsHook
vcg # templated library
];
buildInputs = [
@@ -78,6 +72,7 @@ stdenv.mkDerivation (finalAttrs: {
libsForQt5.qtscript
libsForQt5.qtxmlpatterns
lib3ds
lib3mf
bzip2
muparser
eigen
@@ -91,52 +86,41 @@ stdenv.mkDerivation (finalAttrs: {
xercesc
onetbb
embree
vcg
libigl
corto
openctm
structuresynth
vclab-nexus
]
++ lib.optionals stdenv.cc.isClang [
llvmPackages.openmp
];
postPatch = ''
substituteInPlace src/external/tinygltf.cmake \
--replace-fail '$'{MESHLAB_EXTERNAL_DOWNLOAD_DIR}/tinygltf-2.6.3 ${tinygltf-src}
substituteInPlace src/external/libigl.cmake \
--replace-fail '$'{MESHLAB_EXTERNAL_DOWNLOAD_DIR}/libigl-2.4.0 ${libigl}
substituteInPlace src/external/nexus.cmake \
--replace-fail '$'{NEXUS_DIR}/src/corto ${corto.src}
substituteInPlace src/external/levmar.cmake \
--replace-fail '$'{LEVMAR_LINK} ${levmar.src} \
--replace-warn "MD5 ''${LEVMAR_MD5}" ""
substituteInPlace src/external/ssynth.cmake \
--replace-fail '$'{SSYNTH_LINK} ${structuresynth.src} \
--replace-warn "MD5 ''${SSYNTH_MD5}" ""
substituteInPlace src/common_gui/CMakeLists.txt \
--replace-warn "MESHLAB_LIB_INSTALL_DIR" "CMAKE_INSTALL_LIBDIR"
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
patches = [
# CMake: use system dependencies, install exports
# ref. https://github.com/cnr-isti-vclab/meshlab/pull/1617
# merged upstream
./1617_cmake-use-system-dependencies-install-exports.patch
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
./no-plist.patch
];
postPatch = lib.optionalString stdenv.hostPlatform.isLinux ''
substituteAll ${./meshlab.desktop} resources/linux/meshlab.desktop
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace src/meshlab/CMakeLists.txt \
--replace-fail "set_additional_settings_info_plist(" "# set_additional_settings_info_plist(" \
--replace-fail " TARGET meshlab" "# TARGET meshlab" \
--replace-fail " FILE \''${MESHLAB_BUILD_DISTRIB_DIR}/meshlab.app/Contents/Info.plist)" \
"# FILE \''${MESHLAB_BUILD_DISTRIB_DIR}/meshlab.app/Contents/Info.plist)"
'';
cmakeFlags = [
"-DVCGDIR=${vcg.src}"
]
++ cmakeFlagsDisallowDownload;
cmakeFlags = cmakeFlagsDisallowDownload;
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/{Applications,bin,lib}
mv $out/meshlab.app $out/Applications/
ln $out/Applications/meshlab.app/Contents/Frameworks/libmeshlab-common.dylib $out/lib/
ln $out/Applications/meshlab.app/Contents/Frameworks/libmeshlab-common{,-gui}.dylib $out/lib/
makeWrapper $out/{Applications/meshlab.app/Contents/MacOS,bin}/meshlab
substituteInPlace $out/lib/cmake/meshlab/meshlabTargets-release.cmake --replace-fail \
"{_IMPORT_PREFIX}/meshlab.app" \
"{_IMPORT_PREFIX}/Applications/meshlab.app"
'';
# The hook will wrap all the plugin binaries, make they are not a
@@ -150,7 +134,10 @@ stdenv.mkDerivation (finalAttrs: {
postFixup =
lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf --add-needed $out/lib/meshlab/libmeshlab-common.so $out/bin/.meshlab-wrapped
patchelf \
--add-needed $out/lib/meshlab/libmeshlab-common.so \
--add-needed $out/lib/meshlab/libmeshlab-common-gui.so \
$out/bin/.meshlab-wrapped
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
wrapQtApp "$out/Applications/meshlab.app/Contents/MacOS/meshlab"
@@ -163,7 +150,10 @@ stdenv.mkDerivation (finalAttrs: {
mainProgram = "meshlab";
homepage = "https://www.meshlab.net/";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ yzx9 ];
maintainers = with lib.maintainers; [
nim65s
yzx9
];
platforms = with lib.platforms; linux ++ darwin;
};
})
@@ -57,6 +57,13 @@ clangStdenv.mkDerivation rec {
patches = [ ./test.diff ];
# fix use of our lib3mf cmake export instead of finder
postPatch = ''
substituteInPlace CMakeLists.txt --replace-fail \
"Lib3MF" \
"lib3mf"
'';
nativeBuildInputs = [
(python3.withPackages (
ps: with ps; [
+14
View File
@@ -84,6 +84,15 @@ stdenv.mkDerivation rec {
sed -i 's/& / \&/g;s/\*\*/\0 /g;s/^\(.\) /\1\t/' "$out"
'';
})
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# ref. https://github.com/openscad/openscad/pull/4013 merged upstream
(fetchpatch {
name = "mem_fun-to-mem_fn.patch";
url = "https://github.com/openscad/openscad/commit/c9a1abbedfbf6dda9a23d3ad5844d11e5278a928.patch";
hash = "sha256-Man9ledRREb7U+2UOQ0VkpiwbYQjyVOY21YaRFObZc8=";
})
];
postPatch = ''
@@ -92,6 +101,11 @@ stdenv.mkDerivation rec {
substituteInPlace src/openscad.cc \
--replace-fail 'boost::join' 'boost::algorithm::join'
''
# ref. https://github.com/openscad/openscad/pull/4253 merged upstream but does not apply
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace src/FreetypeRenderer.h \
--replace-fail ": public std::unary_function<const GlyphData *, void>" ""
'';
nativeBuildInputs = [
+49
View File
@@ -0,0 +1,49 @@
{
lib,
stdenv,
fetchFromGitHub,
nix-update-script,
# nativeBuildInputs
cmake,
# propagatedBuildInputs
nlohmann_json,
stb,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "tinygltf";
version = "2.9.6";
src = fetchFromGitHub {
owner = "syoyo";
repo = "tinygltf";
tag = "v${finalAttrs.version}";
hash = "sha256-3dBxfdXeTbzeQAXaBXFaflLgXYeuOfESdq6V3+0iCXY=";
};
nativeBuildInputs = [
cmake
];
propagatedBuildInputs = [
nlohmann_json
stb
];
cmakeFlags = [
(lib.cmakeBool "TINYGLTF_INSTALL_VENDOR" false)
];
passthru.updateScript = nix-update-script { };
meta = {
description = "Header only C++11 tiny glTF 2.0 library";
homepage = "https://github.com/syoyo/tinygltf";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ nim65s ];
platforms = lib.platforms.unix;
};
})
+37 -14
View File
@@ -1,34 +1,57 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
# nativeBuildInputs
cmake,
# propagatedBuildInputs
eigen,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "vcg";
version = "2025.07";
src = fetchFromGitHub {
owner = "cnr-isti-vclab";
repo = "vcglib";
rev = version;
sha256 = "sha256-OZnqFnHGXC9fS7JCLTiHNCeA//JBAZGLB5SP/rGzaA8=";
tag = finalAttrs.version;
hash = "sha256-OZnqFnHGXC9fS7JCLTiHNCeA//JBAZGLB5SP/rGzaA8=";
};
propagatedBuildInputs = [ eigen ];
patches = [
# CMake: install lib and exports
# ref. https://github.com/cnr-isti-vclab/vcglib/pull/248
# merged upstream
(fetchpatch {
name = "cmake-install-lib-and-exports.patch";
url = "https://github.com/cnr-isti-vclab/vcglib/commit/4a8dd8d6e54890aee76917d27aabfa7031cbc68d.patch";
hash = "sha256-b3qsmLu+4VSs943VS3C4gdG/PDR2mhr9/dDTmkep8zo=";
})
];
installPhase = ''
mkdir -p $out/include
cp -r vcg wrap $out/include
find $out -name \*.h -exec sed -i 's,<eigenlib/,<eigen3/,g' {} \;
'';
nativeBuildInputs = [
cmake
];
meta = with lib; {
propagatedBuildInputs = [
eigen
];
cmakeFlags = [
(lib.cmakeBool "VCG_ALLOW_BUNDLED_EIGEN" false)
(lib.cmakeBool "VCG_BUILD_EXAMPLES" false)
];
meta = {
homepage = "https://vcg.isti.cnr.it/vcglib/install.html";
description = "C++ library for manipulation, processing and displaying with OpenGL of triangle and tetrahedral meshes";
license = licenses.gpl3;
platforms = platforms.all;
maintainers = [ ];
license = lib.licenses.gpl3;
platforms = lib.platforms.all;
maintainers = [ lib.maintainers.nim65s ];
};
}
})
+72
View File
@@ -0,0 +1,72 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
# nativeBuildInputs
cmake,
libsForQt5,
# buildInputs
corto,
glew,
llvmPackages,
vcg,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "nexus";
version = "2025.05";
src = fetchFromGitHub {
owner = "cnr-isti-vclab";
repo = "nexus";
tag = "v${finalAttrs.version}";
hash = "sha256-lC3nKQJwkixwGzPP/oS0J+WIFgYqky6NaXu9bX28+3I=";
};
outputs = [
"out"
"bin"
];
patches = [
# CMake: install lib & exports
# ref. https://github.com/cnr-isti-vclab/nexus/pull/173
# merged upstream
(fetchpatch {
url = "https://github.com/cnr-isti-vclab/nexus/commit/141ba17059f3680a74ce1178ed4245412f76061f.patch";
hash = "sha256-iY84QIpliC1BIImI/6S6E6fQwMKPmmTiwouCXW6wLuM=";
})
];
nativeBuildInputs = [
cmake
libsForQt5.wrapQtAppsHook
];
buildInputs = [
corto
glew
libsForQt5.qtbase
vcg
]
++ lib.optionals stdenv.cc.isClang [
llvmPackages.openmp
];
cmakeFlags = [
(lib.cmakeBool "BUILD_NXS_VIEW" (!stdenv.hostPlatform.isDarwin))
];
meta = {
description = "Library for creation and visualization of a batched multiresolution mesh";
homepage = "https://github.com/cnr-isti-vclab/nexus";
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ nim65s ];
mainProgram = "nxsview";
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})
+1
View File
@@ -980,6 +980,7 @@ mapAliases {
mediastreamer-openh264 = throw "'mediastreamer-openh264' has been moved to 'linphonePackages.msopenh264'"; # Added 2025-09-20
meilisearch_1_11 = throw "'meilisearch_1_11' has been removed, as it is no longer supported"; # Added 2025-10-03
melmatcheq.lv2 = melmatcheq-lv2; # Added 2025-09-27
meshlab-unstable = throw "meshlab-unstable has been removed, as it was behind meshlab"; # Added 2025-09-21
meteo = throw "'meteo' has been removed as it was unmaintained and depends on deprecated webkitgtk_4_0"; # Added 2025-10-09
microcodeAmd = throw "'microcodeAmd' has been renamed to/replaced by 'microcode-amd'"; # Converted to throw 2025-10-27
microcodeIntel = throw "'microcodeIntel' has been renamed to/replaced by 'microcode-intel'"; # Converted to throw 2025-10-27
-10
View File
@@ -11739,16 +11739,6 @@ with pkgs;
mercurialFull = mercurial.override { fullBuild = true; };
meshlab = callPackage ../by-name/me/meshlab/package.nix {
stdenv = if stdenv.hostPlatform.isDarwin then llvmPackages_18.stdenv else stdenv;
llvmPackages = llvmPackages_18;
};
meshlab-unstable = callPackage ../by-name/me/meshlab-unstable/package.nix {
stdenv = if stdenv.hostPlatform.isDarwin then llvmPackages_18.stdenv else stdenv;
llvmPackages = llvmPackages_18;
};
meshcentral = callPackage ../tools/admin/meshcentral { };
michabo = libsForQt5.callPackage ../applications/misc/michabo { };