games-util/mangohud: improve meson lib detection patch

* see this: https://github.com/flightlessmango/MangoHud/pull/1321

Signed-off-by: Gonçalo Negrier Duarte <gonegrier.duarte@gmail.com>
This commit is contained in:
Gonçalo Negrier Duarte
2024-05-09 23:35:32 +01:00
parent d7b9ce2b9a
commit 70a8f8072f
5 changed files with 226 additions and 23 deletions

View File

@@ -0,0 +1,116 @@
From c98df705d2a52dcc0322e6ce8626ee1cf8ad87dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gon=C3=A7alo=20Negrier=20Duarte?=
<gonegrier.duarte@gmail.com>
Date: Thu, 9 May 2024 21:52:21 +0100
Subject: [PATCH] meson: verify if system lib are present before fallback to
submodules
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* removed use_system_spdlog feature
* System vulkan-headers cant be use since mangohud don't use latest SDK
* The code is commented out for future use
* This is a backport for mangohud-0.7.1 of: aa7875942f5a0b7fdd187916b898b0b63c9a886c
* (see: https://github.com/flightlessmango/MangoHud/pull/1321)
Signed-off-by: Gonçalo Negrier Duarte <gonegrier.duarte@gmail.com>
---
meson.build | 45 ++++++++++++++++++++++++---------------------
meson_options.txt | 1 -
2 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/meson.build b/meson.build
index 3bf3918..329ad6f 100644
--- a/meson.build
+++ b/meson.build
@@ -164,9 +164,16 @@ else
dep_rt = null_dep
endif
-vkh_sp = subproject('vulkan-headers')
-vk_api_xml = vkh_sp.get_variable('vulkan_api_xml')
-dep_vulkan = vkh_sp.get_variable('vulkan_headers_dep')
+# Commented code can be used if mangohud start using latest SDK Vulkan-Headers
+# Allowing user to build mangohud using system Vulkan-Headers
+#if not dependency('VulkanHeaders').found()
+ vk_sp = subproject('VulkanHeaders')
+ vk_api_xml = vkh_sp.get_variable('vulkan_api_xml')
+ dep_vulkan = vkh_sp.get_variable('vulkan_headers_dep')
+#else
+# dep_vulkan = dependency('VulkanHeaders', required: true)
+# vk_api_xml = files('/usr/share/vulkan/registry/vk.xml')
+#endif
vk_enum_to_str = custom_target(
'vk_enum_to_str',
@@ -212,31 +219,25 @@ if get_option('mangoapp')
]
endif
-dearimgui_sp = subproject('imgui', default_options: imgui_options)
-dearimgui_dep = dearimgui_sp.get_variable('imgui_dep')
+dearimgui_dep = dependency('imgui', fallback: ['imgui', 'dearimgui_dep'], required: true, default_options: imgui_options)
if is_unixy
-implot_sp = subproject('implot', default_options: ['default_library=static'])
-implot_dep = implot_sp.get_variable('implot_dep')
+implot_dep = dependency('implot', fallback: ['implot', 'implot_deb'], required: true, default_options: ['default_library=static'])
else
implot_dep = null_dep
implot_lib = static_library('nulllib', [])
endif
-spdlog_dep = cpp.find_library('spdlog', required: get_option('use_system_spdlog'))
-if not spdlog_dep.found()
- spdlog_sp = subproject('spdlog', default_options: [
- 'default_library=static',
- 'compile_library=true',
- 'werror=false',
- 'tests=disabled',
- 'external_fmt=disabled',
- 'std_format=disabled'
- ])
- spdlog_dep = spdlog_sp.get_variable('spdlog_dep')
-else
- spdlog_dep = dependency('spdlog', required: true)
-endif
+spdlog_options = [
+ 'default_library=static',
+ 'compile_library=true',
+ 'werror=false',
+ 'tests=disabled',
+ 'external_fmt=disabled',
+ 'std_format=disabled'
+]
+
+spdlog_dep = dependency('spdlog', fallback: ['spdlog', 'spdlog_dep'], required: true, default_options: spdlog_options)
if ['windows', 'mingw'].contains(host_machine.system())
minhook_sp = subproject('minhook')
@@ -275,6 +276,7 @@ if get_option('tests').enabled()
dependencies: [
cmocka_dep,
spdlog_dep,
+ implot_dep,
dearimgui_dep
],
include_directories: inc_common)
@@ -287,3 +289,4 @@ endif
if get_option('mangoplot').enabled()
subdir('bin')
endif
+
diff --git a/meson_options.txt b/meson_options.txt
index c82ae15..2984dfe 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,4 @@
option('glibcxx_asserts', type : 'boolean', value : false)
-option('use_system_spdlog', type : 'feature', value : 'disabled', description: 'Use system spdlog library')
option('append_libdir_mangohud', type : 'boolean', value : true, description: 'Append "mangohud" to libdir path or not.')
option('include_doc', type : 'boolean', value : true, description: 'Include the example config, man pages, appstream files etc.')
option('with_nvml', type : 'combo', value : 'enabled', choices: ['enabled', 'system', 'disabled'], description: 'Enable NVML support')
--
2.45.0

View File

