diff mbox series

[bug#49713,2/3] gnu: Add libigl.

Message ID 20210723210731.9246-1-i.gankevich@spbu.ru
State Accepted
Headers show
Series [bug#49713,1/3] gnu: cereal: Use cmake to build and install the library. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Ivan Gankevich July 23, 2021, 9:07 p.m. UTC
* gnu/packages/engineering.scm (libigl): New variable.
---
 gnu/packages/engineering.scm | 62 ++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

Comments

Liliana Marie Prikler Sept. 18, 2021, 5:17 p.m. UTC | #1
Hi,

Am Samstag, den 24.07.2021, 00:07 +0300 schrieb Ivan Gankevich:
> * gnu/packages/engineering.scm (libigl): New variable.
> ---
>  gnu/packages/engineering.scm | 62
> ++++++++++++++++++++++++++++++++++++
>  1 file changed, 62 insertions(+)
> 
> diff --git a/gnu/packages/engineering.scm
> b/gnu/packages/engineering.scm
> index fc932ddb28..eec12814ff 100644
> --- a/gnu/packages/engineering.scm
> +++ b/gnu/packages/engineering.scm
> @@ -2862,3 +2862,65 @@ for hooking Linux system calls in user
> space.  This is achieved by
>  hot-patching the machine code of the standard C library in the
> memory of
>  a process.")
>        (license license:bsd-2))))
> +
> +(define-public libigl
> +  (package
> +    (name "libigl")
> +    (version "2.3.0")
> +    (source
> +      (origin
> +        (method git-fetch)
> +        (uri (git-reference
> +               (url "https://github.com/libigl/libigl")
> +               (commit (string-append "v" version))))
> +        (file-name (git-file-name name version))
> +        (sha256
> +          (base32
> +            "004a22ifq2vibgkgvrlyihqimpsfizvq5l448204kwfg3lkycajj"))
> ))
> +    (build-system cmake-build-system)
> +    (arguments
> +      `(#:configure-flags
> +        (list "-DLIBIGL_USE_STATIC_LIBRARY=OFF"
> +              "-DLIBIGL_BUILD_TESTS=OFF" ;; tests need to download
> test data
Can we provide test data as input?
> +              "-DLIBIGL_BUILD_TUTORIALS=OFF"
> +              "-DLIBIGL_EXPORT_TARGETS=ON"
> +              "-DLIBIGL_WITH_CGAL=ON"
> +              "-DLIBIGL_WITH_COMISO=OFF"
> +              "-DLIBIGL_WITH_CORK=OFF"
> +              "-DLIBIGL_WITH_EMBREE=OFF"
> +              "-DLIBIGL_WITH_MATLAB=OFF"
> +              "-DLIBIGL_WITH_MOSEK=OFF"
> +              "-DLIBIGL_WITH_OPENGL=OFF"
> +              "-DLIBIGL_WITH_OPENGL_GLFW=OFF"
> +              "-DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF"
> +              "-DLIBIGL_WITH_PNG=OFF"
> +              "-DLIBIGL_WITH_TETGEN=OFF"
> +              "-DLIBIGL_WITH_TRIANGLE=OFF"
> +              "-DLIBIGL_WITH_PREDICATES=OFF"
> +              "-DLIBIGL_WITH_XML=OFF")
In Guix we prefer to build packages as feature-complete as possible. 
Obviously MATLAB won't work unless they also accept octave, but you
might want to at least enable some of the low-hanging fruits such as
XML or OpenGL.  If it's about having a minimal package, simply provide
a -minimal variant as well.
> +        #:tests? #f
Don't leave #:tests? #f uncommented.
> +        #:phases
> +        (modify-phases %standard-phases
> +          (add-before 'configure 'do-not-download-dependencies
> +            (lambda _
> +              (substitute* "cmake/libigl.cmake"
> +                (("if\\(NOT TARGET Eigen3::Eigen\\)" all)
> +                 (string-append "find_package(Eigen3 CONFIG
> REQUIRED)\n" all))
> +                (("if\\(NOT TARGET CGAL::CGAL\\)" all)
> +                 (string-append "find_package(CGAL CONFIG COMPONENTS
> Core)\n" all)))))
> +          (add-after 'install 'install-all-subdirs
> +            (lambda _
> +              (copy-recursively
> +                "../source/include"
> +                (string-append (assoc-ref %outputs "out")
> "/include")))))))
> +    (inputs
> +      `(("eigen" ,eigen)
> +        ("cgal" ,cgal)
> +        ("gmp" ,gmp)
> +        ("mpfr" ,mpfr)
> +        ("boost" ,boost)))
> +    (home-page "https://libigl.github.io/")
> +    (synopsis "Simple C++ geometry processing library")
> +    (description "The library provides functionality for shape
> modelling,
> +visualization, matrix manipulation.")
s/The/This/ ?
> +    (license (list license:gpl3 license:mpl2.0))))

Regards
Ivan Gankevich Sept. 19, 2021, 8:18 p.m. UTC | #2
>Can we provide test data as input?

I’ve added test data and enabled tests.


>> +              "-DLIBIGL_BUILD_TUTORIALS=OFF"
>> +              "-DLIBIGL_EXPORT_TARGETS=ON"
>> +              "-DLIBIGL_WITH_CGAL=ON"
>> +              "-DLIBIGL_WITH_COMISO=OFF"
>> +              "-DLIBIGL_WITH_CORK=OFF"
>> +              "-DLIBIGL_WITH_EMBREE=OFF"
>> +              "-DLIBIGL_WITH_MATLAB=OFF"
>> +              "-DLIBIGL_WITH_MOSEK=OFF"
>> +              "-DLIBIGL_WITH_OPENGL=OFF"
>> +              "-DLIBIGL_WITH_OPENGL_GLFW=OFF"
>> +              "-DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF"
>> +              "-DLIBIGL_WITH_PNG=OFF"
>> +              "-DLIBIGL_WITH_TETGEN=OFF"
>> +              "-DLIBIGL_WITH_TRIANGLE=OFF"
>> +              "-DLIBIGL_WITH_PREDICATES=OFF"
>> +              "-DLIBIGL_WITH_XML=OFF")
>In Guix we prefer to build packages as feature-complete as possible.
>Obviously MATLAB won't work unless they also accept octave, but you
>might want to at least enable some of the low-hanging fruits such as
>XML or OpenGL.  If it's about having a minimal package, simply provide
>a -minimal variant as well.

