test-drive: add option to build with cmake in addition to meson

This commit is contained in:
Phillip Seeber
2025-08-25 12:32:02 +02:00
parent 0e592e1823
commit 802c93063f
2 changed files with 31 additions and 3 deletions
+13
View File
@@ -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@
+18 -3
View File
@@ -3,11 +3,20 @@
lib,
fetchFromGitHub,
gfortran,
buildType ? "meson",
meson,
ninja,
cmake,
mesonEmulatorHook,
}:
assert (
builtins.elem buildType [
"meson"
"cmake"
]
);
stdenv.mkDerivation rec {
pname = "test-drive";
version = "0.5.0";
@@ -19,14 +28,20 @@ stdenv.mkDerivation rec {
hash = "sha256-xRx8ErIN9xjxZt/nEsdIQkIGFRltuELdlI8lXA+M030=";
};
patches = [
# Fix wrong generation of package config include paths
./cmake.patch
];
nativeBuildInputs = [
gfortran
]
++ lib.optionals (buildType == "meson") [
meson
ninja
]
++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
mesonEmulatorHook
];
++ lib.optional (buildType == "cmake") cmake
++ lib.optional (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) mesonEmulatorHook;
mesonAutoFeatures = "auto";