diff options
author | Ivan Gankevich <i.gankevich@spbu.ru> | 2021-09-21 01:15:50 +0300 |
---|---|---|
committer | Liliana Marie Prikler <liliana.prikler@gmail.com> | 2021-09-21 14:03:18 +0200 |
commit | 035797d3bc2e0f50239a0c63a3344d5dab456fb3 (patch) | |
tree | 91e987364f07a5b02e4727600f75e4f93415aa90 | |
parent | dfc0fedc2cd55394d20499d3f571b8f175019547 (diff) | |
download | guix-035797d3bc2e0f50239a0c63a3344d5dab456fb3.tar guix-035797d3bc2e0f50239a0c63a3344d5dab456fb3.tar.gz |
gnu: Add libigl.
* gnu/packages/engineering.scm (libigl): New variable.
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
-rw-r--r-- | gnu/packages/engineering.scm | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm index 46622f3a1f..b15259421a 100644 --- a/gnu/packages/engineering.scm +++ b/gnu/packages/engineering.scm @@ -2863,3 +2863,148 @@ 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 + '("-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-after 'unpack 'unpack-external + (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"))) + (add-after 'unpack-external 'patch-cmake + (lambda _ + ;; Fix references to external libraries + (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\\)") "")) + ;; Install otherwise missing headers + (substitute* "cmake/libigl.cmake" + (("install_dir_files\\(copyleft\\)" all) + (string-join (list all + "install_dir_files(copyleft/cgal)" + "install_dir_files(copyleft/opengl)" + "install_dir_files(copyleft/tetgen)" + "install_dir_files(embree)" + "install_dir_files(opengl)" + "install_dir_files(png)" + "install_dir_files(predicates)" + "install_dir_files(xml)") + "\n")))))))) + ;; XXX: Inputs are currently only used to build tests. + ;; We would need to patch the CMake recipe to build a shared library + ;; with all of these. + (inputs + `(("boost" ,boost) + ("catch2" ,catch-framework2) + ("cgal" ,cgal) + ("eigen" ,eigen) + ("embree" ,embree) + ("glfw" ,glfw) + ("gmp" ,gmp) + ("mesa" ,mesa) + ("mpfr" ,mpfr) + ("tinyxml2" ,tinyxml2) + ;; When updating this package, update commit fields below according to + ;; the hashes listed in "cmake/LibiglDownloadExternal.cmake". + ("libigl-test-data" + ,(origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/libigl/libigl-tests-data") + (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") + (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") + (commit "cd0fa3fcd90325c83be4d697b00214e029f94ca3"))) + (file-name (git-file-name "libigl-stb" version)) + (sha256 (base32 "0wwlb370z40y63ic3ny6q7lxibhixg2k1pjdkl4ymzv79zld28kj")))) + ("libigl-predicates" + ,(origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/libigl/libigl-predicates.git") + (commit "488242fa2b1f98a9c5bd1441297fb4a99a6a9ae4"))) + (file-name (git-file-name "libigl-predicates" version)) + (sha256 (base32 "13bd98g8lgcq37i3crj66433z09grnb2xjrcqpwqmyn147rp5wyh")))) + ;; TODO: Package tetgen separately from <http://www.tetgen.org> + ("libigl-tetgen" + ,(origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/libigl/tetgen.git") + (commit "4f3bfba3997f20aa1f96cfaff604313a8c2c85b6"))) + (file-name (git-file-name "libigl-tetgen" version)) + (sha256 (base32 "1k724syssw37py7kwmibk3sfwkkgyjyy7qkijnhn6rjm91g8qxsg")))))) + (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)))) |