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

From: Liliana Marie Prikler <[email-masked]>
Date: Sat, 18 Sep 2021 19:17:29 +0200

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