tblite: add option to build with cmake in addition to meson

This commit is contained in:
Phillip Seeber
2025-08-25 12:32:48 +02:00
parent a997ac0dc2
commit a125985c79
2 changed files with 44 additions and 2 deletions
@@ -3,8 +3,10 @@
lib,
fetchFromGitHub,
gfortran,
buildType ? "meson",
meson,
ninja,
cmake,
pkg-config,
blas,
lapack,
@@ -17,6 +19,12 @@
}:
assert !blas.isILP64 && !lapack.isILP64;
assert (
builtins.elem buildType [
"meson"
"cmake"
]
);
stdenv.mkDerivation rec {
pname = "tblite";
@@ -29,11 +37,23 @@ stdenv.mkDerivation rec {
hash = "sha256-KV2fxB+SF4LilN/87YCvxUt4wsY4YyIV4tqnn+3/0oI=";
};
patches = [
./0001-fix-multicharge-dep-needed-for-static-compilation.patch
# Fix wrong paths in pkg-config file
./pkgconfig.patch
];
nativeBuildInputs = [
gfortran
pkg-config
]
++ lib.optionals (buildType == "meson") [
meson
ninja
pkg-config
]
++ lib.optionals (buildType == "cmake") [
cmake
];
buildInputs = [
@@ -52,7 +72,16 @@ stdenv.mkDerivation rec {
"dev"
];
doCheck = true;
checkInputs = [
python3
];
checkFlags = [
"-j1" # Tests hang when multiple are run in parallel
];
doCheck = buildType == "meson";
preCheck = ''
export OMP_NUM_THREADS=2
'';
@@ -0,0 +1,13 @@
diff --git a/config/template.pc b/config/template.pc
index 3d6efbb..e338a42 100644
--- a/config/template.pc
+++ b/config/template.pc
@@ -1,6 +1,6 @@
prefix=@CMAKE_INSTALL_PREFIX@
-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: @PROJECT_NAME@
Description: @PROJECT_DESCRIPTION@