diff options
Diffstat (limited to 'gnu/packages/engineering.scm')
-rw-r--r-- | gnu/packages/engineering.scm | 670 |
1 files changed, 508 insertions, 162 deletions
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm index 64335d89f7..5d0f358667 100644 --- a/gnu/packages/engineering.scm +++ b/gnu/packages/engineering.scm @@ -27,19 +27,20 @@ ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru> ;;; Copyright © 2021, 2022 Petr Hodina <phodina@protonmail.com> ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com> -;;; Copyright © 2022 Evgeny Pisemsky <evgeny@pisemsky.com> +;;; Copyright © 2022 Evgeny Pisemsky <mail@pisemsky.site> ;;; Copyright © 2022 Olivier Dion <olivier.dion@polymtl.ca> ;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io> ;;; Copyright © 2022 Malte Frank Gerdes <malte.f.gerdes@gmail.com> ;;; Copyright © 2022 Konstantinos Agiannis <agiannis.kon@gmail.com> ;;; Copyright © 2022 Greg Hogan <code@greghogan.com> -;;; Copyright © 2022 Artyom V. Poptsov <poptsov.artyom@gmail.com> +;;; Copyright © 2022, 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com> ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2022, 2023 Felix Gruber <felgru@posteo.net> ;;; Copyright © 2023 Theofilos Pechlivanis <theofilos.pechlivanis@gmail.com> ;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com> ;;; Copyright © 2023 pinoaffe <pinoaffe@gmail.com> ;;; Copyright © 2024 Juliana Sims <juli@incana.org> +;;; Copyright © 2024 Nguyễn Gia Phong <mcsinyx@disroot.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -162,6 +163,7 @@ #:use-module (gnu packages text-editors) #:use-module (gnu packages time) #:use-module (gnu packages tls) + #:use-module (gnu packages toolkits) #:use-module (gnu packages tree-sitter) #:use-module (gnu packages version-control) #:use-module (gnu packages web) @@ -819,7 +821,7 @@ required for Fritzing app.") (native-inputs (list pkg-config qttools-5)) (inputs - (list kcoreaddons kwidgetsaddons qtbase-5 qtsvg-5 sqlite)) + (list kcoreaddons-5 kwidgetsaddons-5 qtbase-5 qtsvg-5 sqlite)) (home-page "https://qelectrotech.org/") (synopsis "CAD/CAE editor focusing on schematics drawing features") (description "QElectroTech, or QET in short, is a desktop application to @@ -1670,7 +1672,7 @@ fully-vectorial and three-dimensional methods.") (define-public meep (package (name "meep") - (version "1.28.0") + (version "1.29.0") (source (origin (method url-fetch) (uri @@ -1679,7 +1681,7 @@ fully-vectorial and three-dimensional methods.") version "/meep-" version ".tar.gz")) (sha256 (base32 - "199a29mb64cfv89azzdh8arpy9ib6050cqh86yw5ypm5jhy6178v")))) + "1511849g6wlpa42kfrj6zvmc3ivad9ync8r01xp2ld7r5j39y9v8")))) (build-system gnu-build-system) (arguments (list #:configure-flags @@ -1787,6 +1789,7 @@ analyzer (FFT) and frequency sweep plot.") (version "5.0.1") (source (origin (method git-fetch) + (patches (search-patches "capstone-fix-python-constants.patch")) (uri (git-reference (url "https://github.com/capstone-engine/capstone") (commit version))) @@ -1798,7 +1801,7 @@ analyzer (FFT) and frequency sweep plot.") (arguments `(#:tests? #f #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) - "CC=gcc") + (string-append "CC=" ,(cc-for-target))) #:phases (modify-phases %standard-phases (delete 'configure) ; no configure script @@ -1925,6 +1928,64 @@ like relocation symbols. It is able to deal with malformed binaries, making it suitable for security research and analysis.") (license license:lgpl3))) +(define-public zycore + (package + (name "zycore") + (version "1.5.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/zyantific/zycore-c") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0s962pkqybh1xbs75y4jb4bqc9qnq0sviqd570mirqdhhq87agib")))) + (build-system cmake-build-system) + (native-inputs (list googletest)) + (arguments (list #:configure-flags + #~(list "-DZYCORE_BUILD_SHARED_LIB=ON" + #$(if (%current-target-system) + "-DZYCORE_BUILD_TESTS=OFF" + "-DZYCORE_BUILD_TESTS=ON")))) + (home-page "https://github.com/zyantific/zycore-c") + (synopsis "Internal library for Zydis") + (description + "This package provides platfrom-independent types, macros +and a fallback for environments without libc for Zydis.") + (license license:expat))) + +(define-public zydis + (package + (name "zydis") + (version "4.1.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/zyantific/zydis") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "15iw6wcg2van8pw54xs15zk5cniqm8d8vbd1w1br9azv8jxsqjva")))) + (build-system cmake-build-system) + (arguments (list #:configure-flags + #~(list "-DZYAN_SYSTEM_ZYCORE=ON" + "-DZYDIS_BUILD_SHARED_LIB=ON" + "-DZYDIS_BUILD_MAN=ON"))) + (native-inputs (list python-minimal ronn-ng)) + (inputs (list zycore)) + (home-page "https://zydis.re") + (synopsis "Disassembler and code generation library for x86 and AMD64") + (description + "Zydis is a decoder and disassembler library with the following features: +@itemize +@item Support for all x86 and AMD64 instructions and extensions +@item Optimization for high performance +@item No dynamic memory allocation +@item Thread-safe by design +@item Smaller file-size overhead compared to other common disassembler libraries +@end itemize") + (license license:expat))) + (define-public asco (package (name "asco") @@ -1978,48 +2039,32 @@ high-performance parallel differential evolution (DE) optimization algorithm.") ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27344#236>. (package (name "libngspice") - (version "42") + (version "43") (source (origin (method url-fetch) - (uri (list - (string-append "mirror://sourceforge/ngspice/ng-spice-rework/" - version "/ngspice-" version ".tar.gz") - (string-append "mirror://sourceforge/ngspice/ng-spice-rework/" - "old-releases/" version - "/ngspice-" version ".tar.gz"))) + (uri (list (string-append + "mirror://sourceforge/ngspice/ng-spice-rework/" version + "/ngspice-" version ".tar.gz") + (string-append + "mirror://sourceforge/ngspice/ng-spice-rework/" + "old-releases/" version "/ngspice-" version ".tar.gz"))) (sha256 - (base32 "02p5ar1cqwn70dw5xzx5v3qhm1p1xgb1xpzs1ljklcxjda2f6zvk")))) + (base32 "169nn6bw5628m2k8cy77yd1vs22plj83grisq58j07sk11pnmp8l")))) (build-system gnu-build-system) (arguments - `(;; No tests for libngspice exist. - ;; The transient tests for ngspice fail. - #:tests? #f - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'patch-timestamps - (lambda _ - (substitute* "configure" - (("`date`") "Thu Jan 1 00:00:01 UTC 1970")))) - (add-after 'unpack 'delete-program-manuals - (lambda _ - (substitute* "man/man1/Makefile.in" - (("^man_MANS = ngspice\\.1 ngnutmeg\\.1 ngsconvert\\.1 ngmultidec\\.1") - "man_MANS = ")))) - (add-after 'install 'delete-scripts - (lambda* (#:key outputs #:allow-other-keys) - (delete-file-recursively - (string-append (assoc-ref outputs "out") - "/share/ngspice/scripts"))))) - #:configure-flags - (list "--enable-openmp" - "--enable-ciderlib" - "--enable-xspice" - "--with-ngshared"))) - (native-inputs - (list bison flex)) - (inputs - (list libxaw openmpi)) + (list + #:tests? #f ;there are no tests for libngspice + #:phases #~(modify-phases %standard-phases + (add-after 'install 'delete-scripts + (lambda _ + (delete-file-recursively + (string-append #$output + "/share/ngspice/scripts"))))) + #:configure-flags #~(list "--enable-openmp" "--enable-ciderlib" + "--enable-xspice" "--with-ngshared"))) + (native-inputs (list bison flex)) + (inputs (list libxaw openmpi)) (home-page "https://ngspice.sourceforge.net/") (synopsis "Mixed-level/mixed-signal circuit simulator") (description @@ -2027,31 +2072,28 @@ high-performance parallel differential evolution (DE) optimization algorithm.") @code{Spice3f5}, a circuit simulator, and @code{Xspice}, an extension that provides code modeling support and simulation of digital components through an embedded event driven algorithm.") - (license (list license:lgpl2.0+ ; code in frontend/numparam - (license:non-copyleft "file:///COPYING") ; spice3 bsd-style - license:bsd-3 ; ciderlib - license:public-domain)))) ; xspice + (license (list license:lgpl2.0+ ;code in frontend/numparam + (license:non-copyleft "file:///COPYING") ;spice3 bsd-style + license:bsd-3 ;ciderlib + license:public-domain)))) ;xspice (define-public ngspice ;; The ngspice executables (see libngpsice above.) - (package (inherit libngspice) + (package + (inherit libngspice) (name "ngspice") (arguments (substitute-keyword-arguments (package-arguments libngspice) + ((#:tests? _ #f) #t) ((#:configure-flags flags) - `(cons "--with-readline=yes" - (delete "--with-ngshared" ,flags))) + #~(cons "--with-readline=yes" + (delete "--with-ngshared" + #$flags))) ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'delete-include-files - (lambda _ - (substitute* "src/Makefile.in" - (("^SUBDIRS = misc maths frontend spicelib include/ngspice") - "SUBDIRS = misc maths frontend spicelib")))) - (delete 'delete-program-manuals) - (delete 'delete-scripts))))) - (inputs - (list libngspice readline)))) + #~(modify-phases #$phases + (delete 'delete-scripts))))) + (native-inputs (list perl)) + (inputs (list libngspice readline)))) (define trilinos-serial-xyce ;; Note: This is a Trilinos containing only the packages Xyce needs, so we @@ -2626,10 +2668,69 @@ specification can be downloaded at @url{http://3mf.io/specification/}.") measurement devices and test equipment via GPIB, RS232, Ethernet or USB.") (license license:expat))) +(define-public python-pandapower + (package + (name "python-pandapower") + (version "2.14.9") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pandapower" version ".zip")) + (sha256 + (base32 "0c5vgiq795kd5q4wcy2x7s3l7x9xdj2nqyfx188dmhgqckrym161")))) + (build-system pyproject-build-system) + (native-inputs (list python-pyproj python-pytest unzip)) + (propagated-inputs (list python-deepdiff + python-geojson + python-networkx + python-numpy + python-packaging + python-pandas + python-scipy + python-tqdm + python-typing-extensions)) + (home-page "https://www.pandapower.org/") + (synopsis "Power system modelling and analysis") + (description "@code{pandapower} is an easy to use network calculation +program aimed to automate the analysis and optimization of power systems. +It uses the data analysis library @code{pandas} and is compatible with the +commonly used @code{MATPOWER} / @code{PYPOWER} case format. @code{pandapower} +allows using different solvers including an improved Newton-Raphson power flow +implementation, all @code{PYPOWER} solvers, the C++ library solvers for fast +steady-state distribution power system analysis of @code{PowerGridModel}, the +Newton-Raphson power flow solvers in the C++ library lightsim2grid, and the +@code{PowerModels.jl} library.") + (license license:bsd-3))) + +(define-public python-pandapipes + (package + (name "python-pandapipes") + (version "0.10.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pandapipes" version ".zip")) + (sha256 + (base32 "06yqqd25hxa6q49qcbpy0njwxkqzfhbff4frrrxd84391njgvdhq")))) + (build-system pyproject-build-system) + (native-inputs (list python-nbmake + python-pytest + python-pytest-xdist + unzip)) + (propagated-inputs (list python-matplotlib + python-pandapower + python-shapely)) + (home-page "http://www.pandapipes.org") + (synopsis "Simulation of multi energy grids") + (description + "This package provides a pipeflow calculation tool that complements +@code{pandapower} in the simulation of multi energy grids.") + (license license:bsd-3))) + (define-public python-scikit-rf (package (name "python-scikit-rf") - (version "1.0.0") + (version "1.1.0") (source (origin (method git-fetch) ;PyPI misses some files required for tests (uri (git-reference @@ -2637,7 +2738,7 @@ measurement devices and test equipment via GPIB, RS232, Ethernet or USB.") (commit (string-append "v" version)))) (sha256 (base32 - "0qfijh2r93jn3za2h9wdv2y49gd4alcww35zrdvmxrx6kbv67m2f")) + "0ji1c8b9cbgb0w18dx976hza690npkypz8kav4a3yin2wysjvf64")) (file-name (git-file-name name version)))) (build-system pyproject-build-system) (propagated-inputs (list python-matplotlib @@ -2663,6 +2764,41 @@ measurement devices and test equipment via GPIB, RS232, Ethernet or USB.") Microwave engineering.") (license license:bsd-3))) +(define-public python-lcapy + (package + (name "python-lcapy") + (version "1.23") + (source + (origin + (method url-fetch) + (uri (pypi-uri "lcapy" version)) + (sha256 + (base32 "13swd2nd2s20hixy4as924sr223flcvcy9zw3qlzsrcvhppzb84n")))) + (build-system pyproject-build-system) + (arguments + (list + ;; This test fails by FileNotFoundError (a schematic file), possibly + ;; because it's not included in PyPI. + #:test-flags #~(list "-k" "not test_circuitgraph"))) + (propagated-inputs (list python-ipython + python-matplotlib + python-networkx + python-numpy + python-property-cached + python-scipy + python-sympy + python-wheel)) + (native-inputs (list python-pytest)) + (home-page "https://github.com/mph-/lcapy") + (synopsis "Symbolic linear circuit analysis") + (description "Lcapy is a Python package for linear circuit analysis. It +uses SymPy for symbolic mathematics. + +Lcapy can symbolically analyse circuits described with netlists or by +series/parallel combinations of components. It can also manipulate +ontinuous-time and discret-time expressions.") + (license license:lgpl2.1+))) + (define-public openscad (package (name "openscad") @@ -2920,6 +3056,32 @@ arithmetic operations on fields, entity location functionalities, and interpolation toolkit.") (license license:gpl3+))) +(define-public python-motulator + (package + (name "python-motulator") + (version "0.3.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "motulator" version)) + (sha256 + (base32 "01qv4d4rgkwk653vz1qz1nmakniv86572j5ikrxwd63rwv5ckggf")))) + (build-system pyproject-build-system) + (arguments + (list #:tests? #f)) ; there are no tests + (propagated-inputs (list python-matplotlib python-numpy python-scipy)) + (native-inputs (list python-hatchling + python-ipykernel + python-toml)) + (home-page "https://aalto-electric-drives.github.io/motulator/") + (synopsis "Motor Drive Simulator in Python") + (description "This package includes simulation models for an induction +motor, a synchronous reluctance motor, and a permanent-magnet synchronous +motor. The motor models are simulated in the continuous-time domain while the +control algorithms run in discrete time. The default solver is the explicit +Runge-Kutta method of order 5(4) from @code{scipy.integrate.solve_ivp.}") + (license license:expat))) + (define-public cgns (package (name "cgns") @@ -3510,7 +3672,7 @@ perform various useful functions such as: (define-public libigl (package (name "libigl") - (version "2.3.0") + (version "2.4.0") (source (origin (method git-fetch) @@ -3520,90 +3682,162 @@ perform various useful functions such as: (file-name (git-file-name name version)) (sha256 (base32 - "004a22ifq2vibgkgvrlyihqimpsfizvq5l448204kwfg3lkycajj")))) + "0qlnpp8nxbahcky4d67dzn0ynbv3v037nbx1akq6h5rzhvkzq40x")))) (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") + (list #:configure-flags + #~(list "-DLIBIGL_USE_STATIC_LIBRARY=OFF" + "-DLIBIGL_BUILD_TESTS=ON" + "-DLIBIGL_BUILD_TUTORIALS=OFF" + "-DLIBIGL_INSTALL=ON" + "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" + (format #f "-DCatch2_DIR=~a/lib/cmake/catch2/" + #$(this-package-input "catch2")) + (format #f "-DSpectra_DIR=~a/share/pectra/cmake/" + #$(this-package-input "spectra")) + ;; 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_MATLAB=OFF" + "-DLIBIGL_MOSEK=OFF" + ;; XXX: GLFW tests are failing with SEGFAULT. See + ;; <https://github.com/libigl/libigl/issues/2313> + "-DLIBIGL_GLFW_TESTS=OFF") + #:build-type "Release" #:phases - (modify-phases %standard-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"))) + (copy-recursively (assoc-ref %build-inputs "libigl-glad") + "external/glad") + (copy-recursively (assoc-ref %build-inputs "libigl-test-data") + "external/test-data") + (copy-recursively (assoc-ref %build-inputs "libigl-comiso") + "external/comiso") + (copy-recursively (assoc-ref %build-inputs "libigl-tetgen") + "external/tetgen") + (copy-recursively (assoc-ref %build-inputs "libigl-predicates") + "external/predicates") + (copy-recursively (assoc-ref %build-inputs "imguizmo") + "external/imguizmo") + (copy-recursively (assoc-ref %build-inputs "eigen") + "external/eigen"))) (add-after 'unpack-external 'patch-cmake - (lambda _ + (lambda* (#:key inputs #:allow-other-keys) + (define (source-dir library-name) + (format #f "SOURCE_DIR \"~a\"" + (assoc-ref %build-inputs library-name))) + (define (fix-external-library cmake source) + (substitute* (format #f "cmake/recipes/external/~a.cmake" + cmake) + (("GIT_REPOSITORY.*") (source-dir source)) + (("GIT_TAG.*") ""))) ;; 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")))))))) + (fix-external-library "comiso" "libigl-comiso") + (fix-external-library "tetgen" "libigl-tetgen") + (fix-external-library "triangle" "libigl-triangle") + (fix-external-library "predicates" "libigl-predicates") + (fix-external-library "glad" "libigl-glad") + (fix-external-library "libigl_tests_data" "libigl-test-data") + (fix-external-library "stb" "libigl-stb") + (substitute* "cmake/recipes/external/imguizmo.cmake" + (("if\\(TARGET imguizmo::imguizmo\\)") + "if(true)") + (("target_link_libraries.*") + (format #f "include_directories(~a/include/imgui/)" + (assoc-ref inputs "imgui")))) + + (substitute* "cmake/igl/igl_add_test.cmake" + (("include\\(\".*/contrib/Catch.cmake\"\\)") + (format #f + "include(\"~a/lib/cmake/Catch2/Catch.cmake\")" + (assoc-ref inputs "catch2")))) + (substitute* "cmake/recipes/external/cgal.cmake" + (("FetchContent_Populate\\(cgal\\)") + "find_package(CGAL CONFIG COMPONENTS Core)\nreturn()")) + (substitute* "cmake/recipes/external/eigen.cmake" + (("FetchContent_Populate\\(eigen\\)") + "find_package(Eigen3 CONFIG REQUIRED)\nreturn()")) + (substitute* "cmake/recipes/external/catch2.cmake" + (("message.*") + "find_package(Catch2 CONFIG)\nreturn()")) + (substitute* "cmake/recipes/external/libigl_imgui_fonts.cmake" + (("if\\(TARGET igl::imgui_fonts\\)") + "if(true)")) + (substitute* "cmake/recipes/external/tinyxml2.cmake" + (("FetchContent_Populate\\(tinyxml2\\)") + "find_package(tinyxml2 CONFIG REQUIRED)\nreturn()")) + (substitute* "cmake/recipes/external/embree.cmake" + (("FetchContent_MakeAvailable\\(embree\\)") + (string-join (list "find_package(Embree 3 CONFIG)" + "add_library(embree::embree ALIAS embree)" + "return()") + "\n"))) + (substitute* "cmake/recipes/external/glfw.cmake" + (("FetchContent_MakeAvailable\\(glfw\\)") + (string-join + (list "find_package(glfw3 CONFIG REQUIRED)" + "add_library(glfw::glfw ALIAS glfw)" + "return()") + "\n"))) + (substitute* "cmake/recipes/external/imgui.cmake" + (("FetchContent_MakeAvailable\\(imgui\\)") + "return()")))) + + (add-after 'unpack-external 'fix-assertions + (lambda _ + ;; Current Tetgen version has a bug. + (substitute* "include/igl/copyleft/tetgen/tetgenio_to_tetmesh.cpp" + (("assert\\(out.numberofpoints == out.numberofpointmarkers\\);") + ";")) + ;; CGAL has a bug in assertion as well. + (substitute* "include/igl/copyleft/cgal/trim_with_solid.cpp" + (("assert\\(I.size\\(\\) == Vr.rows\\(\\)\\);") + ";")))) + + ;; XXX: Install modules as CMake fails to install them. + (add-after 'install 'install-includes + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (include-dir (string-append out "/include/igl/"))) + (for-each (lambda (module) + (copy-recursively (format #f + "../source/include/igl/~a" + module) + (format #f + "~a/~a" + include-dir + module))) + (list "copyleft/cgal" + "copyleft/opengl2" + "copyleft/tetgen" + "embree" + "opengl" + "predicates" + "xml")))))))) + + (native-inputs (list catch2)) ;; 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" ,catch2) ("cgal" ,cgal) ("eigen" ,eigen) ("embree" ,embree) - ("glfw" ,glfw) + ("glfw" ,glfw-3.4) ("gmp" ,gmp) ("mesa" ,mesa) ("mpfr" ,mpfr) ("tbb" ,tbb) ("tinyxml2" ,tinyxml2) + ("openblas" ,openblas) + ("imgui" ,imgui) + ("spectra" ,spectra) ;; When updating this package, update commit fields below according to ;; the hashes listed in "cmake/LibiglDownloadExternal.cmake". ("libigl-test-data" @@ -3613,15 +3847,20 @@ perform various useful functions such as: (url "https://github.com/libigl/libigl-tests-data") (commit "19cedf96d70702d8b3a83eb27934780c542356fe"))) (file-name (git-file-name "libigl-test-data" version)) - (sha256 (base32 "1wxglrxw74xw4a4jmmjpm8719f3mnlbxbwygjb4ddfixxxyya4i2")))) + (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")))) + ,(let* ((commit "ead2d21fd1d9f566d8f9a9ce99ddf85829258c7a") + (revision "0") + (version (git-version "0.0.0" revision commit))) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/libigl/libigl-glad") + (commit commit))) + (file-name (git-file-name "libigl-glad" version)) + (sha256 + (base32 "079fd5yrbd713nq7slhhgq79wns85pc564ydlkjl9gf43d3220ay"))))) ("libigl-stb" ,(origin (method git-fetch) @@ -3629,34 +3868,124 @@ perform various useful functions such as: (url "https://github.com/libigl/libigl-stb.git") (commit "cd0fa3fcd90325c83be4d697b00214e029f94ca3"))) (file-name (git-file-name "libigl-stb" version)) - (sha256 (base32 "0wwlb370z40y63ic3ny6q7lxibhixg2k1pjdkl4ymzv79zld28kj")))) + (sha256 + (base32 "0wwlb370z40y63ic3ny6q7lxibhixg2k1pjdkl4ymzv79zld28kj")))) ("libigl-predicates" + ,(let* ((commit "50c2149e7a520d13cd10e9aeff698bd68edd5a4f") + (revision "0") + (version (git-version "0.0.0" revision commit))) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/libigl/libigl-predicates.git") + (commit commit))) + (file-name (git-file-name "libigl-predicates" version)) + (sha256 + (base32 "0yiqhzry2qhb1p0v9sldlnpqsn4y8cln8r6y08lafkc9kc4qy8jz"))))) + ;; TODO: Package tetgen separately from <http://www.tetgen.org> + ("libigl-tetgen" + ,(let* ((commit "4f3bfba3997f20aa1f96cfaff604313a8c2c85b6") + (revision "0") + (version (git-version "0.0.0" revision commit))) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/libigl/tetgen.git") + (commit commit))) + (file-name (git-file-name "libigl-tetgen" version)) + (sha256 + (base32 "1k724syssw37py7kwmibk3sfwkkgyjyy7qkijnhn6rjm91g8qxsg"))))) + ("libigl-comiso" + ,(let* ((commit "562efe333edc8e649dc101469614f43378b1eb55") + (revision "0") + (version (git-version "0.0.0" revision commit))) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/libigl/comiso.git") + (commit commit))) + (file-name (git-file-name "libigl-comiso" version)) + (sha256 + (base32 "048zryh9ydd1dqwzs14vj7r3fd6yyq6n4zl6d1b0yb1iwrqfy6ba"))))) + ("libigl-triangle" ,(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" + (url "https://github.com/libigl/triangle.git") + (commit "6bbd92c7ddd6c803c403e005e1132eadb38fbe68"))) + (file-name (git-file-name "libigl-triangle" version)) + (sha256 + (base32 "0d35mfqwdk99xn1lpjzz9w5axq016r6xy5vr00lb4mvb05limxl3")))) + + ;; XXX: This is a source-only library which is currently required only + ;; for libigl. + + ("imguizmo" ,(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")))))) + (url "https://github.com/CedricGuillemet/ImGuizmo") + (commit "1.83"))) + (file-name (git-file-name "imguizmo" version)) + (sha256 + (base32 "14ywf96nvxf5c081pwypyzjwx9vyq78glbzinc81558v1sxiy2v0")))))) (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)))) +(define-public prusa-libbgcode + ;; Use the latest commit since there are no proper releases nor tags, see + ;; <https://github.com/prusa3d/libbgcode/issues/31>. + (let ((commit "8ae75bd0eea622f0e34cae311b3bd065b55eae9b") + (revision "0")) + (package + (name "prusa-libbgcode") + (version (git-version "0.0.0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/prusa3d/libbgcode") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0fjx2ijz9zqpqs486lcrrrhqvmfzrpb8j6v57l0jiynavwv3kznw")))) + (native-inputs (list catch2)) + (propagated-inputs (list zlib boost heatshrink)) + (build-system cmake-build-system) + (home-page "https://github.com/prusa3d/libbgcode") + (synopsis "Prusa Block and Binary G-code reader/writer/converter") + (description + "Binary G-code is a new standard for encoding and compressing ASCII G-code +files. G-code files are easy to read and interpret, but their downside is that the +data is not saved efficiently, and the file size is often very large. Compression of +the file is problematic because the printers usually run on limited hardware and they +may not have enough memory and/or CPU power to decompress it. + +Block and Binary G-Code is a new G-code file format featuring the following +improvements over the legacy G-code: +@itemize +@item Block structure with distinct blocks for metadata vs. G-code. +@item Faster navigation. +@item Coding and compression for smaller file size. +@item Checksum for data validity. +@item Extensibility through new (custom) blocks. For example, a file signature block +may be welcome by corporate customers. +@end itemize + +The binary G-code format is flexible and the encoding and compression of individual +blocks is variable. @code{libbgcode} library contains the routines to convert ASCII +G-codes to binary and vice versa.") + ;; See + ;; <https://github.com/prusa3d/libbgcode/blob/main/pyproject.toml> + (license license:agpl3+)))) + (define-public prusa-slicer (package (name "prusa-slicer") - (version "2.5.2") + (version "2.7.4") (source (origin (method git-fetch) @@ -3665,13 +3994,11 @@ visualization, matrix manipulation.") (url "https://github.com/prusa3d/PrusaSlicer") (commit (string-append "version_" version)))) (file-name (git-file-name name version)) - (sha256 (base32 "02qcrw3fa0d8ldbp73hp14l1qxbp3f4608j4csc07ny00ra42151")) - (patches (search-patches "prusa-slicer-boost-fixes.patch" - "prusa-slicer-fix-tests.patch" - "prusa-slicer-with-cereal-1.3.1.patch")) + (sha256 (base32 "0s1cfvhfilyv0y98asr61c6rwlgyr1hf5v5hg8q9zwmzm2bkcql3")) + (patches (search-patches "prusa-slicer-fix-tests.patch")) (modules '((guix build utils))) (snippet - '(begin + `(begin ;; Prusa slicer bundles a lot of dependencies in src/ directory. ;; Most of them contain prusa-specific modifications (e.g. avrdude), ;; but others do not. Here we replace the latter with Guix packages. @@ -3679,10 +4006,12 @@ visualization, matrix manipulation.") (delete-file-recursively "src/hidapi") (delete-file-recursively "src/eigen") (delete-file-recursively "src/libigl/igl") + (substitute* "CMakeLists.txt" + (("add_library\\(libexpat INTERFACE\\)") + "")) + (substitute* "src/libigl/CMakeLists.txt" + (("target_link_libraries\\(libigl INTERFACE igl::core\\)") "")) (substitute* "src/CMakeLists.txt" - (("add_subdirectory\\(libigl\\)" all) - (string-append - all "\ninclude_directories(libigl INTERFACE libigl::core)")) (("add_subdirectory\\(hidapi\\)") "pkg_check_modules(HIDAPI REQUIRED hidapi-hidraw)") (("include_directories\\(hidapi/include\\)") @@ -3695,13 +4024,26 @@ visualization, matrix manipulation.") (("\\bhidapi\\b") "${HIDAPI_LIBRARIES}")))))) (build-system cmake-build-system) (arguments - `(#:configure-flags - '("-DSLIC3R_FHS=1" ;; Use The Filesystem Hierarchy Standard. - "-DSLIC3R_GTK=3" ;; Use GTK+ - ;; Use wxWidgets 3.0.x.x to prevent GUI crashes when adding support enforcers. - "-DSLIC3R_WX_STABLE=1"))) + (list #:configure-flags + #~(list "-DSLIC3R_FHS=1" ;; Use The Filesystem Hierarchy Standard. + "-DSLIC3R_GTK=3" ;; Use GTK+ + ;; Use wxWidgets 3.0.x.x to prevent GUI crashes when adding support enforcers. + "-DSLIC3R_WX_STABLE=1" + (format #f "-Dlibigl_DIR=~a" + (search-input-directory %build-inputs + "lib/cmake/igl/")) + (format #f "-DCatch2_DIR=~a" + (search-input-directory %build-inputs + "lib/cmake/Catch2/"))) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'fix-include-paths + (lambda _ + (substitute* "tests/libslic3r/test_quadric_edge_collapse.cpp" + (("#include <libigl/igl/qslim.h>") + "#include <igl/qslim.h>"))))))) (native-inputs - (list pkg-config)) + (list pkg-config catch2)) (inputs (list boost cereal @@ -3709,11 +4051,13 @@ visualization, matrix manipulation.") curl dbus eigen + eudev expat glew glib gmp gtk+ + heatshrink hidapi ilmbase libigl @@ -3721,15 +4065,17 @@ visualization, matrix manipulation.") libpng mesa mpfr + nanosvg nlopt opencascade-occt openvdb pango + prusa-libbgcode + ;; XXX: Using Prusa wxWidgets fork as PrusaSlicer segfaults when compiled + ;; with regular wxwidgets. + prusa-wxwidgets + qhull tbb - eudev - ;; prusa-slicer 2.5 segfaults on startup with wxwidgets 3.2 - ;; See https://github.com/prusa3d/PrusaSlicer/issues/8299 - wxwidgets-3.0 zlib)) (home-page "https://www.prusa3d.com/prusaslicer/") (synopsis "G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)") |