@@ -0,0 +1,108 @@
From aa7875942f5a0b7fdd187916b898b0b63c9a886c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gon=C3=A7alo=20Negrier=20Duarte?=
<gonegrier.duarte@gmail.com>
Date: Thu, 9 May 2024 21:52:21 +0100
Subject: [PATCH] meson: verify if system lib are present before fallback to
submodules
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* removed use_system_spdlog feature
* System vulkan-headers cant be use since mangohud don't use latest SDK
* The code is commented out for future use
Signed-off-by: Gonçalo Negrier Duarte <gonegrier.duarte@gmail.com>
---
meson.build | 46 +++++++++++++++++++++++++---------------------
meson_options.txt | 1 -
2 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/meson.build b/meson.build
index 86b5411568..00555c7f97 100644
--- a/meson.build
+++ b/meson.build
@@ -166,9 +166,18 @@ else
dep_rt = null_dep
endif
-vkh_sp = subproject('vulkan-headers')
-vk_api_xml = vkh_sp.get_variable('vulkan_api_xml')
-dep_vulkan = vkh_sp.get_variable('vulkan_headers_dep')
+# Commented code can be used if mangohud start using latest SDK Vulkan-Headers
+# Allowing user to build mangohud using system Vulkan-Headers
+#if not dependency('VulkanHeaders').found()
+ vk_sp = subproject('VulkanHeaders')
+ vk_api_xml = vkh_sp.get_variable('vulkan_api_xml')
+ dep_vulkan = vkh_sp.get_variable('vulkan_headers_dep')
+#else
+# dep_vulkan = dependency('VulkanHeaders', required: true)
+# vk_api_xml = files('/usr/share/vulkan/registry/vk.xml')
+#endif
+
+
vk_enum_to_str = custom_target(
'vk_enum_to_str',
@@ -213,31 +222,25 @@ if get_option('mangoapp')
'glfw=enabled',
]
endif
-
-dearimgui_sp = subproject('imgui', default_options: imgui_options)
-dearimgui_dep = dearimgui_sp.get_variable('imgui_dep')
+dearimgui_dep = dependency('imgui', fallback: ['imgui', 'dearimgui_dep'], required: true, default_options: imgui_options)
if is_unixy
-implot_sp = subproject('implot', default_options: ['default_library=static'])
-implot_dep = implot_sp.get_variable('implot_dep')
+implot_dep = dependency('implot', fallback: ['implot', 'implot_deb'], required: true, default_options: ['default_library=static'])
else
implot_dep = null_dep
implot_lib = static_library('nulllib', [])
endif
-if not cpp.find_library('spdlog', required: false).found()
- spdlog_sp = subproject('spdlog', default_options: [
- 'default_library=static',
- 'compile_library=true',
- 'werror=false',
- 'tests=disabled',
- 'external_fmt=disabled',
- 'std_format=disabled'
- ])
- spdlog_dep = spdlog_sp.get_variable('spdlog_dep')
-else
- spdlog_dep = dependency('spdlog', fallback: ['spdlog', 'spdlog_dep'], required: true)
-endif
+spdlog_options = [
+ 'default_library=static',
+ 'compile_library=true',
+ 'werror=false',
+ 'tests=disabled',
+ 'external_fmt=disabled',
+ 'std_format=disabled'
+]
+
+spdlog_dep = dependency('spdlog', fallback: ['spdlog', 'spdlog_dep'], required: true, default_options: spdlog_options)
if ['windows', 'mingw'].contains(host_machine.system())
minhook_sp = subproject('minhook')
@@ -277,6 +280,7 @@ if get_option('tests').enabled()
dep_vulkan,
cmocka_dep,
spdlog_dep,
+ implot_dep,
dearimgui_dep
],
include_directories: inc_common)
diff --git a/meson_options.txt b/meson_options.txt
index b6f127e635..d5c0a567b3 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,4 @@
option('glibcxx_asserts', type : 'boolean', value : false)
-option('use_system_spdlog', type : 'feature', value : 'disabled', description: 'Use system spdlog library')
option('append_libdir_mangohud', type : 'boolean', value : true, description: 'Append "mangohud" to libdir path or not.')
option('include_doc', type : 'boolean', value : true, description: 'Include the example config, man pages, appstream files etc.')
option('with_nvml', type : 'combo', value : 'enabled', choices: ['enabled', 'system', 'disabled'], description: 'Enable NVML support')

View File

@@ -1,19 +0,0 @@
diff --git a/meson.build b/meson.build
index daf063d..a0c0633 100644
--- a/meson.build
+++ b/meson.build
@@ -214,12 +214,10 @@ if get_option('mangoapp')
]
endif
-dearimgui_sp = subproject('imgui', default_options: imgui_options)
-dearimgui_dep = dearimgui_sp.get_variable('imgui_dep')
+dearimgui_dep = dependency('imgui')
if is_unixy
-implot_sp = subproject('implot', default_options: ['default_library=static'])
-implot_dep = implot_sp.get_variable('implot_dep')
+implot_dep = dependency('implot')
else
implot_dep = null_dep
implot_lib = static_library('nulllib', [])

View File

@@ -78,7 +78,7 @@ RDEPEND="
"
PATCHES=(
"${FILESDIR}/mangohud-v0.7.1-menson-fix-dep.patch"
"${FILESDIR}/${P}-menson-fix-dep.patch"
)
src_unpack() {
@@ -109,7 +109,6 @@ src_prepare() {
multilib_src_configure() {
local emesonargs=(
-Dappend_libdir_mangohud=false
-Duse_system_spdlog=enabled
-Dinclude_doc=false
$(meson_feature video_cards_nvidia with_nvml)
$(meson_feature xnvctrl with_xnvctrl)

View File

@@ -78,7 +78,7 @@ RDEPEND="
"
PATCHES=(
"${FILESDIR}/mangohud-v0.7.1-menson-fix-dep.patch"
"${FILESDIR}/${P}-menson-fix-dep.patch"
)
src_unpack() {
@@ -109,7 +109,6 @@ src_prepare() {
multilib_src_configure() {
local emesonargs=(
-Dappend_libdir_mangohud=false
-Duse_system_spdlog=enabled
-Dinclude_doc=false
$(meson_feature video_cards_nvidia with_nvml)
$(meson_feature xnvctrl with_xnvctrl)