From: Nabil Ghodbane Date: Sat, 5 Oct 2024 20:29:38 +0000 (+0200) Subject: spns #43020: add meshboolean X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ef2a7e0a14a603a9ec0ea91a5533c3cc9bb50395;p=tools%2Fsat_salome.git spns #43020: add meshboolean --- diff --git a/applications/SALOME-master-native.pyconf b/applications/SALOME-master-native.pyconf index 7e782f6..09146aa 100644 --- a/applications/SALOME-master-native.pyconf +++ b/applications/SALOME-master-native.pyconf @@ -82,6 +82,7 @@ APPLICATION : markdown_it_py : '3.0.0' medfile : '4.1.1' mesa : {tag : '19.0.8-x86_64-'+$VARS.dist, base: 'no', section: 'version_bin'} + meshbooleanplugin : 'main' MeshGems : '2.15-1' meshio: '5.3.5' metis : 'native' @@ -119,11 +120,13 @@ APPLICATION : Pygments : 'native' pyparsing : 'native' PyQt : 'native' + pyqwt: {tag : '0.12.1', base : 'no', section : 'version_0_12_1_no_pip', hpc: 'no'} pyreadline : 'native' pytest : 'native' Python : 'native' pytz : 'native' qt : 'native' + qtpy : {tag : '2.4.1', base : 'no', section : 'version_2_4_1_no_pip', hpc: 'no'} qwt : 'native' requests : 'native' rkCommon : '1.5.1' diff --git a/products/cgal.pyconf b/products/cgal.pyconf new file mode 100644 index 0000000..b7d54c5 --- /dev/null +++ b/products/cgal.pyconf @@ -0,0 +1,48 @@ +default : +{ + name : "cgal" + build_source : "cmake" + cmake_options : "-DCMAKE_INSTALL_LIBDIR:STRING=lib -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DCGAL_ENABLE_TESTING=ON" + get_source : "git" + git_info: + { + repositories : + { + github : "https://github.com/CGAL/cgal.git" + } + } + patches : [] + system_info : + { + rpm : [] + rpm_dev : ['CGAL-devel'] + apt : [] + apt_dev : ['cgal-dev'] + } + environ : + { + env_script : $name + ".py" + } + depend : ["SMESH", + "mmg", + "PyQt", + "Python", + "numpy" + ] + build_depend : ["cmake", "cppunit"] + opt_depend : [] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + install_dir : 'base' + properties : + { + incremental : "yes" + single_install_dir : "no" + } +} + +version_v5_6_1: +{ + build_source : "script" + compil_script : "cgal-v5.6.1" + $VARS.scriptExtension +} diff --git a/products/compil_scripts/cgal-v5.6.1.sh b/products/compil_scripts/cgal-v5.6.1.sh new file mode 100755 index 0000000..cf6064c --- /dev/null +++ b/products/compil_scripts/cgal-v5.6.1.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +echo "##########################################################################" +echo "cgal" $VERSION +echo "##########################################################################" + +rm -rf $BUILD_DIR +mkdir $BUILD_DIR +cd $BUILD_DIR + +CMAKE_OPTIONS= +# common settings +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_LIBDIR:STRING=lib" +CMAKE_OPTIONS+=" -DWITH_examples=ON" +CMAKE_OPTIONS+=" -DWITH_tests=ON" +CMAKE_OPTIONS+=" -DWITH_demos=ON" +CMAKE_OPTIONS+=" -DCGAL_ENABLE_TESTING=ON" + +echo "*** cmake" $CMAKE_OPTIONS +cmake $CMAKE_OPTIONS $SOURCE_DIR + +if [ $? -ne 0 ]; then + echo "ERROR on CMake" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +make install +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi + +echo +echo "*** make tests" +#make tests +#if [ $? -ne 0 ]; then +# echo "ERROR on make tests" +# exit 4 +#fi + +echo +echo "########## END" + diff --git a/products/compil_scripts/cork.sh b/products/compil_scripts/cork.sh new file mode 100755 index 0000000..aa7dfc6 --- /dev/null +++ b/products/compil_scripts/cork.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +echo "##########################################################################" +echo "cork" $VERSION +echo "##########################################################################" + +rm -rf $BUILD_DIR +mkdir $BUILD_DIR +cd $BUILD_DIR +cp -r $SOURCE_DIR/* . +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +mkdir -p ${PRODUCT_INSTALL}/bin +cp bin/cork ${PRODUCT_INSTALL}/bin +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi +chmod 755 ${PRODUCT_INSTALL}/bin/cork + +echo +echo "########## END" diff --git a/products/compil_scripts/irmb.sh b/products/compil_scripts/irmb.sh new file mode 100644 index 0000000..17ab7ff --- /dev/null +++ b/products/compil_scripts/irmb.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +echo "##########################################################################" +echo "irm" $VERSION +echo "##########################################################################" + +rm -rf $BUILD_DIR +mkdir $BUILD_DIR +cd $BUILD_DIR + +CMAKE_OPTIONS= +# common settings +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_LIBDIR:STRING=lib" +CMAKE_OPTIONS+=" -DWITH_examples=ON" +CMAKE_OPTIONS+=" -DWITH_tests=ON" +CMAKE_OPTIONS+=" -DWITH_demos=ON" +CMAKE_OPTIONS+=" -DCGAL_ENABLE_TESTING=ON" + +echo "*** cmake" $CMAKE_OPTIONS +cmake $CMAKE_OPTIONS $SOURCE_DIR + +if [ $? -ne 0 ]; then + echo "ERROR on CMake" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +make install +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi + +echo +echo "*** make tests" +#make tests +#if [ $? -ne 0 ]; then +# echo "ERROR on make tests" +# exit 4 +#fi + +echo +echo "########## END" + diff --git a/products/compil_scripts/libigl-v2.5.0.sh b/products/compil_scripts/libigl-v2.5.0.sh new file mode 100755 index 0000000..4cbc477 --- /dev/null +++ b/products/compil_scripts/libigl-v2.5.0.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +echo "##########################################################################" +echo "libigl" $VERSION +echo "##########################################################################" + +rm -rf $BUILD_DIR +mkdir $BUILD_DIR +cd $BUILD_DIR + +CMAKE_OPTIONS= +# common settings +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_LIBDIR:STRING=lib" + +echo "*** cmake" $CMAKE_OPTIONS +cmake $CMAKE_OPTIONS $SOURCE_DIR + +if [ $? -ne 0 ]; then + echo "ERROR on CMake" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +cd tutorial +make $MAKE_OPTIONS tutorial/CMakeFiles/609_Boolean.dir/rule +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +mkdir -p ${PRODUCT_INSTALL}/bin +cp $BUILD_DIR/bin/609_Boolean ${PRODUCT_INSTALL}/bin +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi +chmod 755 ${PRODUCT_INSTALL}/bin/609_Boolean + +echo +echo "########## END" + diff --git a/products/compil_scripts/mcut.sh b/products/compil_scripts/mcut.sh new file mode 100755 index 0000000..99beb5f --- /dev/null +++ b/products/compil_scripts/mcut.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +echo "##########################################################################" +echo "cgal" $VERSION +echo "##########################################################################" + +rm -rf $BUILD_DIR +mkdir $BUILD_DIR +cd $BUILD_DIR + +CMAKE_OPTIONS= +# common settings +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_LIBDIR:STRING=lib" +CMAKE_OPTIONS+=" -DLIBIGL_ROOT_DIR=${LIBIGL_ROOT_DIR}" +echo "*** cmake" $CMAKE_OPTIONS +cmake $CMAKE_OPTIONS $SOURCE_DIR + +if [ $? -ne 0 ]; then + echo "ERROR on CMake" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +make install +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi + +echo +echo "########## END" + diff --git a/products/compil_scripts/meshboolean.sh b/products/compil_scripts/meshboolean.sh new file mode 100755 index 0000000..0d79cf0 --- /dev/null +++ b/products/compil_scripts/meshboolean.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +echo "##########################################################################" +echo "meshboolean" $VERSION +echo "##########################################################################" + +rm -rf $BUILD_DIR +mkdir $BUILD_DIR + +LINUX_DISTRIBUTION="$DIST_NAME$DIST_VERSION" + +echo "##########################################################################" +echo "cgal" $VERSION +echo "##########################################################################" + +mkdir $BUILD_DIR/cgal +cd $BUILD_DIR/cgal + +CMAKE_OPTIONS= +# common settings +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_LIBDIR:STRING=lib" +CMAKE_OPTIONS+=" -DWITH_examples=ON" +CMAKE_OPTIONS+=" -DWITH_tests=ON" +CMAKE_OPTIONS+=" -DWITH_demos=ON" +CMAKE_OPTIONS+=" -DCGAL_ENABLE_TESTING=ON" + +echo "*** cmake" $CMAKE_OPTIONS +cmake $CMAKE_OPTIONS $SOURCE_DIR + +if [ $? -ne 0 ]; then + echo "ERROR on CMake" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +make install +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi + +echo "##########################################################################" +echo "libigl" $VERSION +echo "##########################################################################" + +mkdir $BUILD_DIR/libigl +cd $BUILD_DIR/libigl + +CMAKE_OPTIONS= +# common settings +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_LIBDIR:STRING=lib" + +# overwrite the main.cpp +cp -f $SOURCE_DIR/libigl/main.cpp $SOURCE_DIR/libigl/libigl/tutorial/609_Boolean/main.cpp + +echo "*** cmake" $CMAKE_OPTIONS +cmake $CMAKE_OPTIONS $SOURCE_DIR/libigl/libigl + +if [ $? -ne 0 ]; then + echo "ERROR on CMake" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +cd $BUILD_DIR/libigl/tutorial +make $MAKE_OPTIONS tutorial/CMakeFiles/609_Boolean.dir/rule +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +mkdir -p ${PRODUCT_INSTALL}/bin +cp $BUILD_DIR/libigl/bin/609_Boolean ${PRODUCT_INSTALL}/bin +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi +chmod 755 ${PRODUCT_INSTALL}/bin/609_Boolean + +echo +echo "########## END" diff --git a/products/compil_scripts/meshbooleanplugin.sh b/products/compil_scripts/meshbooleanplugin.sh new file mode 100755 index 0000000..9d32b9f --- /dev/null +++ b/products/compil_scripts/meshbooleanplugin.sh @@ -0,0 +1,200 @@ +#!/bin/bash + +echo "##########################################################################" +echo "meshboolean" $VERSION +echo "##########################################################################" + +rm -rf $BUILD_DIR +mkdir $BUILD_DIR + +LINUX_DISTRIBUTION="$DIST_NAME$DIST_VERSION" + +echo "##########################################################################" +echo "Building cgal" +echo "##########################################################################" + +mkdir $BUILD_DIR/cgal +cd $BUILD_DIR/cgal + +CMAKE_OPTIONS= +# common settings +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_LIBDIR:STRING=lib" +CMAKE_OPTIONS+=" -DWITH_examples=ON" +CMAKE_OPTIONS+=" -DWITH_tests=ON" +CMAKE_OPTIONS+=" -DWITH_demos=ON" +CMAKE_OPTIONS+=" -DCGAL_ENABLE_TESTING=ON" + +echo "*** cmake" $CMAKE_OPTIONS +cmake $CMAKE_OPTIONS $SOURCE_DIR/cgal/cgal + +if [ $? -ne 0 ]; then + echo "ERROR on CMake" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +make install +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi + +echo "##########################################################################" +echo "libigl" $VERSION +echo "##########################################################################" + +mkdir $BUILD_DIR/libigl +cd $BUILD_DIR/libigl + +CMAKE_OPTIONS= +# common settings +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_LIBDIR:STRING=lib" + +# overwrite the main.cpp +cp -f $SOURCE_DIR/libigl/main.cpp $SOURCE_DIR/libigl/libigl/tutorial/609_Boolean/main.cpp + +echo "*** cmake" $CMAKE_OPTIONS +cmake $CMAKE_OPTIONS $SOURCE_DIR/libigl/libigl + +if [ $? -ne 0 ]; then + echo "ERROR on CMake" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +cd $BUILD_DIR/libigl/tutorial +make $MAKE_OPTIONS tutorial/CMakeFiles/609_Boolean.dir/rule +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +mkdir -p ${PRODUCT_INSTALL}/bin +cp $BUILD_DIR/libigl/bin/609_Boolean ${PRODUCT_INSTALL}/bin +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi +chmod 755 ${PRODUCT_INSTALL}/bin/609_Boolean +cp -r $SOURCE_DIR/libigl/libigl/include/igl $PRODUCT_INSTALL/include/igl +export LIBIGL_INCLUDE_DIR=${PRODUCT_INSTALL}/include + +echo "##########################################################################" +echo "Building mcut" +echo "##########################################################################" + +# +cp -f $SOURCE_DIR/mcut/CSGBoolean.cpp $SOURCE_DIR/mcut/mcut/tutorials/CSGBoolean/CSGBoolean.cpp + +mkdir $BUILD_DIR/mcut +cd $BUILD_DIR/mcut + +CMAKE_OPTIONS= +# common settings +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_LIBDIR:STRING=lib" +CMAKE_OPTIONS+=" -DLIBIGL_INCLUDE_DIR=${PRODUCT_INSTALL}/include" + +echo "*** cmake" $CMAKE_OPTIONS +cmake $CMAKE_OPTIONS $SOURCE_DIR/mcut/mcut + +if [ $? -ne 0 ]; then + echo "ERROR on CMake" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS + +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +mv $BUILD_DIR/mcut/bin/CSGBoolean ${PRODUCT_INSTALL}/bin/ +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi + +echo "##########################################################################" +echo "irmb" $VERSION +echo "##########################################################################" + +mkdir $BUILD_DIR/irmb +cd $BUILD_DIR/irmb + +CMAKE_OPTIONS= +# common settings +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_LIBDIR:STRING=lib" + +echo "*** cmake" $CMAKE_OPTIONS +cmake $CMAKE_OPTIONS $SOURCE_DIR/irmb/irmb +if [ $? -ne 0 ]; then + echo "ERROR on CMake" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS all +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +mv mesh_booleans ${PRODUCT_INSTALL}/bin + +echo "##########################################################################" +echo "cork" $VERSION +echo "##########################################################################" + +cp -r $SOURCE_DIR/cork/cork $BUILD_DIR/ +cd $BUILD_DIR/cork +cp $SOURCE_DIR/cork/off.cpp $BUILD_DIR/cork/src/file_formats/off.cpp +if [ $? -ne 0 ]; then + echo "ERROR on copy" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS +if [ $? -ne 0 ]; then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +cp bin/cork ${PRODUCT_INSTALL}/bin +if [ $? -ne 0 ]; then + echo "ERROR on make install" + exit 3 +fi +chmod 755 ${PRODUCT_INSTALL}/bin/cork + +echo +echo "########## END" diff --git a/products/compil_scripts/pyqwt-0.12.1.sh b/products/compil_scripts/pyqwt-0.12.1.sh new file mode 100755 index 0000000..180605d --- /dev/null +++ b/products/compil_scripts/pyqwt-0.12.1.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +echo "##########################################################################" +echo "pyqwt" $VERSION +echo "##########################################################################" + +LINUX_DISTRIBUTION="$DIST_NAME$DIST_VERSION" + +rm -rf $BUILD_DIR +mkdir -p $BUILD_DIR/cache/pip + +mkdir -p $PRODUCT_INSTALL + +cd $BUILD_DIR + +export PYTHONPATH=${PRODUCT_INSTALL}/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH +export PATH=${PRODUCT_INSTALL}/bin:$PATH + +${PYTHONBIN} -m pip install --cache-dir=$BUILD_DIR/cache/pip $SOURCE_DIR --no-deps --target=$PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages +if [ $? -ne 0 ]; then + echo "ERROR: could not install" + exit 1 +fi +if [ -d ${PRODUCT_INSTALL}/lib64 ]; then + mv ${PRODUCT_INSTALL}/lib64 ${PRODUCT_INSTALL}/lib +fi + +echo +echo "########## END" diff --git a/products/compil_scripts/qtpy-2.4.1.sh b/products/compil_scripts/qtpy-2.4.1.sh new file mode 100755 index 0000000..676250c --- /dev/null +++ b/products/compil_scripts/qtpy-2.4.1.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +echo "##########################################################################" +echo "qtpy" $VERSION +echo "##########################################################################" + +LINUX_DISTRIBUTION="$DIST_NAME$DIST_VERSION" + +rm -rf $BUILD_DIR +mkdir -p $BUILD_DIR/cache/pip + +mkdir -p $PRODUCT_INSTALL + +cd $BUILD_DIR + +export PYTHONPATH=${PRODUCT_INSTALL}/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH +export PATH=${PRODUCT_INSTALL}/bin:$PATH + +${PYTHONBIN} -m pip install --cache-dir=$BUILD_DIR/cache/pip $SOURCE_DIR --no-deps --target=$PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages +if [ $? -ne 0 ]; then + echo "ERROR: could not install" + exit 1 +fi +if [ -d ${PRODUCT_INSTALL}/lib64 ]; then + mv ${PRODUCT_INSTALL}/lib64 ${PRODUCT_INSTALL}/lib +fi + +echo +echo "########## END" diff --git a/products/cork.pyconf b/products/cork.pyconf new file mode 100644 index 0000000..d6d26eb --- /dev/null +++ b/products/cork.pyconf @@ -0,0 +1,48 @@ +default : +{ + name : "cork" + build_source : "script" + compil_script : "cork" + $VARS.scriptExtension + get_source : "git" + git_info: + { + repositories : + { + github : "git@github.com:gilbo/cork.git" + } + } + patches : [''] + system_info : + { + rpm : [] + rpm_dev : [] + apt : [] + apt_dev : [] + } + environ : + { + env_script : $name + ".py" + } + depend : ["SMESH", + "mmg", + "PyQt", + "Python", + "numpy", + "cgal" + ] + build_depend : ["cmake", "cppunit"] + opt_depend : [] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + install_dir : 'base' + properties : + { + incremental : "yes" + single_install_dir : "no" + } +} + +version_5987de5: +{ + patches : ['cork-5987de5_off.patch'] +} diff --git a/products/env_scripts/cgal.py b/products/env_scripts/cgal.py new file mode 100644 index 0000000..106c0d4 --- /dev/null +++ b/products/env_scripts/cgal.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- + +import os.path +import platform + +def set_env(env, prereq_dir, version): + env.set('CGAL_ROOT_DIR', prereq_dir) + env.set('CGAL_DIR', os.path.join(prereq_dir, 'lib', 'cmake')) + +def set_nativ_env(env): + pass diff --git a/products/env_scripts/cork.py b/products/env_scripts/cork.py new file mode 100644 index 0000000..590d6a6 --- /dev/null +++ b/products/env_scripts/cork.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- + +import os.path +import platform + +def set_env(env, prereq_dir, version): + env.set('CORK_ROOT_DIR', prereq_dir) + env.prepend('PATH', os.path.join(prereq_dir, 'bin')) + +def set_nativ_env(env): + pass diff --git a/products/env_scripts/irmb.py b/products/env_scripts/irmb.py new file mode 100644 index 0000000..f19fda1 --- /dev/null +++ b/products/env_scripts/irmb.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- + +import os.path +import platform + +def set_env(env, prereq_dir, version): + env.set('IRMB_ROOT_DIR', prereq_dir) + env.set('IRMB_DIR', os.path.join(prereq_dir, 'lib', 'cmake')) + +def set_nativ_env(env): + pass diff --git a/products/env_scripts/libigl.py b/products/env_scripts/libigl.py new file mode 100644 index 0000000..216e9a1 --- /dev/null +++ b/products/env_scripts/libigl.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- + +import os.path +import platform + +def set_env(env, prereq_dir, version): + env.set('LIBIGL_ROOT_DIR', prereq_dir) + env.prepend('PATH', os.path.join(prereq_dir, 'bin')) + +def set_nativ_env(env): + pass diff --git a/products/env_scripts/mcut.py b/products/env_scripts/mcut.py new file mode 100644 index 0000000..e50baa2 --- /dev/null +++ b/products/env_scripts/mcut.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- + +import os.path +import platform + +def set_env(env, prereq_dir, version): + env.set('MCUT_ROOT_DIR', prereq_dir) + +def set_nativ_env(env): + pass diff --git a/products/env_scripts/meshbooleanplugin.py b/products/env_scripts/meshbooleanplugin.py new file mode 100644 index 0000000..c061635 --- /dev/null +++ b/products/env_scripts/meshbooleanplugin.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- + +import os.path +import platform + +def set_env(env, prereq_dir, version): + env.set('MESHBOOLEANGPLUGIN_ROOT_DIR', prereq_dir) + env.prepend('PYTHONPATH', os.path.join(prereq_dir, 'plugins')) + env.append('PATH',os.path.join(prereq_dir,'bin')) + +def set_nativ_env(env): + pass diff --git a/products/env_scripts/pyqwt.py b/products/env_scripts/pyqwt.py new file mode 100644 index 0000000..c438125 --- /dev/null +++ b/products/env_scripts/pyqwt.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- + +import os.path +import platform + +def set_env(env, prereq_dir, version): + pyver = 'python' + env.get('PYTHON_VERSION') + env.set('PYQWT_ROOT_DIR',prereq_dir) + env.set("PYQWT_VERSION",version) + if not platform.system() == "Windows" : + env.prepend('PATH', os.path.join(prereq_dir, 'bin')) + env.prepend('PYTHONPATH', os.path.join(prereq_dir, 'lib', pyver, 'site-packages')) + else: + pass + +def set_nativ_env(env): + pass diff --git a/products/env_scripts/qtpy.py b/products/env_scripts/qtpy.py new file mode 100644 index 0000000..9304951 --- /dev/null +++ b/products/env_scripts/qtpy.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- + +import os.path +import platform + +def set_env(env, prereq_dir, version): + pyver = 'python' + env.get('PYTHON_VERSION') + env.set('QTPY_ROOT_DIR',prereq_dir) + env.set("QTPY_VERSION",version) + if not platform.system() == "Windows" : + env.prepend('PATH', os.path.join(prereq_dir, 'bin')) + env.prepend('PYTHONPATH', os.path.join(prereq_dir, 'lib', pyver, 'site-packages')) + else: + pass + +def set_nativ_env(env): + pass diff --git a/products/irmb.pyconf b/products/irmb.pyconf new file mode 100644 index 0000000..def68ab --- /dev/null +++ b/products/irmb.pyconf @@ -0,0 +1,43 @@ +default : +{ + name : "irmb" + build_source : "cmake" + cmake_options : "-DCMAKE_INSTALL_LIBDIR:STRING=lib" + get_source : "git" + git_info: + { + repositories : + { + github : "git@github.com:gcherchi/InteractiveAndRobustMeshBooleans.git" + } + } + patches : [] + system_info : + { + rpm : [] + rpm_dev : [] + apt : [] + apt_dev : [] + } + environ : + { + env_script : $name + ".py" + } + depend : ["SMESH", + "mmg", + "PyQt", + "Python", + "numpy", + "cgal" + ] + build_depend : ["cmake", "cppunit"] + opt_depend : [] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + install_dir : 'base' + properties : + { + incremental : "yes" + single_install_dir : "no" + } +} diff --git a/products/libigl.pyconf b/products/libigl.pyconf new file mode 100644 index 0000000..fe2caff --- /dev/null +++ b/products/libigl.pyconf @@ -0,0 +1,50 @@ +default : +{ + name : "libigl" + build_source : "cmake" + cmake_options : "-DCMAKE_INSTALL_LIBDIR:STRING=lib" + get_source : "git" + git_info: + { + repositories : + { + github : "git@github.com:libigl/libigl.git" + } + } + patches : [] + system_info : + { + rpm : [] + rpm_dev : [] + apt : [] + apt_dev : [] + } + environ : + { + env_script : $name + ".py" + } + depend : ["SMESH", + "mmg", + "PyQt", + "Python", + "numpy", + "cgal" + ] + build_depend : ["cmake", "cppunit"] + opt_depend : [] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + install_dir : 'base' + properties : + { + incremental : "yes" + single_install_dir : "no" + } +} + +version_v2_5_0: +{ + build_source : "script" + compil_script : "libigl-v2.5.0" + $VARS.scriptExtension + patches: ['libigl-v2.5.0-p01_609_Boolean.patch'] +} diff --git a/products/mcut.pyconf b/products/mcut.pyconf new file mode 100644 index 0000000..ce6f08d --- /dev/null +++ b/products/mcut.pyconf @@ -0,0 +1,51 @@ +default : +{ + name : "mcut" + build_source : "cmake" + cmake_options : "-DCMAKE_INSTALL_LIBDIR:STRING=lib" + get_source : "git" + git_info: + { + repositories : + { + github : "git@github.com:cutdigital/mcut.git" + } + } + patches : [] + system_info : + { + rpm : [] + rpm_dev : [] + apt : [] + apt_dev : [] + } + environ : + { + env_script : $name + ".py" + } + depend : ["SMESH", + "mmg", + "PyQt", + "Python", + "numpy", + "eigen", + "libigl" + ] + build_depend : ["cmake", "cppunit"] + opt_depend : [] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + install_dir : 'base' + properties : + { + incremental : "yes" + single_install_dir : "no" + } +} + +version_b5b0ec6: +{ + build_source: "script" + compil_script: "mcut" + $VARS.scriptExtension + patches : ['mcut-b5b0ec6-p01_cgsboolean.patch'] +} diff --git a/products/meshbooleanplugin.pyconf b/products/meshbooleanplugin.pyconf new file mode 100644 index 0000000..a289d25 --- /dev/null +++ b/products/meshbooleanplugin.pyconf @@ -0,0 +1,48 @@ +default : +{ + name : "meshbooleanplugin" + build_source : "script" + compil_script : $name + $VARS.scriptExtension + get_source : "git" + git_info: + { + repositories : + { + github : "https://github.com/nitawa/meshbooleanplugin.git" + } + git_options : ' --recurse-submodules' + } + patches: [ + 'libigl-v2.5.0-p01_609_Boolean.patch', + 'mcut-b5b0ec6-p01_cgsboolean.patch', + 'cork-5987de5_off.patch' + ] + system_info : + { + rpm : [] + rpm_dev : [] + apt : [] + apt_dev : [] + } + environ : + { + env_script : $name + ".py" + } + depend : ["SMESH", + "PyQt", + "Python", + "numpy", + "pyqwt", + "qtpy" + ] + build_depend : ["cmake", "cppunit"] + opt_depend : [] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + install_dir : 'base' + properties : + { + incremental : "yes" + single_install_dir : "no" + } +} diff --git a/products/patches/cork-5987de5_off.patch b/products/patches/cork-5987de5_off.patch new file mode 100644 index 0000000..be900e6 --- /dev/null +++ b/products/patches/cork-5987de5_off.patch @@ -0,0 +1,12 @@ +diff --git a/cork/cork/src/file_formats/off.cpp b/cork/cork/src/file_formats/off.cpp +index 3b12571..2a52bf4 100644 +--- a/cork/cork/src/file_formats/off.cpp ++++ b/cork/cork/src/file_formats/off.cpp +@@ -50,6 +50,7 @@ int readOFF(string filename, FileMesh *data) + in >> filetype; + if(filetype != "OFF") return 1; + ++ in >> filetype >> filetype >> filetype >> filetype; // Skip meshio stamp + // counts of things + int numvertices, numfaces, numedges; + in >> numvertices >> numfaces >> numedges; diff --git a/products/patches/libigl-v2.5.0-p01_609_Boolean.patch b/products/patches/libigl-v2.5.0-p01_609_Boolean.patch new file mode 100644 index 0000000..6bf2b19 --- /dev/null +++ b/products/patches/libigl-v2.5.0-p01_609_Boolean.patch @@ -0,0 +1,118 @@ +--- libigl-v2.5.0_ref/libigl/libigl/tutorial/609_Boolean/main.cpp 2024-05-24 17:16:22.793731575 +0200 ++++ libigl-v2.5.0_dev/libigl/libigl/tutorial/609_Boolean/main.cpp 2024-05-24 17:17:14.666323894 +0200 +@@ -1,4 +1,5 @@ +-#include ++#include ++#include + //#undef IGL_STATIC_LIBRARY + #include + #include +@@ -7,9 +8,9 @@ + #include + + +-Eigen::MatrixXd VA,VB,VC; ++Eigen::MatrixXd VA,VB,VC; // Vertices + Eigen::VectorXi J,I; +-Eigen::MatrixXi FA,FB,FC; ++Eigen::MatrixXi FA,FB,FC; // Faces + igl::MeshBooleanType boolean_type( + igl::MESH_BOOLEAN_TYPE_UNION); + +@@ -18,11 +19,9 @@ + "Union", + "Intersect", + "Minus", +- "XOR", +- "Resolve", + }; + +-void update(igl::opengl::glfw::Viewer &viewer) ++void boolean(std::string out_path) + { + igl::copyleft::cgal::mesh_boolean(VA,FA,VB,FB,boolean_type,VC,FC,J); + Eigen::MatrixXd C(FC.rows(),3); +@@ -36,60 +35,34 @@ + C.row(f) = Eigen::RowVector3d(0,1,0); + } + } +- viewer.data().clear(); +- viewer.data().set_mesh(VC,FC); +- viewer.data().set_colors(C); +- std::cout<<"A "<( +- (boolean_type+1)% igl::NUM_MESH_BOOLEAN_TYPES); +- break; +- case ',': ++ static_cast( ++ (boolean_type+1)% igl::NUM_MESH_BOOLEAN_TYPES); ++ } else if (operation == "difference") ++ { + boolean_type = +- static_cast( +- (boolean_type+igl::NUM_MESH_BOOLEAN_TYPES-1)% +- igl::NUM_MESH_BOOLEAN_TYPES); +- break; +- case '[': +- viewer.core().camera_dnear -= 0.1; +- return true; +- case ']': +- viewer.core().camera_dnear += 0.1; +- return true; ++ static_cast( ++ (boolean_type+2)% igl::NUM_MESH_BOOLEAN_TYPES); + } +- update(viewer); +- return true; +-} +- +-int main(int argc, char *argv[]) +-{ +- using namespace Eigen; +- using namespace std; +- igl::readOFF(TUTORIAL_SHARED_PATH "/cheburashka.off",VA,FA); +- igl::readOFF(TUTORIAL_SHARED_PATH "/decimated-knight.off",VB,FB); +- // Plot the mesh with pseudocolors +- igl::opengl::glfw::Viewer viewer; +- +- // Initialize +- update(viewer); +- +- viewer.data().show_lines = true; +- viewer.callback_key_down = &key_down; +- viewer.core().camera_dnear = 3.9; +- cout<< +- "Press '.' to switch to next boolean operation type."< for further information. ++/** ++ * Copyright (c) 2021-2022 Floyd M. Chitalu. ++ * All rights reserved. + * +- * You may not use this file except in compliance with the License. A copy of +- * the Open Source license can be obtained from ++ * NOTE: This file is licensed under GPL-3.0-or-later (default). ++ * A commercial license can be purchased from Floyd M. Chitalu. + * +- * https://www.gnu.org/licenses/lgpl-3.0.en.html. ++ * License details: + * +- * For your convenience, a copy of this License has been included in this +- * repository. ++ * (A) GNU General Public License ("GPL"); a copy of which you should have ++ * recieved with this file. ++ * - see also: ++ * (B) Commercial license. ++ * - email: floyd.m.chitalu@gmail.com + * +- * MCUT is distributed in the hope that it will be useful, but THE SOFTWARE IS +- * PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR +- * A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * The commercial license options is for users that wish to use MCUT in ++ * their products for comercial purposes but do not wish to release their ++ * software products under the GPL license. + * +- * CSGBoolean.cpp +- * +- * \brief: +- * This tutorial shows how to compute Boolean operations between two meshes +- * that represent solids with MCUT (Constructive Solid Geometry). +- * +- * Author(s): +- * +- * Floyd M. Chitalu CutDigital Enterprise Ltd. +- * +- **************************************************************************/ +- +-#include "mcut/mcut.h" +-#include "mio/mio.h" ++ * Author(s) : Floyd M. Chitalu ++ */ + +-#include +-#include +-#include +-#include +-#include +-#include +-#include + #if defined(_WIN32) + #define _CRT_SECURE_NO_WARNINGS 1 + +@@ -63,36 +34,44 @@ + std::exit(1); \ + } + +-void MCAPI_PTR mcDebugOutput(McDebugSource source, +- McDebugType type, +- McUint32 id, +- McDebugSeverity severity, +- size_t length, +- const char* message, +- const void* userParam); ++/* ++This tutorial shows how to compute boolean operations using MCUT. ++*/ ++ ++#include "mcut/mcut.h" ++ ++#include ++#include ++#include ++#include ++// libigl dependencies ++#include ++#include ++#include ++#include ++#include ++ ++struct InputMesh { ++ // variables for reading .obj file data with libigl ++ std::vector> V; ++ std::vector> F; ++ ++ // variables for mesh data in a format suited for MCUT ++ std::string fpath; // path to mesh file ++ std::vector faceSizesArray; // vertices per face ++ std::vector faceIndicesArray; // face indices ++ std::vector vertexCoordsArray; // vertex coords ++}; + + int main(int argc, const char* argv[]) + { +- MioMesh srcMesh = { +- nullptr, // pVertices +- nullptr, // pNormals +- nullptr, // pTexCoords +- nullptr, // pFaceSizes +- nullptr, // pFaceVertexIndices +- nullptr, // pFaceVertexTexCoordIndices +- nullptr, // pFaceVertexNormalIndices +- 0, // numVertices +- 0, // numNormals +- 0, // numTexCoords +- 0, // numFaces +- }; +- +- MioMesh cutMesh = srcMesh; ++ // load meshes. ++ // ----------------- ++ InputMesh srcMesh; + + const bool user_provided_meshes = argc > 1; +- +- if (user_provided_meshes && argc < 3) { +- fprintf(stderr, "usage: \n" ++ if (user_provided_meshes && argc < 4) { ++ fprintf(stderr, "usage: \n" + "The possible values for the arguments are:\n" + "\t-u (for union)\n" + "\t-i (for intersection)\n" +@@ -106,46 +85,68 @@ int main(int argc, const char* argv[]) + printf("NOTE: using default meshes\n"); + } + +- const char* srcMeshFilePath = user_provided_meshes ? argv[1] : DATA_DIR "/cube.obj"; +- +- // +- // read-in the source-mesh from file +- // +- mioReadOBJ(srcMeshFilePath, +- &srcMesh.pVertices, +- &srcMesh.pNormals, +- &srcMesh.pTexCoords, +- &srcMesh.pFaceSizes, +- &srcMesh.pFaceVertexIndices, +- &srcMesh.pFaceVertexTexCoordIndices, +- &srcMesh.pFaceVertexNormalIndices, +- &srcMesh.numVertices, +- &srcMesh.numNormals, +- &srcMesh.numTexCoords, +- &srcMesh.numFaces); +- +- const char* cutMeshFilePath = user_provided_meshes ? argv[2] : DATA_DIR "/torus.obj"; +- +- // +- // read-in the cut-mesh from file +- // +- +- mioReadOBJ(cutMeshFilePath, +- &cutMesh.pVertices, +- &cutMesh.pNormals, +- &cutMesh.pTexCoords, +- &cutMesh.pFaceSizes, +- &cutMesh.pFaceVertexIndices, +- &cutMesh.pFaceVertexTexCoordIndices, +- &cutMesh.pFaceVertexNormalIndices, +- &cutMesh.numVertices, +- &cutMesh.numNormals, +- &cutMesh.numTexCoords, +- &cutMesh.numFaces); ++ srcMesh.fpath = user_provided_meshes ? argv[1] : DATA_DIR "/cube.obj"; ++ bool srcMeshLoaded = igl::read_triangle_mesh(srcMesh.fpath, srcMesh.V, srcMesh.F); ++ ++ if (!srcMeshLoaded) { ++ std::fprintf(stderr, "error: could not load source mesh --> %s\n", srcMesh.fpath.c_str()); ++ std::exit(1); ++ } ++ ++ // copy vertices ++ for (int i = 0; i < (int)srcMesh.V.size(); ++i) { ++ const std::vector& v = srcMesh.V[i]; ++ my_assert(v.size() == 3); ++ srcMesh.vertexCoordsArray.push_back(v[0]); ++ srcMesh.vertexCoordsArray.push_back(v[1]); ++ srcMesh.vertexCoordsArray.push_back(v[2]); ++ } ++ ++ // copy faces ++ for (int i = 0; i < (int)srcMesh.F.size(); ++i) { ++ const std::vector& f = srcMesh.F[i]; ++ for (int j = 0; j < (int)f.size(); ++j) { ++ srcMesh.faceIndicesArray.push_back(f[j]); ++ } ++ ++ srcMesh.faceSizesArray.push_back((uint32_t)f.size()); ++ } ++ ++ printf("source mesh:\n\tvertices=%d\n\tfaces=%d\n", (int)srcMesh.V.size(), (int)srcMesh.F.size()); ++ ++ InputMesh cutMesh; ++ cutMesh.fpath = user_provided_meshes ? argv[2] : DATA_DIR "/torus.obj"; ++ bool cutMeshLoaded = igl::read_triangle_mesh(cutMesh.fpath, cutMesh.V, cutMesh.F); ++ ++ if (!cutMeshLoaded) { ++ std::fprintf(stderr, "error: could not load source mesh --> %s\n", cutMesh.fpath.c_str()); ++ std::exit(1); ++ } ++ ++ // copy vertices ++ for (int i = 0; i < (int)cutMesh.V.size(); ++i) { ++ const std::vector& v = cutMesh.V[i]; ++ my_assert(v.size() == 3); ++ cutMesh.vertexCoordsArray.push_back(v[0]); ++ cutMesh.vertexCoordsArray.push_back(v[1]); ++ cutMesh.vertexCoordsArray.push_back(v[2]); ++ } ++ ++ // copy faces ++ for (int i = 0; i < (int)cutMesh.F.size(); ++i) { ++ const std::vector& f = cutMesh.F[i]; ++ for (int j = 0; j < (int)f.size(); ++j) { ++ cutMesh.faceIndicesArray.push_back(f[j]); ++ } ++ ++ cutMesh.faceSizesArray.push_back((uint32_t)f.size()); ++ } ++ ++ printf("cut mesh:\n\tvertices=%d\n\tfaces=%d\n", (int)cutMesh.V.size(), (int)cutMesh.F.size()); + + std::string boolOpStr = "*"; + +- if (argc == 4) { ++ if (argc == 5) { + if (strcmp(argv[3], "-u") == 0) { + boolOpStr = "UNION"; + } else if (strcmp(argv[3], "-i") == 0) { +@@ -162,49 +163,19 @@ int main(int argc, const char* argv[]) + else{ + printf("NOTE: computing all boolean ops.\n"); + } +- +- // + // create a context +- // ++ // ------------------- + McContext context = MC_NULL_HANDLE; ++ McResult err = mcCreateContext(&context, MC_DEBUG); ++ my_assert(err == MC_NO_ERROR); + +- // a debug context is created in case you load your own (possibly faulty) meshes +- McResult status = mcCreateContext(&context, MC_DEBUG); +- +- my_assert(status == MC_NO_ERROR); +- +- // +- // config debug output +- // +- +- McSize numBytes = 0; +- McFlags contextFlags; +- +- status = mcGetInfo(context, MC_CONTEXT_FLAGS, 0, nullptr, &numBytes); +- +- my_assert(status == MC_NO_ERROR); +- +- my_assert(sizeof(McFlags) == numBytes); +- +- status = mcGetInfo(context, MC_CONTEXT_FLAGS, numBytes, &contextFlags, nullptr); +- +- my_assert(status == MC_NO_ERROR); +- +- if (contextFlags & MC_DEBUG) { // did the user enable debugging mode? +- mcDebugMessageCallback(context, mcDebugOutput, nullptr); +- mcDebugMessageControl(context, McDebugSource::MC_DEBUG_SOURCE_ALL, McDebugType::MC_DEBUG_TYPE_ALL, McDebugSeverity::MC_DEBUG_SEVERITY_ALL, true); +- } +- +- // + // do the cutting (boolean ops) +- // +- +- printf("\nInputs: \n\tSolid-A = %s'.\n\tSolid-B = '%s'\n\n", srcMeshFilePath, cutMeshFilePath); ++ // ----------------------------- ++ printf("\nInputs: \n\tShape A = %s'.\n\tShape B = '%s'\n\n", srcMesh.fpath.c_str(), cutMesh.fpath.c_str()); + + // We can either let MCUT compute all possible meshes (including patches etc.), or we can +- // constrain the library runtime to compute exactly the boolean op mesh we want. This 'constrained' +- // case is done with the flags that follow below. +- // ++ // constrain the library to compute exactly the boolean op mesh we want. This 'constrained' case ++ // is done with the following flags. + // NOTE: you can extend these flags by bitwise ORing with additional flags (see `McDispatchFlags' in mcut.h) + const std::map booleanOps = { + { "A_NOT_B", MC_DISPATCH_FILTER_FRAGMENT_SEALING_INSIDE | MC_DISPATCH_FILTER_FRAGMENT_LOCATION_ABOVE }, +@@ -213,9 +184,7 @@ int main(int argc, const char* argv[]) + { "INTERSECTION", MC_DISPATCH_FILTER_FRAGMENT_SEALING_INSIDE | MC_DISPATCH_FILTER_FRAGMENT_LOCATION_BELOW } + }; + +- // for each supported type of boolean operation + for (std::map::const_iterator boolOpIter = booleanOps.cbegin(); boolOpIter != booleanOps.cend(); ++boolOpIter) { +- + if (boolOpIter->first != boolOpStr && boolOpStr != "*") { + continue; + } +@@ -223,244 +192,159 @@ int main(int argc, const char* argv[]) + const McFlags boolOpFlags = boolOpIter->second; + const std::string boolOpName = boolOpIter->first; + +- printf("operation %s\n", boolOpName.c_str()); ++ printf("compute %s\n", boolOpName.c_str()); + +- status = mcDispatch( ++ err = mcDispatch( + context, + MC_DISPATCH_VERTEX_ARRAY_DOUBLE | // vertices are in array of doubles + MC_DISPATCH_ENFORCE_GENERAL_POSITION | // perturb if necessary + boolOpFlags, // filter flags which specify the type of output we want + // source mesh +- srcMesh.pVertices, +- srcMesh.pFaceVertexIndices, +- srcMesh.pFaceSizes, +- srcMesh.numVertices, +- srcMesh.numFaces, ++ reinterpret_cast(srcMesh.vertexCoordsArray.data()), ++ reinterpret_cast(srcMesh.faceIndicesArray.data()), ++ srcMesh.faceSizesArray.data(), ++ static_cast(srcMesh.vertexCoordsArray.size() / 3), ++ static_cast(srcMesh.faceSizesArray.size()), + // cut mesh +- cutMesh.pVertices, +- cutMesh.pFaceVertexIndices, +- cutMesh.pFaceSizes, +- cutMesh.numVertices, +- cutMesh.numFaces); ++ reinterpret_cast(cutMesh.vertexCoordsArray.data()), ++ cutMesh.faceIndicesArray.data(), ++ cutMesh.faceSizesArray.data(), ++ static_cast(cutMesh.vertexCoordsArray.size() / 3), ++ static_cast(cutMesh.faceSizesArray.size())); + +- my_assert(status == MC_NO_ERROR); ++ my_assert(err == MC_NO_ERROR); + +- // +- // query the number of available fragments +- // NOTE: a boolean operation shall always give fragments as output +- // ++ // query the number of available connected component ++ // -------------------------------------------------- ++ uint32_t numConnComps; ++ err = mcGetConnectedComponents(context, MC_CONNECTED_COMPONENT_TYPE_FRAGMENT, 0, NULL, &numConnComps); ++ my_assert(err == MC_NO_ERROR); + +- McUint32 connectedComponentCount = 0; +- status = mcGetConnectedComponents(context, MC_CONNECTED_COMPONENT_TYPE_FRAGMENT, 0, NULL, &connectedComponentCount); +- my_assert(status == MC_NO_ERROR); ++ printf("connected components: %d\n", (int)numConnComps); + +- if (connectedComponentCount == 0) { ++ if (numConnComps == 0) { + fprintf(stdout, "no connected components found\n"); + exit(0); + } + +- std::vector connectedComponents(connectedComponentCount, MC_NULL_HANDLE); +- +- status = mcGetConnectedComponents(context, MC_CONNECTED_COMPONENT_TYPE_FRAGMENT, (McUint32)connectedComponents.size(), connectedComponents.data(), NULL); +- +- my_assert(status == MC_NO_ERROR); ++ // my_assert(numConnComps == 1); // exactly 1 result (for this example) + +- // +- // query the data of the output connected component from MCUT +- // ++ std::vector connectedComponents(numConnComps, MC_NULL_HANDLE); ++ connectedComponents.resize(numConnComps); ++ err = mcGetConnectedComponents(context, MC_CONNECTED_COMPONENT_TYPE_FRAGMENT, (uint32_t)connectedComponents.size(), connectedComponents.data(), NULL); + +- McConnectedComponent cc = connectedComponents[0]; ++ my_assert(err == MC_NO_ERROR); + +- // +- // vertices +- // +- +- McSize numBytes = 0; +- status = mcGetConnectedComponentData(context, cc, MC_CONNECTED_COMPONENT_DATA_VERTEX_DOUBLE, 0, NULL, &numBytes); ++ // query the data of each connected component from MCUT ++ // ------------------------------------------------------- + +- my_assert(status == MC_NO_ERROR); ++ McConnectedComponent connComp = connectedComponents[0]; + +- McUint32 ccVertexCount = (McUint32)(numBytes / (sizeof(McDouble) * 3)); +- std::vector ccVertices((McSize)ccVertexCount * 3u, 0); +- status = mcGetConnectedComponentData(context, cc, MC_CONNECTED_COMPONENT_DATA_VERTEX_DOUBLE, numBytes, (void*)ccVertices.data(), NULL); ++ // query the vertices ++ // ---------------------- + +- my_assert(status == MC_NO_ERROR); +- +- // +- // faces +- // ++ McSize numBytes = 0; ++ err = mcGetConnectedComponentData(context, connComp, MC_CONNECTED_COMPONENT_DATA_VERTEX_DOUBLE, 0, NULL, &numBytes); ++ my_assert(err == MC_NO_ERROR); ++ uint32_t ccVertexCount = (uint32_t)(numBytes / (sizeof(double) * 3)); ++ std::vector ccVertices((McSize)ccVertexCount * 3u, 0); ++ err = mcGetConnectedComponentData(context, connComp, MC_CONNECTED_COMPONENT_DATA_VERTEX_DOUBLE, numBytes, (void*)ccVertices.data(), NULL); ++ my_assert(err == MC_NO_ERROR); ++ ++ // query the faces ++ // ------------------- + numBytes = 0; + + #if 1 // triangulated faces + +- status = mcGetConnectedComponentData(context, cc, MC_CONNECTED_COMPONENT_DATA_FACE_TRIANGULATION, 0, NULL, &numBytes); +- +- my_assert(status == MC_NO_ERROR); +- +- std::vector ccFaceIndices(numBytes / sizeof(McUint32), 0); +- status = mcGetConnectedComponentData(context, cc, MC_CONNECTED_COMPONENT_DATA_FACE_TRIANGULATION, numBytes, ccFaceIndices.data(), NULL); ++ err = mcGetConnectedComponentData(context, connComp, MC_CONNECTED_COMPONENT_DATA_FACE_TRIANGULATION, 0, NULL, &numBytes); ++ my_assert(err == MC_NO_ERROR); ++ std::vector ccFaceIndices(numBytes / sizeof(uint32_t), 0); ++ err = mcGetConnectedComponentData(context, connComp, MC_CONNECTED_COMPONENT_DATA_FACE_TRIANGULATION, numBytes, ccFaceIndices.data(), NULL); ++ my_assert(err == MC_NO_ERROR); + +- my_assert(status == MC_NO_ERROR); +- +- std::vector ccFaceSizes(ccFaceIndices.size() / 3, 3); ++ std::vector faceSizes(ccFaceIndices.size() / 3, 3); + + #else // non-triangulated faces (i.e. N-gons) + +- status = mcGetConnectedComponentData(context, cc, MC_CONNECTED_COMPONENT_DATA_FACE, 0, NULL, &numBytes); +- +- my_assert(status == MC_NO_ERROR); +- +- std::vector ccFaceIndices(numBytes / sizeof(McUint32), 0); +- status = mcGetConnectedComponentData(context, cc, MC_CONNECTED_COMPONENT_DATA_FACE, numBytes, ccFaceIndices.data(), NULL); +- +- my_assert(status == MC_NO_ERROR); +- +- // +- // face sizes +- // ++ err = mcGetConnectedComponentData(context, connComp, MC_CONNECTED_COMPONENT_DATA_FACE, 0, NULL, &numBytes); ++ my_assert(err == MC_NO_ERROR); ++ std::vector ccFaceIndices(numBytes / sizeof(uint32_t), 0); ++ err = mcGetConnectedComponentData(context, connComp, MC_CONNECTED_COMPONENT_DATA_FACE, numBytes, ccFaceIndices.data(), NULL); ++ my_assert(err == MC_NO_ERROR); + ++ // query the face sizes ++ // ------------------------ + numBytes = 0; +- status = mcGetConnectedComponentData(context, cc, MC_CONNECTED_COMPONENT_DATA_FACE_SIZE, 0, NULL, &numBytes); +- +- my_assert(status == MC_NO_ERROR); ++ err = mcGetConnectedComponentData(context, connComp, MC_CONNECTED_COMPONENT_DATA_FACE_SIZE, 0, NULL, &numBytes); ++ my_assert(err == MC_NO_ERROR); ++ std::vector faceSizes(numBytes / sizeof(uint32_t), 0); ++ err = mcGetConnectedComponentData(context, connComp, MC_CONNECTED_COMPONENT_DATA_FACE_SIZE, numBytes, faceSizes.data(), NULL); ++ my_assert(err == MC_NO_ERROR); ++#endif + +- std::vector ccFaceSizes(numBytes / sizeof(McUint32), 0); +- status = mcGetConnectedComponentData(context, cc, MC_CONNECTED_COMPONENT_DATA_FACE_SIZE, numBytes, ccFaceSizes.data(), NULL); ++ const uint32_t ccFaceCount = static_cast(faceSizes.size()); + +- my_assert(status == MC_NO_ERROR); +-#endif + /// ------------------------------------------------------------------------------------ + +- // Here we show, how to know when connected components pertain particular boolean operations. ++ // Here we show, how to know when connected components, pertain particular boolean operations. + + McPatchLocation patchLocation = (McPatchLocation)0; + +- status = mcGetConnectedComponentData(context, cc, MC_CONNECTED_COMPONENT_DATA_PATCH_LOCATION, sizeof(McPatchLocation), &patchLocation, NULL); +- my_assert(status == MC_NO_ERROR); ++ err = mcGetConnectedComponentData(context, connComp, MC_CONNECTED_COMPONENT_DATA_PATCH_LOCATION, sizeof(McPatchLocation), &patchLocation, NULL); ++ my_assert(err == MC_NO_ERROR); + + McFragmentLocation fragmentLocation = (McFragmentLocation)0; +- status = mcGetConnectedComponentData(context, cc, MC_CONNECTED_COMPONENT_DATA_FRAGMENT_LOCATION, sizeof(McFragmentLocation), &fragmentLocation, NULL); +- my_assert(status == MC_NO_ERROR); +- +- // +- // reverse the vertex winding order, if required +- // +- if((fragmentLocation == MC_FRAGMENT_LOCATION_BELOW) && (patchLocation == MC_PATCH_LOCATION_OUTSIDE)) +- { +- std::reverse(ccFaceIndices.begin(), ccFaceIndices.end()); +- } ++ err = mcGetConnectedComponentData(context, connComp, MC_CONNECTED_COMPONENT_DATA_FRAGMENT_LOCATION, sizeof(McFragmentLocation), &fragmentLocation, NULL); ++ my_assert(err == MC_NO_ERROR); + +- // +- // save connected component (mesh) to an .obj file +- // +- +- auto extract_fname = [](const std::string& full_path) { +- // get filename +- std::string base_filename = full_path.substr(full_path.find_last_of("/\\") + 1); +- // remove extension from filename +- std::string::size_type const p(base_filename.find_last_of('.')); +- std::string file_without_extension = base_filename.substr(0, p); +- return file_without_extension; +- }; +- +- const std::string fpath(OUTPUT_DIR "/" + extract_fname(srcMeshFilePath) + "_" + extract_fname(cutMeshFilePath) + "_" + boolOpName + ".obj"); +- +- mioWriteOBJ( +- fpath.c_str(), +- ccVertices.data(), +- nullptr, // pNormals +- nullptr, // pTexCoords +- ccFaceSizes.data(), +- ccFaceIndices.data(), +- nullptr, // pFaceVertexTexCoordIndices +- nullptr, // pFaceVertexNormalIndices +- ccVertexCount, +- 0, //numNormals +- 0, // numTexCoords +- (McUint32)ccFaceSizes.size()); +- +- // +- // free connected component data +- // +- status = mcReleaseConnectedComponents(context, (McUint32)connectedComponents.size(), connectedComponents.data()); +- +- my_assert(status == MC_NO_ERROR); +- } ++ // save cc mesh to .obj file ++ // ------------------------- + +- // +- // We no longer need the mem of input meshes, so we can free it! +- // +- mioFreeMesh(&srcMesh); +- mioFreeMesh(&cutMesh); ++ std::string fpath(argv[4]); + +- // +- // destroy context +- // +- status = mcReleaseContext(context); ++ printf("write file: %s\n", fpath.c_str()); + +- my_assert(status == MC_NO_ERROR); ++ std::ofstream file(fpath); + +- return 0; +-} ++ // write vertices and normals ++ for (uint32_t i = 0; i < ccVertexCount; ++i) { ++ double x = ccVertices[(McSize)i * 3 + 0]; ++ double y = ccVertices[(McSize)i * 3 + 1]; ++ double z = ccVertices[(McSize)i * 3 + 2]; ++ file << "v " << std::setprecision(std::numeric_limits::digits10 + 1) << x << " " << y << " " << z << std::endl; ++ } + ++ int faceVertexOffsetBase = 0; ++ ++ // for each face in CC ++ for (uint32_t f = 0; f < ccFaceCount; ++f) { ++ bool reverseWindingOrder = (fragmentLocation == MC_FRAGMENT_LOCATION_BELOW) && (patchLocation == MC_PATCH_LOCATION_OUTSIDE); ++ int faceSize = faceSizes.at(f); ++ file << "f "; ++ // for each vertex in face ++ for (int v = (reverseWindingOrder ? (faceSize - 1) : 0); ++ (reverseWindingOrder ? (v >= 0) : (v < faceSize)); ++ v += (reverseWindingOrder ? -1 : 1)) { ++ const int ccVertexIdx = ccFaceIndices[(McSize)faceVertexOffsetBase + v]; ++ file << (ccVertexIdx + 1) << " "; ++ } // for (int v = 0; v < faceSize; ++v) { ++ file << std::endl; ++ ++ faceVertexOffsetBase += faceSize; ++ } + +-void MCAPI_PTR mcDebugOutput(McDebugSource source, +- McDebugType type, +- McUint32 id, +- McDebugSeverity severity, +- size_t length, +- const char* message, +- const void* userParam) +-{ +- std::string debug_src; +- switch (source) { +- case MC_DEBUG_SOURCE_API: +- debug_src = "API"; +- break; +- case MC_DEBUG_SOURCE_KERNEL: +- debug_src = "KERNEL"; +- break; +- case MC_DEBUG_SOURCE_FRONTEND: +- debug_src = "FRONTEND"; +- case MC_DEBUG_SOURCE_ALL:case MC_DEBUG_SOURCE_IGNORE: +- break; ++ // 6. free connected component data ++ // -------------------------------- ++ err = mcReleaseConnectedComponents(context, (uint32_t)connectedComponents.size(), connectedComponents.data()); ++ my_assert(err == MC_NO_ERROR); + } + +- std::string debug_type; +- switch (type) { +- case MC_DEBUG_TYPE_ERROR: +- debug_type = "ERROR"; +- break; +- case MC_DEBUG_TYPE_DEPRECATED_BEHAVIOR: +- debug_type = "DEPRECATION"; +- break; +- case MC_DEBUG_TYPE_OTHER: +- //printf("Type: Other"); +- debug_type = "OTHER"; +- break; +- case MC_DEBUG_TYPE_ALL:case MC_DEBUG_TYPE_IGNORE: +- break; +- +- } ++ // 7. destroy context ++ // ------------------ ++ err = mcReleaseContext(context); + +- std::string severity_str; +- +- switch (severity) { +- case MC_DEBUG_SEVERITY_HIGH: +- severity_str = "HIGH"; +- break; +- case MC_DEBUG_SEVERITY_MEDIUM: +- severity_str = "MEDIUM"; +- break; +- case MC_DEBUG_SEVERITY_LOW: +- severity_str = "LOW"; +- break; +- case MC_DEBUG_SEVERITY_NOTIFICATION: +- severity_str = "NOTIFICATION"; +- break; +- case MC_DEBUG_SEVERITY_ALL: +- break; +- } ++ my_assert(err == MC_NO_ERROR); + +- printf("MCUT[%d:%p,%s:%s:%s:%zu] %s\n", id, userParam, debug_src.c_str(), debug_type.c_str(),severity_str.c_str(), length, message); ++ return 0; + } diff --git a/products/pyqwt.pyconf b/products/pyqwt.pyconf new file mode 100644 index 0000000..d70eed9 --- /dev/null +++ b/products/pyqwt.pyconf @@ -0,0 +1,58 @@ +default : +{ + name : "pyqwt" + build_source : "script" + compil_script : 'pip_install' + $VARS.scriptExtension + get_source : "archive" + archive_info : + { + archive_prefix : "PythonQwt" + } + + patches : [] + system_info : + { + rpm : [] + rpm_dev : [] + apt : ['python3-qwt'] + apt_dev : [] + } + environ : + { + env_script : "pyqwt.py" + } + depend : ['Python','setuptools','numpy', 'qwt', 'PyQt'] + opt_depend: [] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + install_dir : 'base' + properties : + { + incremental : "yes" + pip : "yes" + } +} + +version_0_12_1 : +{ +} + +version_0_12_1_no_pip : +{ + compil_script: "pyqwt-0.12.1.sh" + properties : + { + incremental : "yes" + pip : "no" + } +} + +version_0_12_1_win : +{ + compil_script: "pyqwt-0.12.1.bat" + properties : + { + incremental : "yes" + pip : "no" + } +} diff --git a/products/qtpy.pyconf b/products/qtpy.pyconf new file mode 100644 index 0000000..409b1c7 --- /dev/null +++ b/products/qtpy.pyconf @@ -0,0 +1,58 @@ +default : +{ + name : "qtpy" + build_source : "script" + compil_script : 'pip_install' + $VARS.scriptExtension + get_source : "archive" + archive_info : + { + archive_prefix : "QtPy" + } + + patches : [] + system_info : + { + rpm : [] + rpm_dev : [] + apt : ['python3-qtpy'] + apt_dev : [] + } + environ : + { + env_script : "qtpy.py" + } + depend : ['Python','setuptools','numpy', 'qwt', 'PyQt'] + opt_depend: [] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + install_dir : 'base' + properties : + { + incremental : "yes" + pip : "yes" + } +} + +version_2_4_1 : +{ +} + +version_2_4_1_no_pip : +{ + compil_script: "qtpy-2.4.1.sh" + properties : + { + incremental : "yes" + pip : "no" + } +} + +version_2_4_1_win : +{ + compil_script: "qtpy-2.4.1.bat" + properties : + { + incremental : "yes" + pip : "no" + } +}