Repository navigation
Export an installed CMake package with consistent ABI metadata - #84
Conversation
Propagate dependency usage requirements through CMake configs or pkg-config, export the installed Debug and TBB settings, and test relocated shared/static consumers in CI. Retain the existing TBB auto detection and SONAME setup. Co-authored-by: Codex <noreply@openai.com>
Build tagged Autotools dependencies in a temporary prefix because current Homebrew CMake bottles omit package metadata. Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
dimpase
left a comment
There was a problem hiding this comment.
OK, looks good. Can be simplified once memtailor and mathic cmake changes are propagated into new releases (and into upstreams)
@d-torrance - over to you
Co-authored-by: Codex <noreply@openai.com>
| ) | ||
| find_library(MEMTAILOR_LIBRARIES NAMES memtailor | ||
| PATHS ${LIB_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX}/lib | ||
| ) |
There was a problem hiding this comment.
I think we should keep these as a fallback. In particular, this would mean we could keep using the homebrew packages in CI instead of having to build them from source.
Same comment for mathic.
There was a problem hiding this comment.
as we maintain the Homebrew taps in question, we can just update them, then everything will be OK. Anyhow, you merged my mathic PR already...
There was a problem hiding this comment.
anyhow, fixed by afacdb8
please see Macaulay2/mathic#30 for the corresponding fix for mathic.
Signed-off-by: Dima Pasechnik <dima@pasechnik.info>
Signed-off-by: Dima Pasechnik <dima@pasechnik.info>
Signed-off-by: Dima Pasechnik <dima@pasechnik.info>
| configure_file(mathicgb.pc.in mathicgb.pc @ONLY) | ||
| install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mathicgb.pc | ||
| string(APPEND PC_CFLAGS " $<$<CONFIG:Debug>:-DMATHICGB_DEBUG>") | ||
| configure_file(mathicgb.pc.in mathicgb.pc.in @ONLY) |
There was a problem hiding this comment.
Right now, this overwrites mathicgb.pc.in in in-tree builds, e.g:
dtorrance9@cos-4a14312:~/src/mathicgb/mathicgb$ cmake -B. -S. -GNinja
-- Multithreading with TBB: ON
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/dtorrance9/src/mathicgb/mathicgb
dtorrance9@cos-4a14312:~/src/mathicgb/mathicgb$ git diff
diff --git a/mathicgb.pc.in b/mathicgb.pc.in
index fc66ee4..493c16c 100644
--- a/mathicgb.pc.in
+++ b/mathicgb.pc.in
@@ -1,13 +1,13 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
+prefix=/usr/local
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
There was a problem hiding this comment.
that's an interesting side effect, oops...
but cmake really hates in-tree builds, so I don't even know how to get there.
Signed-off-by: Dima Pasechnik <dima@pasechnik.info>
|
@d-torrance so now in-tree cmake builds are not allowed any more, with the latest commit. OK? |
The current CMake build has SONAMEs, GNUInstallDirs, TBB selection, and pkg-config installation, but lacks a consumable CMake package. It also reconstructs mathic and memtailor as static imported libraries without their usage requirements. The CMake-generated pkg-config file omits
MATHICGB_DEBUG, and a direct configuration-dependent export would select the consumer's Debug ABI instead of the installed library's ABI.Install
mathicgbConfig.cmake, version metadata, andmathicgb::mathicgb, with C++17 and transitive dependencies. Prefer dependency CMake configs, then pkg-config metadata, and retain header/library discovery as a fallback for older installations such as the current Homebrew bottles. Preserve the current TBB ON/OFF/auto behavior and SONAME setup.Export the installed library's Debug setting through both metadata formats, retain the TBB/no-TBB usage requirements, and explicitly install static archives and the public header. Install documentation using
CMAKE_INSTALL_DOCDIRinstead of the nonstandardlicenses/mathicgbdirectory, allowing Gentoo to select/usr/share/doc/${PF}. Enable root-level CTest. Extend the existing Linux/macOS, Debug/Release, TBB-on/off CI matrix with shared/static installation checks, pkg-config flag checks, and separate Release consumers of relocated installations. Add the templates and fixtures to Autotools distributions and document usage. CMake 3.18 is required for aliases of non-global imported dependency targets.macOS CMake CI uses the existing Homebrew memtailor and mathic packages directly. The fallback allows this even when their bottles lack CMake config and pkg-config metadata. Installed pkg-config flag checks run when the dependencies provide
.pcfiles; the installed CMake consumer is tested on both platforms.Local Gentoo validation, at low priority with two compilation jobs:
make distsucceeded with a nonstandard mathic prefix and includes the new CMake config and consumer fixtures.The documentation-path follow-up was checked by applying the updated Gentoo patch to the release and staging an installation: documentation is under
/usr/share/doc/mathicgb-1.4-r2, with no/usr/licenses. Overlay QA passed.The discovery fallback was tested with both dependency CMake configs and pkg-config disabled. Mathicgb and
mgbbuilt against installed headers and libraries; a staged installed CMake consumer compiled, linked, and passed its runtime test.Related work: Macaulay2/memtailor#23 and Macaulay2/mathic#29. This adapts the Gentoo packaging work to current mathicgb master without reverting its newer CMake improvements. External mathicgb selection in M2 remains separate.