summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuckyTurtleDev2022-11-20 15:08:14 +0100
committerLuckyTurtleDev2022-11-20 15:08:14 +0100
commitc5d8f635dba539c72b90d80eec6638ea84c8301b (patch)
tree176be8778665f4d4333a65790d32f06864508ba1
downloadaur-c5d8f635dba539c72b90d80eec6638ea84c8301b.tar.gz
init
-rw-r--r--.SRCINFO38
-rw-r--r--ENVIRONMENT1
-rw-r--r--PKGBUILD83
-rw-r--r--default_build_dir.patch13
-rw-r--r--mesh_arg_is_not_optional.patch14
-rw-r--r--remove_genetic_algorithm_pipeline.patch22
-rw-r--r--set_ENVIRONMENT_file.patch13
7 files changed, 184 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..c57e2356b2af
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,38 @@
+pkgbase = inverscsg
+ pkgdesc = Automatic Conversion of 3D Models to CSG Trees
+ pkgver = r1
+ pkgrel = 1
+ url = http://inversecsg.csail.mit.edu/
+ arch = any
+ license = GPL
+ makedepends = sd
+ makedepends = ripgrep
+ depends = autoconf
+ depends = bison
+ depends = cmake
+ depends = eigen
+ depends = flex
+ depends = ipython
+ depends = libtool
+ depends = mercurial
+ depends = python
+ depends = python-scikit-learn
+ depends = python-numpy
+ depends = python-scipy
+ depends = python-matplotlib
+ depends = sketch
+ depends = zsh
+ source = https://dl.acm.org/action/downloadSupplement?doi=10.1145%2F3272127.3275006&file=a213-du.zip
+ source = remove_genetic_algorithm_pipeline.patch
+ source = set_ENVIRONMENT_file.patch
+ source = default_build_dir.patch
+ source = mesh_arg_is_not_optional.patch
+ source = ENVIRONMENT
+ sha512sums = 5129a87f675ad4963c23d362862d5f16c8fb9f065d028f970d8b9a36db446f297603ca5f4d0cd3822b86d8ce5e088c6d7354dfa33b43e27fdf702fd8996da263
+ sha512sums = 9c6ac477af4192056f329d189cd8e7c16f5e4de4b83b9e8d21fb05f0142aa77f526ffbe47bf30292a34210559d203cd9f8920f5345b46154d7a2b39960a8a325
+ sha512sums = 15168403b011374c82b73f2b478c47c476df4db20e3feba5d18aa32afbe4cc644bf9ad8bae2268be4e8cb7900d38e7f27cc2efd3e1e1534c4ef01535f97dac39
+ sha512sums = 4d56563cbee8b2c0abd31f63afc8266c1516af983479f51141a2899a28401ff93d7cadc9a3d05f861412fffa3bb6545f44946e9c52838c6a20257a1da79f638f
+ sha512sums = e6301e41fe2f2482c01e66cb123c3db457c1cfedb8637bb1de09442aa9fad4710f3109fdbd391c2575ec1b7455034916dedab186963fdf76b7490fee8a19ff4f
+ sha512sums = 3462c27e4b9c53f0732b839016fb9fd03759850b83cf69b1709f5588e8b5f5c86462aa7accc9fc6f51559c2966b9bf419107b328ebcf45d687a09e6a685dbe25
+
+pkgname = inverscsg
diff --git a/ENVIRONMENT b/ENVIRONMENT
new file mode 100644
index 000000000000..dd79c468330a
--- /dev/null
+++ b/ENVIRONMENT
@@ -0,0 +1 @@
+CSG_CPP_EXE: /home/lukas/git/aur/inverescsg/src/inverse_csg/build/cpp/csg_cpp_command
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..723d3d4d0994
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,83 @@
+# Maintainer: LuckyturtleDev [aur at lukas1818 dot de]
+
+pkgname=inverscsg
+pkgver=r1
+pkgrel=1
+pkgdesc="Automatic Conversion of 3D Models to CSG Trees"
+arch=('any')
+url="http://inversecsg.csail.mit.edu/"
+license=('GPL')
+makedepends=('sd' 'ripgrep')
+depends=('autoconf' 'bison' 'cmake' 'eigen' 'flex' 'ipython' 'libtool' 'mercurial' 'python' 'python-scikit-learn' 'python-numpy' 'python-scipy' 'python-matplotlib' 'sketch' 'zsh') #'python-sketch'
+source=("https://dl.acm.org/action/downloadSupplement?doi=10.1145%2F3272127.3275006&file=a213-du.zip"
+ "remove_genetic_algorithm_pipeline.patch"
+ "set_ENVIRONMENT_file.patch"
+ "default_build_dir.patch"
+ "mesh_arg_is_not_optional.patch"
+ "ENVIRONMENT")
+sha512sums=('5129a87f675ad4963c23d362862d5f16c8fb9f065d028f970d8b9a36db446f297603ca5f4d0cd3822b86d8ce5e088c6d7354dfa33b43e27fdf702fd8996da263'
+ '9c6ac477af4192056f329d189cd8e7c16f5e4de4b83b9e8d21fb05f0142aa77f526ffbe47bf30292a34210559d203cd9f8920f5345b46154d7a2b39960a8a325'
+ '15168403b011374c82b73f2b478c47c476df4db20e3feba5d18aa32afbe4cc644bf9ad8bae2268be4e8cb7900d38e7f27cc2efd3e1e1534c4ef01535f97dac39'
+ '4d56563cbee8b2c0abd31f63afc8266c1516af983479f51141a2899a28401ff93d7cadc9a3d05f861412fffa3bb6545f44946e9c52838c6a20257a1da79f638f'
+ 'e6301e41fe2f2482c01e66cb123c3db457c1cfedb8637bb1de09442aa9fad4710f3109fdbd391c2575ec1b7455034916dedab186963fdf76b7490fee8a19ff4f'
+ '3462c27e4b9c53f0732b839016fb9fd03759850b83cf69b1709f5588e8b5f5c86462aa7accc9fc6f51559c2966b9bf419107b328ebcf45d687a09e6a685dbe25')
+
+prepare() {
+ cd "$srcdir/inverse_csg/"
+
+ # I have no idea from with lib the remove_genetic_algorithm_pipeline came from, disable it to avoid import error
+ patch -Np1 -i "$srcdir/remove_genetic_algorithm_pipeline.patch"
+
+ # change patch of the `ENVIRONMENT` file to `/opt/inverscsg/ENVIRONMENT`, to be able to run this program with every working directory
+ patch -Np1 -i "$srcdir/set_ENVIRONMENT_file.patch"
+
+ # looks like build_dir does not do anything anymore; howerever the folder must still exist; change default to `/opt/inverscsg/` to avoid error
+ patch -Np1 -i "$srcdir/default_build_dir.patch"
+
+ # the mesh comand line argument is not optional
+ patch -Np1 -i "$srcdir/mesh_arg_is_not_optional.patch"
+
+ # interpreter is missing
+ sed -i '1 i\#!/usr/bin/python' main.py
+
+ mkdir -p build/cpp
+ cd "$srcdir/inverse_csg/cpp"
+
+ # eingen include paths are wrong everywehre
+ rg -w --files-with-matches '#include "Eigen/Dense"' | while read file
+ do
+ echo "fix eigen include in $file"
+ sd '#include "Eigen/Dense"' '#include <eigen3/Eigen/Dense>' "$file"
+ done
+ sd '#include "unsupported/Eigen/Polynomials"' '#include <eigen3/unsupported/Eigen/Polynomials>' src/common/polynomial.cpp src/test/test_polynomial_roots.cpp
+
+ # need differnt c++ verison as definded at the CMakeLists.txt
+ sd 'std=c\+\+11' 'std=c++14' CMakeLists.txt
+}
+
+build() {
+ cd "$srcdir/inverse_csg/build/cpp"
+ cmake ../../cpp
+ make
+}
+
+package() {
+ cd "$srcdir/inverse_csg/"
+ install -Dm755 "build/cpp/csg_cpp_command" "$pkgdir/usr/bin/csg_cpp_command"
+ # maybe not the best path, but it does work
+ mkdir -p "$pkgdir/opt/$pkgname/"
+ install -Dm755 "main.py" "$pkgdir/opt/$pkgname/"
+ _py_help_path="$pkgdir/opt/$pkgname/"
+ install -Dm755 "helper.py" "$_py_help_path"
+ install -Dm755 "install.py" "$_py_help_path"
+ install -Dm755 "point_cloud_seg.py" "$_py_help_path"
+ install -Dm755 "primitive_to_sketch.py" "$_py_help_path"
+ install -Dm755 "print_data_file.py" "$_py_help_path"
+ install -Dm755 "run_tests.py" "$_py_help_path"
+ install -Dm755 "sketch_pipeline.py" "$_py_help_path"
+ install -Dm755 "surface_primitive_to_sketch.py" "$_py_help_path"
+ install -Dm755 "transforms.py" "$_py_help_path"
+ install -Dm755 "visualize_point_cloud.py" "$_py_help_path"
+ # install required config file
+ cp "../ENVIRONMENT" "$pkgdir/opt/$pkgname/ENVIRONMENT"
+}
diff --git a/default_build_dir.patch b/default_build_dir.patch
new file mode 100644
index 000000000000..abc53f6a1a00
--- /dev/null
+++ b/default_build_dir.patch
@@ -0,0 +1,13 @@
+diff --git a/main.py b/main_new.py
+index 5435dc7..636e090 100644
+--- a/main.py
++++ b/main_new.py
+@@ -10,7 +10,7 @@ import genetic_algorithm_pipeline
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--builddir',
+ help='same as the build folder used in install.py',
+- default='../build/')
++ default='/opt/inverscsg/')
+ parser.add_argument('--countersample', help='number of counter samples at '
+ 'each iteration. Used by sketch only', default=100)
+ parser.add_argument('--eps', help='minimum distance to mesh', default='0.01')
diff --git a/mesh_arg_is_not_optional.patch b/mesh_arg_is_not_optional.patch
new file mode 100644
index 000000000000..5e07f0bb3aba
--- /dev/null
+++ b/mesh_arg_is_not_optional.patch
@@ -0,0 +1,14 @@
+diff --git a/main.py b/main_new.py
+index 5435dc7..4d34981 100644
+--- a/main.py
++++ b/main_new.py
+@@ -18,8 +18,7 @@ parser.add_argument('--initsample', help='number of initial samples sent to' \
+ 'sketch', default=1000)
+ parser.add_argument('--max_iter', help='max number of iterations used by ' \
+ 'sketch to solve each part', default=10)
+-parser.add_argument('--mesh', help='location of the .off file',
+- default='example/one_cube/csg.off')
++parser.add_argument('mesh', help='location of the .off file')
+ parser.add_argument('--method', help='choose "sketch" or "genetic"',
+ default='sketch')
+ parser.add_argument('--outdir', help='a folder to store all results',
diff --git a/remove_genetic_algorithm_pipeline.patch b/remove_genetic_algorithm_pipeline.patch
new file mode 100644
index 000000000000..95cd794c2bfb
--- /dev/null
+++ b/remove_genetic_algorithm_pipeline.patch
@@ -0,0 +1,22 @@
+diff --git a/main.py b/main_new.py
+index 8a96808..5492280 100644
+--- a/main.py
++++ b/main_new.py
+@@ -5,7 +5,6 @@ import sys
+
+ import helper
+ import sketch_pipeline
+-import genetic_algorithm_pipeline
+
+ # Parse input arguments.
+ parser = argparse.ArgumentParser()
+@@ -46,8 +45,7 @@ if __name__ == '__main__':
+ sketch_pipeline.SetupSketchPipeline(args)
+ sketch_pipeline.RunSketchPipeline()
+ elif args.method == 'genetic':
+- genetic_algorithm_pipeline.SetupGeneticAlgorithmPipeline(args)
+- genetic_algorithm_pipeline.RunGeneticAlgorithmPipeline()
++ raise NotImplementedError('genetic_algorithm not supported!')
+ else:
+ helper.PrintWithRedColor('Invalid method: %s' % method)
+ sys.exit(-1)
diff --git a/set_ENVIRONMENT_file.patch b/set_ENVIRONMENT_file.patch
new file mode 100644
index 000000000000..d0c713c732b7
--- /dev/null
+++ b/set_ENVIRONMENT_file.patch
@@ -0,0 +1,13 @@
+diff --git a/main.py b/main_new.py
+index 8a96808..b79194e 100644
+--- a/main.py
++++ b/main_new.py
+@@ -35,7 +35,7 @@ parser.add_argument('--volumedensity', help='number of samples in unit ' \
+ args = parser.parse_args()
+
+ # Load environment variables.
+-env_file = os.path.join(os.path.realpath(args.builddir), 'ENVIRONMENT')
++env_file = '/opt/inverscsg/ENVIRONMENT'
+ for line in open(env_file):
+ if '#' not in line:
+ key, value = line.strip().split()