Merge pull request #227840 from kira-bruneau/mangohud
mangohud: enable tests
This commit is contained in:
commit
80d0ff8dd4
@ -1,5 +1,6 @@
|
|||||||
{ lib
|
{ lib
|
||||||
, stdenv
|
, stdenv
|
||||||
|
, fetchFromGitLab
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, substituteAll
|
, substituteAll
|
||||||
@ -13,6 +14,7 @@
|
|||||||
, hwdata
|
, hwdata
|
||||||
, mangohud32
|
, mangohud32
|
||||||
, addOpenGLRunpath
|
, addOpenGLRunpath
|
||||||
|
, appstream
|
||||||
, glslang
|
, glslang
|
||||||
, mako
|
, mako
|
||||||
, meson
|
, meson
|
||||||
@ -32,6 +34,17 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
# Derived from subprojects/cmocka.wrap
|
||||||
|
cmocka = rec {
|
||||||
|
version = "1.81";
|
||||||
|
src = fetchFromGitLab {
|
||||||
|
owner = "cmocka";
|
||||||
|
repo = "cmocka";
|
||||||
|
rev = "59dc0013f9f29fcf212fe4911c78e734263ce24c";
|
||||||
|
hash = "sha256-IbAZOC0Q60PrKlKVWsgg/PFDV0PLb/yy+Iz/4Iziny0=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Derived from subprojects/imgui.wrap
|
# Derived from subprojects/imgui.wrap
|
||||||
imgui = rec {
|
imgui = rec {
|
||||||
version = "1.81";
|
version = "1.81";
|
||||||
@ -79,6 +92,9 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
# Unpack subproject sources
|
# Unpack subproject sources
|
||||||
postUnpack = ''(
|
postUnpack = ''(
|
||||||
cd "$sourceRoot/subprojects"
|
cd "$sourceRoot/subprojects"
|
||||||
|
${lib.optionalString finalAttrs.doCheck ''
|
||||||
|
cp -R --no-preserve=mode,ownership ${cmocka.src} cmocka
|
||||||
|
''}
|
||||||
cp -R --no-preserve=mode,ownership ${imgui.src} imgui-${imgui.version}
|
cp -R --no-preserve=mode,ownership ${imgui.src} imgui-${imgui.version}
|
||||||
cp -R --no-preserve=mode,ownership ${vulkan-headers.src} Vulkan-Headers-${vulkan-headers.version}
|
cp -R --no-preserve=mode,ownership ${vulkan-headers.src} Vulkan-Headers-${vulkan-headers.version}
|
||||||
)'';
|
)'';
|
||||||
@ -127,7 +143,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
mesonFlags = [
|
mesonFlags = [
|
||||||
"-Dwith_wayland=enabled"
|
"-Dwith_wayland=enabled"
|
||||||
"-Duse_system_spdlog=enabled"
|
"-Duse_system_spdlog=enabled"
|
||||||
"-Dtests=disabled" # Tests require AMD GPU
|
"-Dtests=${if finalAttrs.doCheck then "enabled" else "disabled"}"
|
||||||
] ++ lib.optionals gamescopeSupport [
|
] ++ lib.optionals gamescopeSupport [
|
||||||
"-Dmangoapp=true"
|
"-Dmangoapp=true"
|
||||||
"-Dmangoapp_layer=true"
|
"-Dmangoapp_layer=true"
|
||||||
@ -160,6 +176,12 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
xorg.libXrandr
|
xorg.libXrandr
|
||||||
];
|
];
|
||||||
|
|
||||||
|
doCheck = true;
|
||||||
|
|
||||||
|
nativeCheckInputs = [
|
||||||
|
appstream
|
||||||
|
];
|
||||||
|
|
||||||
# Support 32bit Vulkan applications by linking in 32bit Vulkan layers
|
# Support 32bit Vulkan applications by linking in 32bit Vulkan layers
|
||||||
# This is needed for the same reason the 32bit preload workaround is needed.
|
# This is needed for the same reason the 32bit preload workaround is needed.
|
||||||
postInstall = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
|
postInstall = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
|
||||||
@ -172,12 +194,16 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Add OpenGL driver path to RUNPATH to support NVIDIA cards
|
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
|
# Add OpenGL driver path to RUNPATH to support NVIDIA cards
|
||||||
addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so"
|
addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so"
|
||||||
${lib.optionalString gamescopeSupport ''
|
${lib.optionalString gamescopeSupport ''
|
||||||
addOpenGLRunpath "$out/bin/mangoapp"
|
addOpenGLRunpath "$out/bin/mangoapp"
|
||||||
''}
|
''}
|
||||||
|
${lib.optionalString finalAttrs.doCheck ''
|
||||||
|
# libcmocka.so is only used for tests
|
||||||
|
rm "$out/lib/libcmocka.so"
|
||||||
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.updateScript = nix-update-script { };
|
passthru.updateScript = nix-update-script { };
|
||||||
|
Loading…
Reference in New Issue
Block a user