[PATCH] gnu: Add asli.

  • Done
  • quality assurance status badge
Details
4 participants
  • Ludovic Courtès
  • Ludovic Courtès
  • Maxime Devos
  • Paul A. Patience
Owner
unassigned
Submitted by
Paul A. Patience
Severity
normal
P
P
Paul A. Patience wrote on 19 Jul 2022 09:59
(address . guix-patches@gnu.org)(name . Paul A. Patience)(address . paul@apatience.com)
20220719075934.67481-1-paul@apatience.com
* gnu/packages/graphics.scm (asli): New variable.
---
gnu/packages/graphics.scm | 67 +++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)

Toggle diff (82 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index c193be1efb..bae1ba1f99 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -31,6 +31,7 @@
;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2022 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2022 Tobias Kortkamp <tobias.kortkamp@gmail.com>
+;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -2120,3 +2121,69 @@ (define-public azpainter
@end itemize
")
(license license:gpl3+)))
+
+(define-public asli
+ (package
+ (name "asli")
+ (version "0.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/tpms-lattice/ASLI")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "02hwdavpsy3vmivd6prp03jn004ykrl11lbkvksy5i2zm38zbknr"))
+ (modules '((guix build utils)))
+ (snippet
+ ;; Remove bundled libraries except ALGLIB, TetGen and yaml-cpp, which
+ ;; are statically linked, and KU Leuven's mTT, which is an obscure
+ ;; (i.e., unfindable by searching online for “mTT KU Leuven”), BSD-3
+ ;; licensed, header-only library.
+ ;;
+ ;; AdaptTools and mmg are missing from Guix, but anyway they are
+ ;; unused because mmg support is disabled (-DMMG_MESH=OFF).
+ #~(begin
+ (delete-file-recursively "libs/AdaptTools")
+ (delete-file-recursively "libs/CGAL")
+ (delete-file-recursively "libs/eigen")
+ (delete-file-recursively "libs/mmg")))))
+ (build-system cmake-build-system)
+ (native-inputs
+ ;; Header-only library
+ (list cgal))
+ (inputs
+ (list boost
+ eigen
+ gmp
+ mpfr
+ tbb-2020))
+ (arguments
+ (list #:tests? #f ; No tests
+ #:configure-flags
+ #~(list "-DCGAL_ACTIVATE_CONCURRENT_MESH_3=ON"
+ "-DMMG_MESH=OFF" ; Build fails when enabled (the default)
+ (string-append "-DEIGEN3_INCLUDE_DIR="
+ #$(this-package-input "eigen")
+ "/include/eigen3"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'install ; No install phase
+ (lambda _
+ (with-directory-excursion "../source/bin"
+ (install-file "ASLI" (string-append #$output "/bin"))
+ ;; The manual is included in the repository.
+ ;; Building it requires -DASLI_DOC=ON, but this is marked
+ ;; as unsupported (presumably for users).
+ (install-file "docs/ASLI [User Manual].pdf"
+ (string-append #$output "/share/doc/"
+ #$name "-" #$version))))))))
+ (home-page "http://www.biomech.ulg.ac.be/ASLI/")
+ (synopsis "Create lattice infills with varying unit cell type, size and feature")
+ (description "ASLI (A Simple Lattice Infiller) is a command-line tool that
+allows users to fill any 3D geometry with a functionally graded lattice. The
+lattice infill is constructed out of unit cells, described by implicit
+functions, whose type, size and feature can be varied locally to obtain the
+desired local properties.")
+ (license license:agpl3+)))
--
2.37.0
P
P
Paul A. Patience wrote on 19 Jul 2022 10:10
(address . 56638@debbugs.gnu.org)
8735exfrpj.fsf@apatience.com
Hi Ludovic,

ASLI optionally depends on mmg, which I discovered a Guix package for in
the Guix HPC project [1], and for which you seem to be the point of
contact.
I'd like to add mmg to Guix, first to eventually be able to drop ASLI's
bundled version (although I can't get ASLI to build with mmg yet) and
second because I have looked into mmg recently and may want to use it
myself.

Is it just a question of moving the package over to Guix verbatim?
I tried that and it compiled correctly.

Thanks,
Paul

L
L
Ludovic Courtès wrote on 19 Jul 2022 16:21
(name . Paul A. Patience)(address . paul@apatience.com)(address . 56638@debbugs.gnu.org)
87cze1rxmo.fsf@inria.fr
Hello,

"Paul A. Patience" <paul@apatience.com> skribis:

Toggle quote (4 lines)
> ASLI optionally depends on mmg, which I discovered a Guix package for in
> the Guix HPC project [1], and for which you seem to be the point of
> contact.

Right!

Toggle quote (5 lines)
> I'd like to add mmg to Guix, first to eventually be able to drop ASLI's
> bundled version (although I can't get ASLI to build with mmg yet) and
> second because I have looked into mmg recently and may want to use it
> myself.

Makes sense to me.

Toggle quote (3 lines)
> Is it just a question of moving the package over to Guix verbatim?
> I tried that and it compiled correctly.

Sure, I guess you can copy it verbatim, tweaking the description
(removing “open source”, fixing the first sentence.)

TIA!

Ludo’.
M
M
Maxime Devos wrote on 19 Jul 2022 16:32
[bug#56638] [PATCH] gnu: Add asli.
32bcb714d63fcc1a7258d28d1a4c7d8f3fcc3995.camel@telenet.be
Paul A. Patience schreef op di 19-07-2022 om 07:59 [+0000]:
Toggle quote (4 lines)
> +    (native-inputs
> +     ;; Header-only library
> +     (list cgal))

Being header-only makes no difference w.r.t. cross-compilation (and
hence, inputs/native-inputs). For examples, headers can potentially
contain architecture-specific code (generated at the compile time of
the cgal library). As such, this may need to be in 'inputs' instead of
'native-inputs'.

Another reason: this should be in 'inputs', otherwise when cross-
compiling it will end in in (IIUC) C_INCLUDE_PATH instead of
CROSS_C_INLUDE_PATH, whereas the cross-compiler will look in
CROSS_C_INCLUDE_PATH and not C_INCLUDE_PATH.

Greetings,
Maxime.
M
M
Maxime Devos wrote on 19 Jul 2022 16:34
9c44da2e58b265ed990d51d29989e611f1ef51f5.camel@telenet.be
Paul A. Patience schreef op di 19-07-2022 om 07:59 [+0000]:
Toggle quote (4 lines)
> +        ;; Remove bundled libraries except ALGLIB, TetGen and yaml-
> cpp, which
> +        ;; are statically linked,

What does it matter that they are statically linked w.r.t. bundling?
Those seem orthogonal concerns to me. We can easily define a static
variant of alglib etc, or alternatively (probably more difficult but
feasible) tweak the build process of asli to look for shared libraries
instead of static libraries.

Greetings,
Maxime.
P
P
Paul A. Patience wrote on 24 Jul 2022 14:02
[PATCH v2 0/2] gnu: Add asli.
(address . 56638@debbugs.gnu.org)(name . Paul A. Patience)(address . paul@apatience.com)
20220724120228.54052-1-paul@apatience.com
I've fixed the issues raised by Maxime Devos and also added the mmg package
(and fixed the build of ASLI with mmg).

The mmg package originally began as Guix HPC's mmg package [1], but I ended up
completely rewriting it (well, except for the source section).


Paul A. Patience (2):
gnu: Add mmg.
gnu: Add asli.

gnu/local.mk | 1 +
gnu/packages/graphics.scm | 178 ++++++++++++++++++
.../patches/asli-use-system-libs.patch | 70 +++++++
3 files changed, 249 insertions(+)
create mode 100644 gnu/packages/patches/asli-use-system-libs.patch

--
2.37.0
P
P
Paul A. Patience wrote on 24 Jul 2022 14:02
[PATCH v2 1/2] gnu: Add mmg.
(address . 56638@debbugs.gnu.org)(name . Paul A. Patience)(address . paul@apatience.com)
20220724120228.54052-2-paul@apatience.com
* gnu/packages/graphics.scm (mmg): New variable.
---
gnu/packages/graphics.scm | 104 ++++++++++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)

Toggle diff (119 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index c193be1efb..7417fbe690 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -31,6 +31,7 @@
;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2022 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2022 Tobias Kortkamp <tobias.kortkamp@gmail.com>
+;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -2120,3 +2121,106 @@ (define-public azpainter
@end itemize
")
(license license:gpl3+)))
+
+(define-public mmg
+ (package
+ (name "mmg")
+ (version "5.6.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/MmgTools/mmg")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "173biz5skbwg27i5w6layg7mydjzv3rmi1ywhra4rx9rjf5c0cc5"))))
+ (build-system cmake-build-system)
+ (outputs '("out" "lib" "doc"))
+ (arguments
+ (list #:configure-flags
+ #~(list (string-append "-DCMAKE_INSTALL_PREFIX=" #$output:lib)
+ (string-append "-DCMAKE_INSTALL_RPATH=" #$output:lib "/lib")
+ ;; The build doesn't honor -DCMAKE_INSTALL_BINDIR, hence
+ ;; the adjust-bindir phase.
+ ;;(string-append "-DCMAKE_INSTALL_BINDIR=" #$output "/bin")
+ "-DBUILD_SHARED_LIBS=ON"
+ "-DBUILD_TESTING=ON"
+ ;; The longer tests are for continuous integration and
+ ;; depend on input data which must be downloaded.
+ "-DONLY_VERY_SHORT_TESTS=ON"
+ ;; TODO: Add Elas (from
+ ;; https://github.com/ISCDtoolbox/LinearElasticity).
+ "-DUSE_ELAS=OFF"
+ ;; TODO: Figure out how to add VTK to inputs without
+ ;; causing linking errors in ASLI of the form:
+ ;;
+ ;; ld: /gnu/store/…-vtk-9.0.1/lib/libvtkWrappingPythonCore-9.0.so.1:
+ ;; undefined reference to `PyUnicode_InternFromString'
+ ;;
+ ;; Also, adding VTK to inputs requires adding these as well:
+ ;;
+ ;; double-conversion eigen expat freetype gl2ps glew hdf5
+ ;; jsoncpp libjpeg-turbo libpng libtheora libtiff libx11
+ ;; libxml2 lz4 netcdf proj python sqlite zlib
+ "-DUSE_VTK=OFF")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'build 'build-doc
+ (lambda _
+ ;; Fontconfig wants to write to a cache directory.
+ (setenv "HOME" "/tmp")
+ (invoke "make" "doc")))
+ (add-after 'install 'install-doc
+ (lambda _
+ (copy-recursively
+ "../source/doc/man" (string-append #$output
+ "/share/man/man1"))
+ (copy-recursively
+ "doc" (string-append #$output:doc "/share/doc/"
+ #$name "-" #$version))))
+ (add-after 'install 'adjust-bindir
+ (lambda _
+ (let ((src (string-append #$output:lib "/bin"))
+ (dst (string-append #$output "/bin")))
+ (copy-recursively src dst)
+ (delete-file-recursively src))))
+ ;; Suffixing program names with build information, i.e.,
+ ;; optimization flags and whether debug symbols were generated,
+ ;; is unusual and fragilizes scripts calling these programs.
+ (add-after 'adjust-bindir 'fix-program-names
+ (lambda _
+ (with-directory-excursion (string-append #$output "/bin")
+ (rename-file "mmg2d_O3d" "mmg2d")
+ (rename-file "mmg3d_O3d" "mmg3d")
+ (rename-file "mmgs_O3d" "mmgs")))))))
+ (native-inputs
+ ;; For the documentation
+ (list doxygen graphviz
+ ;; TODO: Fix failing LaTeX invocation (which results in equations
+ ;; being inserted literally into PNGs rather than being typeset).
+ ;;texlive-tiny
+ ))
+ (inputs
+ (list scotch))
+ (home-page "http://www.mmgtools.org/")
+ (synopsis "Surface and volume remeshers")
+ (description "Mmg is a collection of applications and libraries for
+bidimensional and tridimensional surface and volume remeshing. It consists
+of:
+
+@itemize
+@item the @code{mmg2d} application and library: mesh generation from a set of
+edges, adaptation and optimization of a bidimensional triangulation and
+isovalue discretization;
+
+@item the @code{mmgs} application and library: adaptation and optimization of
+a surface triangulation and isovalue discretization;
+
+@item the @code{mmg3d} application and library: adaptation and optimization of
+a tetrahedral mesh, isovalue discretization and Lagrangian movement;
+
+@item the @code{mmg} library gathering the @code{mmg2d}, @code{mmgs} and
+@code{mmg3d} libraries.
+@end itemize")
+ (license license:lgpl3+)))
--
2.37.0
P
P
Paul A. Patience wrote on 24 Jul 2022 14:02
[PATCH v2 2/2] gnu: Add asli.
(address . 56638@debbugs.gnu.org)(name . Paul A. Patience)(address . paul@apatience.com)
20220724120228.54052-3-paul@apatience.com
* gnu/packages/graphics.scm (asli): New variable.
* gnu/packages/patches/asli-use-system-libs.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register patch.
---
gnu/local.mk | 1 +
gnu/packages/graphics.scm | 74 +++++++++++++++++++
.../patches/asli-use-system-libs.patch | 70 ++++++++++++++++++
3 files changed, 145 insertions(+)
create mode 100644 gnu/packages/patches/asli-use-system-libs.patch

Toggle diff (170 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 412d512775..75ca3e6a29 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -858,6 +858,7 @@ dist_patch_DATA = \
%D%/packages/patches/antlr3-3_3-fix-java8-compilation.patch \
%D%/packages/patches/apr-skip-getservbyname-test.patch \
%D%/packages/patches/ark-skip-xar-test.patch \
+ %D%/packages/patches/asli-use-system-libs.patch \
%D%/packages/patches/aspell-default-dict-dir.patch \
%D%/packages/patches/ath9k-htc-firmware-binutils.patch \
%D%/packages/patches/ath9k-htc-firmware-gcc.patch \
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 7417fbe690..d3a11824b4 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -2224,3 +2224,77 @@ (define-public mmg
@code{mmg3d} libraries.
@end itemize")
(license license:lgpl3+)))
+
+(define-public asli
+ (package
+ (name "asli")
+ (version "0.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/tpms-lattice/ASLI")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "02hwdavpsy3vmivd6prp03jn004ykrl11lbkvksy5i2zm38zbknr"))
+ (patches (search-patches "asli-use-system-libs.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ ;; Remove bundled libraries except (the ones missing from Guix and)
+ ;; KU Leuven's mTT, which is an obscure (i.e., unfindable by searching
+ ;; online for “mTT KU Leuven”), BSD-3 licensed, header-only library.
+ #~(begin
+ ;;(delete-file-recursively "libs/AdaptTools") ; Missing from Guix
+ (delete-file-recursively "libs/CGAL")
+ ;;(delete-file-recursively "libs/alglib") ; Missing from Guix
+ (delete-file-recursively "libs/eigen")
+ (delete-file-recursively "libs/mmg")
+ ;;(delete-file-recursively "libs/tetgen") ; Missing from Guix
+ (delete-file-recursively "libs/yaml")))))
+ (build-system cmake-build-system)
+ (inputs
+ (list boost
+ cgal
+ eigen
+ gmp
+ `(,mmg "lib")
+ mpfr
+ tbb-2020
+ yaml-cpp))
+ (arguments
+ (list #:tests? #f ; No tests
+ #:configure-flags
+ #~(list "-DCGAL_ACTIVATE_CONCURRENT_MESH_3=ON"
+ (string-append "-DEIGEN3_INCLUDE_DIR="
+ #$(this-package-input "eigen")
+ "/include/eigen3")
+ (string-append "-DMMG_INCLUDE_DIR="
+ (ungexp (this-package-input "mmg") "lib")
+ "/include")
+ (string-append "-DMMG_LIBRARY_DIR="
+ (ungexp (this-package-input "mmg") "lib")
+ "/lib"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'install ; No install phase
+ (lambda _
+ (with-directory-excursion "../source/bin"
+ (install-file "ASLI" (string-append #$output "/bin"))
+ ;; The manual is included in the repository.
+ ;; Building it requires -DASLI_DOC=ON, but this is marked
+ ;; as unsupported (presumably for users).
+ ;; Besides, some of the LaTeX packages it uses are
+ ;; missing from Guix, for example emptypage, fvextra and
+ ;; menukeys.
+ (install-file "docs/ASLI [User Manual].pdf"
+ (string-append #$output "/share/doc/"
+ #$name "-" #$version))))))))
+ (home-page "http://www.biomech.ulg.ac.be/ASLI/")
+ (synopsis "Create lattice infills with varying unit cell type, size and feature")
+ (description "ASLI (A Simple Lattice Infiller) is a command-line tool that
+allows users to fill any 3D geometry with a functionally graded lattice. The
+lattice infill is constructed out of unit cells, described by implicit
+functions, whose type, size and feature can be varied locally to obtain the
+desired local properties.")
+ (license license:agpl3+)))
diff --git a/gnu/packages/patches/asli-use-system-libs.patch b/gnu/packages/patches/asli-use-system-libs.patch
new file mode 100644
index 0000000000..d8234fd608
--- /dev/null
+++ b/gnu/packages/patches/asli-use-system-libs.patch
@@ -0,0 +1,70 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b11c5ba..702423e 100755
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -122,28 +122,8 @@ if(MMG_MESH)
+ add_definitions(-DMMG_MESH)
+
+ # MMG
+- set(MMG_PREFIX mmg3d)
+- set(MMG_PREFIX_DIR ${CMAKE_CURRENT_BINARY_DIR}/${MMG_PREFIX})
+- set(MMG_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${MMG_PREFIX})
+- ExternalProject_Add(${MMG_PREFIX}
+- PREFIX ${MMG_PREFIX_DIR}
+- SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/mmg
+-
+- BUILD_ALWAYS OFF
+- INSTALL_DIR ${MMG_INSTALL_DIR}
+-
+- CMAKE_ARGS(-DCMAKE_BUILD_TYPE=Release -DBUILD=MMG3D -DLIBMMG3D_STATIC=ON
+- -DLIBMMG3D_SHARED=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>)
+-
+- BUILD_COMMAND make
+- INSTALL_COMMAND make install
+- )
+- set(MMG3D_INCLUDE_DIRS "${MMG_INSTALL_DIR}/include")
+- set(MMG3D_LIBRARIES "${MMG_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${MMG_PREFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
+-
+- include_directories(${MMG3D_INCLUDE_DIRS})
+- #add_library(MMG3D STATIC IMPORTED)
+- #set_target_properties(MMG3D PROPERTIES IMPORTED_LOCATION "${MMG3D_LIBRARIES}")
++ include_directories(${MMG_INCLUDE_DIR})
++ set(MMG3D_LIBRARIES ${MMG_LIBRARY_DIR}/libmmg3d.so)
+
+ # MshMet
+ set(MSHMET_PREFIX mshmet)
+@@ -192,14 +172,8 @@ target_include_directories(tet PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libs/tetgen)
+ target_compile_definitions(tet PUBLIC TETLIBRARY) # -DTETLIBRARY: flag to compile tetgen as a library
+
+ # yaml
+-file(GLOB yaml_SRC CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/src/*.cpp) # Using file GLOB is not recomended!
+-add_library(yaml STATIC)
+-target_include_directories(yaml
+- PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/include
+- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/src
+-)
+-target_sources(yaml PRIVATE ${yaml_SRC})
+-set_target_properties(yaml PROPERTIES CXX_STANDARD 11)
++find_package(yaml-cpp REQUIRED)
++include_directories(${YAML_CPP_INCLUDE_DIRS})
+
+ # Compile options for debuging
+ if(CMAKE_BUILD_TYPE MATCHES Debug)
+@@ -259,7 +233,7 @@ if(MARCH_NATIVE)
+ endif()
+
+ # Create entries for C++ files in "ASLI" routine
+-target_link_libraries(ASLI PUBLIC alg tet yaml)
++target_link_libraries(ASLI PUBLIC alg tet ${YAML_CPP_LIBRARIES})
+ if(NOT MSVC)
+ target_link_libraries(ASLI PUBLIC stdc++fs)
+ endif()
+@@ -272,7 +246,7 @@ if(CGAL_MESH)
+ endif()
+
+ if(MMG_MESH)
+- add_dependencies(ASLI ${MMG_PREFIX} ${MSHMET_PREFIX})
++ add_dependencies(ASLI ${MSHMET_PREFIX})
+ target_link_libraries(ASLI PUBLIC ${MMG3D_LIBRARIES} ${MSHMET_LIBRARIES})
+ if(SCOTCH_FOUND)
+ target_link_libraries(ASLI PUBLIC ${SCOTCH_LIBRARIES} scotch)
--
2.37.0
L
L
Ludovic Courtès wrote on 4 Aug 2022 23:40
Re: bug#56638: [PATCH] gnu: Add asli.
(name . Paul A. Patience)(address . paul@apatience.com)(address . 56638@debbugs.gnu.org)
871qtvlmaj.fsf_-_@gnu.org
Hi Paul,

"Paul A. Patience" <paul@apatience.com> skribis:

Toggle quote (4 lines)
> * gnu/packages/graphics.scm (asli): New variable.
> * gnu/packages/patches/asli-use-system-libs.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Register patch.

The source derivation fails to build for me:

Toggle snippet (8 lines)
File CMakeLists.txt is read-only; trying to patch anyway
patching file CMakeLists.txt
Hunk #2 FAILED at 172.
Hunk #3 succeeded at 240 (offset 1 line).
Hunk #4 succeeded at 253 (offset 1 line).
1 out of 4 hunks FAILED -- saving rejects to file CMakeLists.txt.rej

Toggle quote (9 lines)
> diff --git a/gnu/packages/patches/asli-use-system-libs.patch b/gnu/packages/patches/asli-use-system-libs.patch
> new file mode 100644
> index 0000000000..d8234fd608
> --- /dev/null
> +++ b/gnu/packages/patches/asli-use-system-libs.patch
> @@ -0,0 +1,70 @@
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index b11c5ba..702423e 100755

Also, as suggested by ‘guix lint’, please add a comment at the top
stating what this does and what the upstream status is (if it’s been
submitted), at least something like:

Tweak build system to use system dependencies instead of those that
are bundled.

Could you please send an updated patch?

Thanks!

Ludo’.
L
L
Ludovic Courtès wrote on 29 Aug 2022 23:21
(name . Paul A. Patience)(address . paul@apatience.com)(address . 56638@debbugs.gnu.org)
87czci691b.fsf_-_@gnu.org
Hi,

"Paul A. Patience" <paul@apatience.com> skribis:

Toggle quote (2 lines)
> * gnu/packages/graphics.scm (mmg): New variable.

Applied this one for now.

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 29 Aug 2022 23:21
(name . Paul A. Patience)(address . paul@apatience.com)(address . 56638@debbugs.gnu.org)
877d2q6908.fsf_-_@gnu.org
Hi Paul,

Did you have a chance to look into this?

Thanks in advance,
Ludo’.

Ludovic Courtès <ludo@gnu.org> skribis:

Toggle quote (38 lines)
> Hi Paul,
>
> "Paul A. Patience" <paul@apatience.com> skribis:
>
>> * gnu/packages/graphics.scm (asli): New variable.
>> * gnu/packages/patches/asli-use-system-libs.patch: New file.
>> * gnu/local.mk (dist_patch_DATA): Register patch.
>
> The source derivation fails to build for me:
>
> File CMakeLists.txt is read-only; trying to patch anyway
> patching file CMakeLists.txt
> Hunk #2 FAILED at 172.
> Hunk #3 succeeded at 240 (offset 1 line).
> Hunk #4 succeeded at 253 (offset 1 line).
> 1 out of 4 hunks FAILED -- saving rejects to file CMakeLists.txt.rej
>
>> diff --git a/gnu/packages/patches/asli-use-system-libs.patch b/gnu/packages/patches/asli-use-system-libs.patch
>> new file mode 100644
>> index 0000000000..d8234fd608
>> --- /dev/null
>> +++ b/gnu/packages/patches/asli-use-system-libs.patch
>> @@ -0,0 +1,70 @@
>> +diff --git a/CMakeLists.txt b/CMakeLists.txt
>> +index b11c5ba..702423e 100755
>
> Also, as suggested by ‘guix lint’, please add a comment at the top
> stating what this does and what the upstream status is (if it’s been
> submitted), at least something like:
>
> Tweak build system to use system dependencies instead of those that
> are bundled.
>
> Could you please send an updated patch?
>
> Thanks!
>
> Ludo’.
P
P
Paul A. Patience wrote on 30 Aug 2022 14:01
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 56638@debbugs.gnu.org)
877d2q6jut.fsf@apatience.com
On 2022-08-29 17:21:43-04:00, Ludovic Courtès wrote:
Toggle quote (7 lines)
> Hi Paul,
>
> Did you have a chance to look into this?
>
> Thanks in advance,
> Ludo’.

I've been busy with other things, but I should be able to take a look
this week.

Best regards,
Paul
P
P
Paul A. Patience wrote on 2 Sep 2022 22:34
[PATCH v3] gnu: Add asli.
(address . 56638@debbugs.gnu.org)(name . Paul A. Patience)(address . paul@apatience.com)
20220902203420.17483-1-paul@apatience.com
* gnu/packages/graphics.scm (asli): New variable.
* gnu/packages/patches/asli-use-system-libs.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register patch.
---
Ludo,

I've added the header line to the patch file as you requested,
but I can't reproduce your failure to build the derivation.
The patch applies cleanly for me.
What command are you running so I can try to reproduce it?

Best regards,
Paul

gnu/local.mk | 1 +
gnu/packages/graphics.scm | 74 +++++++++++++++++++
.../patches/asli-use-system-libs.patch | 72 ++++++++++++++++++
3 files changed, 147 insertions(+)
create mode 100644 gnu/packages/patches/asli-use-system-libs.patch

Toggle diff (175 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 9d08fd5b28..5bee15ba1d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -867,6 +867,7 @@ dist_patch_DATA = \
%D%/packages/patches/aoflagger-use-system-provided-pybind11.patch \
%D%/packages/patches/apr-skip-getservbyname-test.patch \
%D%/packages/patches/ark-skip-xar-test.patch \
+ %D%/packages/patches/asli-use-system-libs.patch \
%D%/packages/patches/aspell-CVE-2019-25051.patch \
%D%/packages/patches/aspell-default-dict-dir.patch \
%D%/packages/patches/ath9k-htc-firmware-binutils.patch \
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index fdc72d5a8d..1200bb96c4 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -2295,6 +2295,80 @@ (define-public mmg
@end itemize")
(license license:lgpl3+)))

+(define-public asli
+ (package
+ (name "asli")
+ (version "0.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/tpms-lattice/ASLI")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "02hwdavpsy3vmivd6prp03jn004ykrl11lbkvksy5i2zm38zbknr"))
+ (patches (search-patches "asli-use-system-libs.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ ;; Remove bundled libraries except (the ones missing from Guix and)
+ ;; KU Leuven's mTT, which is an obscure (i.e., unfindable by searching
+ ;; online for “mTT KU Leuven”), BSD-3 licensed, header-only library.
+ #~(begin
+ ;;(delete-file-recursively "libs/AdaptTools") ; Missing from Guix
+ (delete-file-recursively "libs/CGAL")
+ ;;(delete-file-recursively "libs/alglib") ; Missing from Guix
+ (delete-file-recursively "libs/eigen")
+ (delete-file-recursively "libs/mmg")
+ ;;(delete-file-recursively "libs/tetgen") ; Missing from Guix
+ (delete-file-recursively "libs/yaml")))))
+ (build-system cmake-build-system)
+ (inputs
+ (list boost
+ cgal
+ eigen
+ gmp
+ `(,mmg "lib")
+ mpfr
+ tbb-2020
+ yaml-cpp))
+ (arguments
+ (list #:tests? #f ; No tests
+ #:configure-flags
+ #~(list "-DCGAL_ACTIVATE_CONCURRENT_MESH_3=ON"
+ (string-append "-DEIGEN3_INCLUDE_DIR="
+ #$(this-package-input "eigen")
+ "/include/eigen3")
+ (string-append "-DMMG_INCLUDE_DIR="
+ (ungexp (this-package-input "mmg") "lib")
+ "/include")
+ (string-append "-DMMG_LIBRARY_DIR="
+ (ungexp (this-package-input "mmg") "lib")
+ "/lib"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'install ; No install phase
+ (lambda _
+ (with-directory-excursion "../source/bin"
+ (install-file "ASLI" (string-append #$output "/bin"))
+ ;; The manual is included in the repository.
+ ;; Building it requires -DASLI_DOC=ON, but this is marked
+ ;; as unsupported (presumably for users).
+ ;; Besides, some of the LaTeX packages it uses are
+ ;; missing from Guix, for example emptypage, fvextra and
+ ;; menukeys.
+ (install-file "docs/ASLI [User Manual].pdf"
+ (string-append #$output "/share/doc/"
+ #$name "-" #$version))))))))
+ (home-page "http://www.biomech.ulg.ac.be/ASLI/")
+ (synopsis "Create lattice infills with varying unit cell type, size and feature")
+ (description "ASLI (A Simple Lattice Infiller) is a command-line tool that
+allows users to fill any 3D geometry with a functionally graded lattice. The
+lattice infill is constructed out of unit cells, described by implicit
+functions, whose type, size and feature can be varied locally to obtain the
+desired local properties.")
+ (license license:agpl3+)))
+
(define-public f3d
;; There have been many improvements since the last tagged version (1.2.1,
;; released in December 2021), including support for the Alembic file
diff --git a/gnu/packages/patches/asli-use-system-libs.patch b/gnu/packages/patches/asli-use-system-libs.patch
new file mode 100644
index 0000000000..6c4518e04e
--- /dev/null
+++ b/gnu/packages/patches/asli-use-system-libs.patch
@@ -0,0 +1,72 @@
+Adjust CMakeLists.txt to use system-provided mmg and yaml-cpp libraries.
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b11c5ba..702423e 100755
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -122,28 +122,8 @@ if(MMG_MESH)
+ add_definitions(-DMMG_MESH)
+
+ # MMG
+- set(MMG_PREFIX mmg3d)
+- set(MMG_PREFIX_DIR ${CMAKE_CURRENT_BINARY_DIR}/${MMG_PREFIX})
+- set(MMG_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${MMG_PREFIX})
+- ExternalProject_Add(${MMG_PREFIX}
+- PREFIX ${MMG_PREFIX_DIR}
+- SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/mmg
+-
+- BUILD_ALWAYS OFF
+- INSTALL_DIR ${MMG_INSTALL_DIR}
+-
+- CMAKE_ARGS(-DCMAKE_BUILD_TYPE=Release -DBUILD=MMG3D -DLIBMMG3D_STATIC=ON
+- -DLIBMMG3D_SHARED=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>)
+-
+- BUILD_COMMAND make
+- INSTALL_COMMAND make install
+- )
+- set(MMG3D_INCLUDE_DIRS "${MMG_INSTALL_DIR}/include")
+- set(MMG3D_LIBRARIES "${MMG_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${MMG_PREFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
+-
+- include_directories(${MMG3D_INCLUDE_DIRS})
+- #add_library(MMG3D STATIC IMPORTED)
+- #set_target_properties(MMG3D PROPERTIES IMPORTED_LOCATION "${MMG3D_LIBRARIES}")
++ include_directories(${MMG_INCLUDE_DIR})
++ set(MMG3D_LIBRARIES ${MMG_LIBRARY_DIR}/libmmg3d.so)
+
+ # MshMet
+ set(MSHMET_PREFIX mshmet)
+@@ -192,14 +172,8 @@ target_include_directories(tet PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libs/tetgen)
+ target_compile_definitions(tet PUBLIC TETLIBRARY) # -DTETLIBRARY: flag to compile tetgen as a library
+
+ # yaml
+-file(GLOB yaml_SRC CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/src/*.cpp) # Using file GLOB is not recomended!
+-add_library(yaml STATIC)
+-target_include_directories(yaml
+- PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/include
+- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/src
+-)
+-target_sources(yaml PRIVATE ${yaml_SRC})
+-set_target_properties(yaml PROPERTIES CXX_STANDARD 11)
++find_package(yaml-cpp REQUIRED)
++include_directories(${YAML_CPP_INCLUDE_DIRS})
+
+ # Compile options for debuging
+ if(CMAKE_BUILD_TYPE MATCHES Debug)
+@@ -259,7 +233,7 @@ if(MARCH_NATIVE)
+ endif()
+
+ # Create entries for C++ files in "ASLI" routine
+-target_link_libraries(ASLI PUBLIC alg tet yaml)
++target_link_libraries(ASLI PUBLIC alg tet ${YAML_CPP_LIBRARIES})
+ if(NOT MSVC)
+ target_link_libraries(ASLI PUBLIC stdc++fs)
+ endif()
+@@ -272,7 +246,7 @@ if(CGAL_MESH)
+ endif()
+
+ if(MMG_MESH)
+- add_dependencies(ASLI ${MMG_PREFIX} ${MSHMET_PREFIX})
++ add_dependencies(ASLI ${MSHMET_PREFIX})
+ target_link_libraries(ASLI PUBLIC ${MMG3D_LIBRARIES} ${MSHMET_LIBRARIES})
+ if(SCOTCH_FOUND)
+ target_link_libraries(ASLI PUBLIC ${SCOTCH_LIBRARIES} scotch)
--
2.37.2
P
P
Paul A. Patience wrote on 13 Sep 2022 21:02
(address . 56638@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
87a673kshd.fsf@apatience.com
Hi Ludo,

On 2022-09-02 16:34:29-04:00, Paul A. Patience wrote:
Toggle quote (5 lines)
> I've added the header line to the patch file as you requested,
> but I can't reproduce your failure to build the derivation.
> The patch applies cleanly for me.
> What command are you running so I can try to reproduce it?

Just pinging you, since I forgot to CC you in the v3 patch.

Best regards,
Paul
L
L
Ludovic Courtès wrote on 14 Sep 2022 23:13
Re: bug#56638: [PATCH] gnu: Add asli.
(name . Paul A. Patience)(address . paul@apatience.com)(address . 56638@debbugs.gnu.org)
87pmfxvevb.fsf_-_@gnu.org
Hi Paul,

"Paul A. Patience" <paul@apatience.com> skribis:

Toggle quote (4 lines)
> * gnu/packages/graphics.scm (asli): New variable.
> * gnu/packages/patches/asli-use-system-libs.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Register patch.

Thanks; I hadn’t noticed this new version.

Toggle quote (4 lines)
> I've added the header line to the patch file as you requested,
> but I can't reproduce your failure to build the derivation.
> The patch applies cleanly for me.

Unfortunately I’m still getting this error.

Toggle quote (2 lines)
> What command are you running so I can try to reproduce it?

After applying this patch, I run “./pre-inst-env guix build asli”, which
fails while building the source derivation, applying
‘asli-use-system-libs.patch’:

Toggle snippet (53 lines)
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/clean.sh' -> `asli-0.1-checkout/docs/manual/clean.sh'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/cube_mixed.png' -> `asli-0.1-checkout/docs/manual/figures/cube_mixed.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/cube_feature.png' -> `File CMakeLists.txt is read-only; trying to patch anyway
patching file CMakeLists.txt
Hunk #2 FAILED at 172.
Hunk #3 succeeded at 240 (offset 1 line).
Hunk #4 succeeded at 253 (offset 1 line).
1 out of 4 hunks FAILED -- saving rejects to file CMakeLists.txt.rej
source is at 'asli-0.1-checkout'
applying '/gnu/store/dfkl666kwj1kp2faqgxs53g0nl08xciy-asli-use-system-libs.patch'...
Backtrace:
5 (primitive-load "/gnu/store/2mbw73469dam9j1n9lf7n9yvq3h…")
In ice-9/eval.scm:
619:8 4 (_ #(#(#<directory (guile-user) 7ffff5fdbc80> "asl…") #))
In ice-9/boot-9.scm:
142:2 3 (dynamic-wind #<procedure 7ffff5f12320 at ice-9/eval.s…> …)
In ice-9/eval.scm:
619:8 2 (_ #(#(#<directory (guile-user) 7ffff5fdbc80>)))
In srfi/srfi-1.scm:
634:9 1 (for-each #<procedure apply-patch (a)> ("/gnu/store/df…"))
In guix/build/utils.scm:
762:6 0 (invoke "/gnu/store/z39hnrwds1dgcbpfgj8dnv2cngjb2xbl-p…" …)

guix/build/utils.scm:762:6: In procedure invoke:
ERROR:
1. &invoke-error:
program: "/gnu/store/z39hnrwds1dgcbpfgj8dnv2cngjb2xbl-patch-2.7.6/bin/patch"
arguments: ("--force" "--no-backup-if-mismatch" "-p1" "--input" "/gnu/store/dfkl666kwj1kp2faqgxs53g0nl08xciy-asli-use-system-libs.patch")
exit-status: 1
term-signal: #f
stop-signal: #f
asli-0.1-checkout/docs/manual/figures/cube_feature.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/KUL.png' -> `asli-0.1-checkout/docs/manual/figures/KUL.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/cube_standart.png' -> `asli-0.1-checkout/docs/manual/figures/cube_standart.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/ASLI.png' -> `asli-0.1-checkout/docs/manual/figures/ASLI.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/cube_type.png' -> `asli-0.1-checkout/docs/manual/figures/cube_type.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/cube_feature_dp.png' -> `asli-0.1-checkout/docs/manual/figures/cube_feature_dp.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/Sample-S5VF0p5.png' -> `asli-0.1-checkout/docs/manual/figures/Sample-S5VF0p5.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/gui.png' -> `asli-0.1-checkout/docs/manual/figures/gui.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/acetabular_implant.png' -> `asli-0.1-checkout/docs/manual/figures/acetabular_implant.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/femoral_implant.png' -> `asli-0.1-checkout/docs/manual/figures/femoral_implant.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/cube_type_dp.png' -> `asli-0.1-checkout/docs/manual/figures/cube_type_dp.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/cube.png' -> `asli-0.1-checkout/docs/manual/figures/cube.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/cube_size_dp.png' -> `asli-0.1-checkout/docs/manual/figures/cube_size_dp.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/docs/manual/figures/cube_size.png' -> `asli-0.1-checkout/docs/manual/figures/cube_size.png'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/inputs/cube.tap' -> `asli-0.1-checkout/inputs/cube.tap'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/inputs/cube.stl' -> `asli-0.1-checkout/inputs/cube.stl'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/inputs/cube.sap' -> `asli-0.1-checkout/inputs/cube.sap'
`/gnu/store/x9nvdyfsixc2j6vzi9131dl5wk8zg8g4-asli-0.1-checkout/inputs/cube.fap' -> `asli-0.1-checkout/inputs/cube.fap'
builder for `/gnu/store/5lhzvxmgxm20mq5agpq7kklbdq2ynd0m-asli-0.1-checkout.drv' failed with exit code 1
build of /gnu/store/5lhzvxmgxm20mq5agpq7kklbdq2ynd0m-asli-0.1-checkout.drv failed

And I have:

Toggle snippet (4 lines)
$ sha256sum gnu/packages/patches/asli-use-system-libs.patch
1a922b39a53b8cb0bd99e6c94e90769efaad88634b56d8df03811f68e45a003c gnu/packages/patches/asli-use-system-libs.patch

Am I missing something?

Thanks,
Ludo’.
P
P
Paul A. Patience wrote on 15 Sep 2022 15:37
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 56638@debbugs.gnu.org)
87k064u5he.fsf@apatience.com
Hi Ludo,

On 2022-09-14 17:13:28-04:00, Ludovic Courtès wrote:
Toggle quote (7 lines)
> And I have:
>
> $ sha256sum gnu/packages/patches/asli-use-system-libs.patch
> 1a922b39a53b8cb0bd99e6c94e90769efaad88634b56d8df03811f68e45a003c gnu/packages/patches/asli-use-system-libs.patch
>
> Am I missing something?

Thanks for the shasum; it allowed me to discover the problem.
There are trailing spaces in the original CMakeLists.txt, which also
appear in the patch.
When sending the patch inline, these spaces are trimmed.
(The spaces are highlighted in Magit, so I was aware of them, but I
didn't realize they would be trimmed somewhere in the email pipeline.)

I will attach the patch file separately, and also a tarred version just
in case.
So you can verify that you have the right one, here's my shasum:

Toggle snippet (4 lines)
$ sha256sum gnu/packages/patches/asli-use-system-libs.patch
fb1531a4f71e95354af6927175f67b90f39250604aa6859d9def4778027f1810 gnu/packages/patches/asli-use-system-libs.patch

Best regards,
Paul
Adjust CMakeLists.txt to use system-provided mmg and yaml-cpp libraries.
Toggle diff (70 lines)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b11c5ba..702423e 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -122,28 +122,8 @@ if(MMG_MESH)
add_definitions(-DMMG_MESH)
# MMG
- set(MMG_PREFIX mmg3d)
- set(MMG_PREFIX_DIR ${CMAKE_CURRENT_BINARY_DIR}/${MMG_PREFIX})
- set(MMG_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${MMG_PREFIX})
- ExternalProject_Add(${MMG_PREFIX}
- PREFIX ${MMG_PREFIX_DIR}
- SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/mmg
-
- BUILD_ALWAYS OFF
- INSTALL_DIR ${MMG_INSTALL_DIR}
-
- CMAKE_ARGS(-DCMAKE_BUILD_TYPE=Release -DBUILD=MMG3D -DLIBMMG3D_STATIC=ON
- -DLIBMMG3D_SHARED=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>)
-
- BUILD_COMMAND make
- INSTALL_COMMAND make install
- )
- set(MMG3D_INCLUDE_DIRS "${MMG_INSTALL_DIR}/include")
- set(MMG3D_LIBRARIES "${MMG_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${MMG_PREFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
-
- include_directories(${MMG3D_INCLUDE_DIRS})
- #add_library(MMG3D STATIC IMPORTED)
- #set_target_properties(MMG3D PROPERTIES IMPORTED_LOCATION "${MMG3D_LIBRARIES}")
+ include_directories(${MMG_INCLUDE_DIR})
+ set(MMG3D_LIBRARIES ${MMG_LIBRARY_DIR}/libmmg3d.so)
# MshMet
set(MSHMET_PREFIX mshmet)
@@ -192,14 +172,8 @@ target_include_directories(tet PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libs/tetgen)
target_compile_definitions(tet PUBLIC TETLIBRARY) # -DTETLIBRARY: flag to compile tetgen as a library
# yaml
-file(GLOB yaml_SRC CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/src/*.cpp) # Using file GLOB is not recomended!
-add_library(yaml STATIC)
-target_include_directories(yaml
- PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/include
- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/libs/yaml/src
-)
-target_sources(yaml PRIVATE ${yaml_SRC})
-set_target_properties(yaml PROPERTIES CXX_STANDARD 11)
+find_package(yaml-cpp REQUIRED)
+include_directories(${YAML_CPP_INCLUDE_DIRS})
# Compile options for debuging
if(CMAKE_BUILD_TYPE MATCHES Debug)
@@ -259,7 +233,7 @@ if(MARCH_NATIVE)
endif()
# Create entries for C++ files in "ASLI" routine
-target_link_libraries(ASLI PUBLIC alg tet yaml)
+target_link_libraries(ASLI PUBLIC alg tet ${YAML_CPP_LIBRARIES})
if(NOT MSVC)
target_link_libraries(ASLI PUBLIC stdc++fs)
endif()
@@ -272,7 +246,7 @@ if(CGAL_MESH)
endif()
if(MMG_MESH)
- add_dependencies(ASLI ${MMG_PREFIX} ${MSHMET_PREFIX})
+ add_dependencies(ASLI ${MSHMET_PREFIX})
target_link_libraries(ASLI PUBLIC ${MMG3D_LIBRARIES} ${MSHMET_LIBRARIES})
if(SCOTCH_FOUND)
target_link_libraries(ASLI PUBLIC ${SCOTCH_LIBRARIES} scotch)
P
P
Paul A. Patience wrote on 20 Jun 2023 02:39
(name . Ludovic Courtès)(address . ludo@gnu.org)
87sfanc6hd.fsf@apatience.com
Hi Ludo,

On 2022-09-15 09:37:08-04:00, Paul A. Patience wrote:
Toggle quote (22 lines)
> On 2022-09-14 17:13:28-04:00, Ludovic Courtès wrote:
>> And I have:
>>
>> $ sha256sum gnu/packages/patches/asli-use-system-libs.patch
>> 1a922b39a53b8cb0bd99e6c94e90769efaad88634b56d8df03811f68e45a003c gnu/packages/patches/asli-use-system-libs.patch
>>
>> Am I missing something?
>
> Thanks for the shasum; it allowed me to discover the problem.
> There are trailing spaces in the original CMakeLists.txt, which also
> appear in the patch.
> When sending the patch inline, these spaces are trimmed.
> (The spaces are highlighted in Magit, so I was aware of them, but I
> didn't realize they would be trimmed somewhere in the email pipeline.)
>
> I will attach the patch file separately, and also a tarred version just
> in case.
> So you can verify that you have the right one, here's my shasum:
>
> $ sha256sum gnu/packages/patches/asli-use-system-libs.patch
> fb1531a4f71e95354af6927175f67b90f39250604aa6859d9def4778027f1810 gnu/packages/patches/asli-use-system-libs.patch

Would you mind taking a look at this again?

Thanks,
Paul
L
L
Ludovic Courtès wrote on 8 Sep 2023 19:16
(name . Paul A. Patience)(address . paul@apatience.com)(address . 56638-done@debbugs.gnu.org)
87cyys37rj.fsf@inria.fr
Hi Paul,

"Paul A. Patience" <paul@apatience.com> skribis:

Toggle quote (14 lines)
> Thanks for the shasum; it allowed me to discover the problem.
> There are trailing spaces in the original CMakeLists.txt, which also
> appear in the patch.
> When sending the patch inline, these spaces are trimmed.
> (The spaces are highlighted in Magit, so I was aware of them, but I
> didn't realize they would be trimmed somewhere in the email pipeline.)
>
> I will attach the patch file separately, and also a tarred version just
> in case.
> So you can verify that you have the right one, here's my shasum:
>
> $ sha256sum gnu/packages/patches/asli-use-system-libs.patch
> fb1531a4f71e95354af6927175f67b90f39250604aa6859d9def4778027f1810 gnu/packages/patches/asli-use-system-libs.patch

Perfect; pushed as 05f44bbeb40686599827cbe0df7fcc80122fe152.

Thank you and apologies for taking so much time!

Ludo’.
Closed
?