This library is header-only. All the dependencies from this list are used in the
tests. Headers that use these dependencies are installed no matter which
dependenies are “ON” in this list. I’ve added XML. Adding other dependencies
would require rewriting most of “cmake/libigl.cmake” file, because the
authors of the package like to download and build all the dependencies manually.


>> +        #:tests? #f
>Don't leave #:tests? #f uncommented.

Enabled tests.


>> +    (description "The library provides functionality for shape
>> modelling,
>> +visualization, matrix manipulation.")
>s/The/This/ ?

Fixed!


Thanks for your corrections. I’ve sent the updated version of this patch via
“git send-email”.


Regards,
Ivan
diff mbox series

Patch

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index fc932ddb28..eec12814ff 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2862,3 +2862,65 @@  for hooking Linux system calls in user space.  This is achieved by
 hot-patching the machine code of the standard C library in the memory of
 a process.")
       (license license:bsd-2))))
+
+(define-public libigl
+  (package
+    (name "libigl")
+    (version "2.3.0")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/libigl/libigl")
+               (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+          (base32
+            "004a22ifq2vibgkgvrlyihqimpsfizvq5l448204kwfg3lkycajj"))))
+    (build-system cmake-build-system)
+    (arguments
+      `(#:configure-flags
+        (list "-DLIBIGL_USE_STATIC_LIBRARY=OFF"
+              "-DLIBIGL_BUILD_TESTS=OFF" ;; tests need to download test data
+              "-DLIBIGL_BUILD_TUTORIALS=OFF"
+              "-DLIBIGL_EXPORT_TARGETS=ON"
+              "-DLIBIGL_WITH_CGAL=ON"
+              "-DLIBIGL_WITH_COMISO=OFF"
+              "-DLIBIGL_WITH_CORK=OFF"
+              "-DLIBIGL_WITH_EMBREE=OFF"
+              "-DLIBIGL_WITH_MATLAB=OFF"
+              "-DLIBIGL_WITH_MOSEK=OFF"
+              "-DLIBIGL_WITH_OPENGL=OFF"
+              "-DLIBIGL_WITH_OPENGL_GLFW=OFF"
+              "-DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF"
+              "-DLIBIGL_WITH_PNG=OFF"
+              "-DLIBIGL_WITH_TETGEN=OFF"
+              "-DLIBIGL_WITH_TRIANGLE=OFF"
+              "-DLIBIGL_WITH_PREDICATES=OFF"
+              "-DLIBIGL_WITH_XML=OFF")
+        #:tests? #f
+        #:phases
+        (modify-phases %standard-phases
+          (add-before 'configure 'do-not-download-dependencies
+            (lambda _
+              (substitute* "cmake/libigl.cmake"
+                (("if\\(NOT TARGET Eigen3::Eigen\\)" all)
+                 (string-append "find_package(Eigen3 CONFIG REQUIRED)\n" all))
+                (("if\\(NOT TARGET CGAL::CGAL\\)" all)
+                 (string-append "find_package(CGAL CONFIG COMPONENTS Core)\n" all)))))
+          (add-after 'install 'install-all-subdirs
+            (lambda _
+              (copy-recursively
+                "../source/include"
+                (string-append (assoc-ref %outputs "out") "/include")))))))
+    (inputs
+      `(("eigen" ,eigen)
+        ("cgal" ,cgal)
+        ("gmp" ,gmp)
+        ("mpfr" ,mpfr)
+        ("boost" ,boost)))
+    (home-page "https://libigl.github.io/")
+    (synopsis "Simple C++ geometry processing library")
+    (description "The library provides functionality for shape modelling,
+visualization, matrix manipulation.")
+    (license (list license:gpl3 license:mpl2.0))))