mirror of
https://github.com/flightlessmango/MangoHud.git
synced 2024-10-31 15:20:13 +00:00
Separate unix and windows in meson
This commit is contained in:
parent
6da5622002
commit
b7aa6a997b
28
meson.build
28
meson.build
@ -30,9 +30,11 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# TODO: this is very incomplete
|
# TODO: this is very incomplete
|
||||||
|
is_unixy = false
|
||||||
if ['linux', 'cygwin', 'gnu'].contains(host_machine.system())
|
if ['linux', 'cygwin', 'gnu'].contains(host_machine.system())
|
||||||
pre_args += '-D_GNU_SOURCE'
|
pre_args += '-D_GNU_SOURCE'
|
||||||
pre_args += '-DHAVE_PTHREAD'
|
pre_args += '-DHAVE_PTHREAD'
|
||||||
|
is_unixy = true
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('glibcxx_asserts')
|
if get_option('glibcxx_asserts')
|
||||||
@ -77,9 +79,16 @@ endforeach
|
|||||||
vulkan_wsi_args = []
|
vulkan_wsi_args = []
|
||||||
vulkan_wsi_deps = []
|
vulkan_wsi_deps = []
|
||||||
|
|
||||||
dep_x11 = dependency('x11', required: get_option('with_x11'))
|
if is_unixy
|
||||||
dep_wayland_client = dependency('wayland-client',
|
dep_x11 = dependency('x11', required: get_option('with_x11'))
|
||||||
required: get_option('with_wayland'), version : '>=1.11')
|
dep_wayland_client = dependency('wayland-client',
|
||||||
|
required: get_option('with_wayland'), version : '>=1.11')
|
||||||
|
dbus_dep = dependency('dbus-1', required: get_option('with_dbus')).partial_dependency(compile_args : true, includes : true)
|
||||||
|
else
|
||||||
|
dep_x11 = null_dep
|
||||||
|
dep_wayland_client = null_dep
|
||||||
|
dbus_dep = null_dep
|
||||||
|
endif
|
||||||
|
|
||||||
if dep_x11.found()
|
if dep_x11.found()
|
||||||
vulkan_wsi_args += ['-DVK_USE_PLATFORM_XLIB_KHR']
|
vulkan_wsi_args += ['-DVK_USE_PLATFORM_XLIB_KHR']
|
||||||
@ -90,7 +99,7 @@ if dep_wayland_client.found()
|
|||||||
vulkan_wsi_deps += dep_wayland_client
|
vulkan_wsi_deps += dep_wayland_client
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if not dep_x11.found() and not dep_wayland_client.found()
|
if is_unixy and not dep_x11.found() and not dep_wayland_client.found()
|
||||||
error('At least one of "with_x11" and "with_wayland" should be enabled')
|
error('At least one of "with_x11" and "with_wayland" should be enabled')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -100,7 +109,6 @@ inc_common = [
|
|||||||
|
|
||||||
dep_vulkan = dependency('vulkan', required: get_option('use_system_vulkan'))
|
dep_vulkan = dependency('vulkan', required: get_option('use_system_vulkan'))
|
||||||
dep_pthread = dependency('threads')
|
dep_pthread = dependency('threads')
|
||||||
dbus_dep = dependency('dbus-1', required: get_option('with_dbus')).partial_dependency(compile_args : true, includes : true)
|
|
||||||
|
|
||||||
# Check for generic C arguments
|
# Check for generic C arguments
|
||||||
c_args = []
|
c_args = []
|
||||||
@ -157,10 +165,14 @@ foreach a : cpp_args
|
|||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
# check for dl support
|
# check for dl support
|
||||||
if cc.has_function('dlopen')
|
if is_unixy
|
||||||
dep_dl = null_dep
|
if cc.has_function('dlopen')
|
||||||
|
dep_dl = null_dep
|
||||||
|
else
|
||||||
|
dep_dl = cc.find_library('dl')
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
dep_dl = cc.find_library('dl')
|
dep_dl = null_dep
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# check for linking with rt by default
|
# check for linking with rt by default
|
||||||
|
197
src/meson.build
197
src/meson.build
@ -26,90 +26,100 @@ foreach s : ['overlay.frag', 'overlay.vert']
|
|||||||
command : [glslang, '-V', '-x', '-o', '@OUTPUT@', '@INPUT@'])
|
command : [glslang, '-V', '-x', '-o', '@OUTPUT@', '@INPUT@'])
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
vklayer_files = files(
|
vklayer_files = []
|
||||||
'overlay.cpp',
|
opengl_files = []
|
||||||
'overlay_params.cpp',
|
if ['windows', 'mingw'].contains(host_machine.system())
|
||||||
'font_unispace.c',
|
|
||||||
'blacklist.cpp',
|
|
||||||
'cpu.cpp',
|
|
||||||
'file_utils.cpp',
|
|
||||||
'memory.cpp',
|
|
||||||
'config.cpp',
|
|
||||||
'iostats.cpp',
|
|
||||||
'gpu.cpp',
|
|
||||||
'notify.cpp',
|
|
||||||
'elfhacks.cpp',
|
|
||||||
'real_dlsym.cpp',
|
|
||||||
'pci_ids.cpp',
|
|
||||||
'logging.cpp',
|
|
||||||
)
|
|
||||||
|
|
||||||
opengl_files = files(
|
|
||||||
'gl/glad.c',
|
|
||||||
'gl/imgui_impl_opengl3.cpp',
|
|
||||||
'gl/imgui_hud.cpp',
|
|
||||||
'gl/inject_egl.cpp',
|
|
||||||
)
|
|
||||||
|
|
||||||
if get_option('with_dlsym').enabled()
|
|
||||||
pre_args += '-DHOOK_DLSYM'
|
|
||||||
endif
|
|
||||||
|
|
||||||
nvml_h_found = get_option('with_nvml') == 'enabled'
|
|
||||||
if get_option('with_nvml') == 'system'
|
|
||||||
nvml_h_found = cc.has_header('nvml.h')
|
|
||||||
if not nvml_h_found
|
|
||||||
error('nvml.h was not found. Disable with \'-Dwith_nvml=disabled\' if gpu stats by NVML is not needed.')
|
|
||||||
endif
|
|
||||||
pre_args += '-DUSE_SYSTEM_NVML'
|
|
||||||
endif
|
|
||||||
|
|
||||||
if nvml_h_found
|
|
||||||
pre_args += '-DHAVE_NVML'
|
|
||||||
vklayer_files += files(
|
vklayer_files += files(
|
||||||
'nvml.cpp',
|
|
||||||
'loaders/loader_nvml.cpp',
|
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('with_xnvctrl').enabled()
|
if is_unixy
|
||||||
|
vklayer_files = files(
|
||||||
|
'overlay.cpp',
|
||||||
|
'overlay_params.cpp',
|
||||||
|
'font_unispace.c',
|
||||||
|
'blacklist.cpp',
|
||||||
|
'cpu.cpp',
|
||||||
|
'file_utils.cpp',
|
||||||
|
'memory.cpp',
|
||||||
|
'config.cpp',
|
||||||
|
'iostats.cpp',
|
||||||
|
'gpu.cpp',
|
||||||
|
'notify.cpp',
|
||||||
|
'elfhacks.cpp',
|
||||||
|
'real_dlsym.cpp',
|
||||||
|
'pci_ids.cpp',
|
||||||
|
'logging.cpp',
|
||||||
|
)
|
||||||
|
|
||||||
if not get_option('with_x11').enabled()
|
opengl_files = files(
|
||||||
error('XNVCtrl also needs \'with_x11\'')
|
'gl/glad.c',
|
||||||
|
'gl/imgui_impl_opengl3.cpp',
|
||||||
|
'gl/imgui_hud.cpp',
|
||||||
|
'gl/inject_egl.cpp',
|
||||||
|
)
|
||||||
|
|
||||||
|
if get_option('with_dlsym').enabled()
|
||||||
|
pre_args += '-DHOOK_DLSYM'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
xnvctrl_h_found = cc.has_header('NVCtrl/NVCtrl.h')
|
nvml_h_found = get_option('with_nvml') == 'enabled'
|
||||||
if not xnvctrl_h_found
|
if get_option('with_nvml') == 'system'
|
||||||
error('NVCtrl.h was not found. Disable with \'-Dwith_xnvctrl=disabled\' if gpu stats by XNVCtrl is not needed.')
|
nvml_h_found = cc.has_header('nvml.h')
|
||||||
|
if not nvml_h_found
|
||||||
|
error('nvml.h was not found. Disable with \'-Dwith_nvml=disabled\' if gpu stats by NVML is not needed.')
|
||||||
|
endif
|
||||||
|
pre_args += '-DUSE_SYSTEM_NVML'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
pre_args += '-DHAVE_XNVCTRL'
|
if nvml_h_found
|
||||||
vklayer_files += files(
|
pre_args += '-DHAVE_NVML'
|
||||||
'loaders/loader_nvctrl.cpp',
|
vklayer_files += files(
|
||||||
'nvctrl.cpp',
|
'nvml.cpp',
|
||||||
)
|
'loaders/loader_nvml.cpp',
|
||||||
endif
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
if get_option('with_x11').enabled()
|
if get_option('with_xnvctrl').enabled()
|
||||||
pre_args += '-DHAVE_X11'
|
|
||||||
|
|
||||||
vklayer_files += files(
|
if not get_option('with_x11').enabled()
|
||||||
'loaders/loader_x11.cpp',
|
error('XNVCtrl also needs \'with_x11\'')
|
||||||
'shared_x11.cpp',
|
endif
|
||||||
)
|
|
||||||
|
|
||||||
opengl_files += files(
|
xnvctrl_h_found = cc.has_header('NVCtrl/NVCtrl.h')
|
||||||
'loaders/loader_glx.cpp',
|
if not xnvctrl_h_found
|
||||||
'gl/inject_glx.cpp',
|
error('NVCtrl.h was not found. Disable with \'-Dwith_xnvctrl=disabled\' if gpu stats by XNVCtrl is not needed.')
|
||||||
)
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
if dbus_dep.found() and get_option('with_dbus').enabled()
|
pre_args += '-DHAVE_XNVCTRL'
|
||||||
pre_args += '-DHAVE_DBUS'
|
vklayer_files += files(
|
||||||
vklayer_files += files(
|
'loaders/loader_nvctrl.cpp',
|
||||||
'dbus.cpp',
|
'nvctrl.cpp',
|
||||||
'loaders/loader_dbus.cpp',
|
)
|
||||||
)
|
endif
|
||||||
|
|
||||||
|
if get_option('with_x11').enabled()
|
||||||
|
pre_args += '-DHAVE_X11'
|
||||||
|
|
||||||
|
vklayer_files += files(
|
||||||
|
'loaders/loader_x11.cpp',
|
||||||
|
'shared_x11.cpp',
|
||||||
|
)
|
||||||
|
|
||||||
|
opengl_files += files(
|
||||||
|
'loaders/loader_glx.cpp',
|
||||||
|
'gl/inject_glx.cpp',
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if dbus_dep.found() and get_option('with_dbus').enabled()
|
||||||
|
pre_args += '-DHAVE_DBUS'
|
||||||
|
vklayer_files += files(
|
||||||
|
'dbus.cpp',
|
||||||
|
'loaders/loader_dbus.cpp',
|
||||||
|
)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
link_args = cc.get_supported_link_arguments(['-Wl,-Bsymbolic-functions', '-Wl,-z,relro', '-Wl,--exclude-libs,ALL'])
|
link_args = cc.get_supported_link_arguments(['-Wl,-Bsymbolic-functions', '-Wl,-z,relro', '-Wl,--exclude-libs,ALL'])
|
||||||
@ -147,28 +157,29 @@ vklayer_mesa_overlay = shared_library(
|
|||||||
install_dir : libdir_mangohud,
|
install_dir : libdir_mangohud,
|
||||||
install : true
|
install : true
|
||||||
)
|
)
|
||||||
|
if is_unixy
|
||||||
mangohud_dlsym = shared_library(
|
mangohud_dlsym = shared_library(
|
||||||
'MangoHud_dlsym',
|
'MangoHud_dlsym',
|
||||||
files(
|
files(
|
||||||
'elfhacks.cpp',
|
'elfhacks.cpp',
|
||||||
'real_dlsym.cpp',
|
'real_dlsym.cpp',
|
||||||
'hook_dlsym.cpp',
|
'hook_dlsym.cpp',
|
||||||
),
|
),
|
||||||
c_args : [
|
c_args : [
|
||||||
pre_args,
|
pre_args,
|
||||||
no_override_init_args,
|
no_override_init_args,
|
||||||
],
|
],
|
||||||
cpp_args : [
|
cpp_args : [
|
||||||
pre_args,
|
pre_args,
|
||||||
],
|
],
|
||||||
gnu_symbol_visibility : 'hidden',
|
gnu_symbol_visibility : 'hidden',
|
||||||
dependencies : [dep_dl],
|
dependencies : [dep_dl],
|
||||||
include_directories : [inc_common],
|
include_directories : [inc_common],
|
||||||
link_args : link_args,
|
link_args : link_args,
|
||||||
install_dir : libdir_mangohud,
|
install_dir : libdir_mangohud,
|
||||||
install : true
|
install : true
|
||||||
)
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
configure_file(input : 'mangohud.json.in',
|
configure_file(input : 'mangohud.json.in',
|
||||||
output : '@0@.json'.format(meson.project_name()),
|
output : '@0@.json'.format(meson.project_name()),
|
||||||
|
Loading…
Reference in New Issue
Block a user