[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#49713] [PATCH v3 2/3] gnu: Add libigl.
From: |
Ivan Gankevich |
Subject: |
[bug#49713] [PATCH v3 2/3] gnu: Add libigl. |
Date: |
Tue, 21 Sep 2021 01:15:50 +0300 |
* gnu/packages/engineering.scm (libigl): New variable.
---
gnu/packages/engineering.scm | 139 +++++++++++++++++++++++++++++++++++
1 file changed, 139 insertions(+)
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 46622f3a1f..421a10292a 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2863,3 +2863,142 @@ 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=ON"
+ "-DLIBIGL_BUILD_TUTORIALS=OFF"
+ "-DLIBIGL_EXPORT_TARGETS=ON"
+ ;; The following options disable tests for the corresponding
libraries.
+ ;; The options do not affect whether the libraries are linked to
libigl or not,
+ ;; they are used for tests.
+ "-DLIBIGL_WITH_COMISO=OFF"
+ "-DLIBIGL_WITH_CORK=OFF"
+ "-DLIBIGL_WITH_MATLAB=OFF"
+ "-DLIBIGL_WITH_MOSEK=OFF"
+ "-DLIBIGL_WITH_TRIANGLE=OFF" ;; Undefined reference to
"triangulate".
+ "-DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF")
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'configure 'do-not-download-dependencies
+ (lambda _
+ (setenv "HOME" (getcwd)) ;; cmake needs this to export modules
+ (mkdir "external")
+ (copy-recursively (assoc-ref %build-inputs "libigl-glad")
"external/glad")
+ (copy-recursively (assoc-ref %build-inputs "libigl-stb")
"external/stb")
+ (copy-recursively (assoc-ref %build-inputs "libigl-tetgen")
"external/tetgen")
+ (copy-recursively (assoc-ref %build-inputs "libigl-predicates")
"external/predicates")
+ (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))
+ (("if\\(NOT TARGET tinyxml2\\)" all)
+ (string-append "find_package(tinyxml2 CONFIG REQUIRED)\n"
+ "if (NOT TARGET tinyxml2::tinyxml2)"))
+ (("if\\(NOT TARGET embree\\)" all)
+ (string-append "find_package(embree 3 CONFIG REQUIRED)\n"
all))
+ (("if\\(NOT TARGET glfw\\)" all)
+ (string-append "find_package(glfw3 CONFIG REQUIRED)\n" all))
+ (("igl_download_glad\\(\\)" all) "")
+ (("igl_download_stb\\(\\)" all) "")
+ (("igl_download_tetgen\\(\\)" all) "")
+ (("igl_download_triangle\\(\\)" all) "")
+ (("igl_download_predicates\\(\\)" all) ""))
+ (substitute* "tests/CMakeLists.txt"
+ (("igl_download_test_data\\(\\)") "")
+ (("set\\(IGL_TEST_DATA.*")
+ (format #f "set(IGL_TEST_DATA ~a)\n"
+ (assoc-ref %build-inputs "libigl-test-data")))
+ (("igl_download_catch2\\(\\)") "find_package(Catch2 CONFIG
REQUIRED)")
+ (("list\\(APPEND CMAKE_MODULE_PATH
\\$\\{LIBIGL_EXTERNAL\\}/catch2/contrib\\)")
+ "")
+ (("add_subdirectory\\(\\$\\{LIBIGL_EXTERNAL\\}/catch2
catch2\\)") ""))))
+ (add-after 'install 'install-all-subdirs
+ (lambda _
+ (copy-recursively
+ "../source/include"
+ (string-append (assoc-ref %outputs "out") "/include")))))))
+ (inputs
+ `(("eigen" ,eigen)
+ ("gmp" ,gmp)
+ ("mpfr" ,mpfr)
+ ("boost" ,boost)))
+ (native-inputs
+ `(("catch2" ,catch-framework2)
+ ("cgal" ,cgal)
+ ("embree" ,embree)
+ ("mesa" ,mesa)
+ ("glfw" ,glfw)
+ ("tinyxml2" ,tinyxml2)
+ ("libigl-test-data"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl-tests-data")
+ ;; This commit should be updated for each version
+ ;; from "cmake/LibiglDownloadExternal.cmake".
+ (commit "19cedf96d70702d8b3a83eb27934780c542356fe")))
+ (file-name (git-file-name "libigl-test-data" version))
+ (sha256 (base32
"1wxglrxw74xw4a4jmmjpm8719f3mnlbxbwygjb4ddfixxxyya4i2"))))
+ ("libigl-glad"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl-glad")
+ ;; This commit should be updated for each version
+ ;; from "cmake/LibiglDownloadExternal.cmake".
+ (commit "09b4969c56779f7ddf8e6176ec1873184aec890f")))
+ (file-name (git-file-name "libigl-glad" version))
+ (sha256 (base32
"0rwrs7513ylp6gxv7crjzflapcg9p7x04nzfvywgl665vl53rawk"))))
+ ("libigl-stb"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl-stb.git")
+ ;; This commit should be updated for each version
+ ;; from "cmake/LibiglDownloadExternal.cmake".
+ (commit "cd0fa3fcd90325c83be4d697b00214e029f94ca3")))
+ (file-name (git-file-name "libigl-stb" version))
+ (sha256 (base32
"0wwlb370z40y63ic3ny6q7lxibhixg2k1pjdkl4ymzv79zld28kj"))))
+ ("libigl-tetgen"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/tetgen.git")
+ ;; This commit should be updated for each version
+ ;; from "cmake/LibiglDownloadExternal.cmake".
+ (commit "4f3bfba3997f20aa1f96cfaff604313a8c2c85b6")))
+ (file-name (git-file-name "libigl-tetgen" version))
+ (sha256 (base32
"1k724syssw37py7kwmibk3sfwkkgyjyy7qkijnhn6rjm91g8qxsg"))))
+ ("libigl-predicates"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl-predicates.git")
+ ;; This commit should be updated for each version
+ ;; from "cmake/LibiglDownloadExternal.cmake".
+ (commit "488242fa2b1f98a9c5bd1441297fb4a99a6a9ae4")))
+ (file-name (git-file-name "libigl-predicates" version))
+ (sha256 (base32
"13bd98g8lgcq37i3crj66433z09grnb2xjrcqpwqmyn147rp5wyh"))))))
+ (home-page "https://libigl.github.io/")
+ (synopsis "Simple C++ geometry processing library")
+ (description "This library provides functionality for shape modelling,
+visualization, matrix manipulation.")
+ (license (list license:gpl3 license:mpl2.0))))
--
2.32.0