2020-01-28 04:11:05 +00:00
|
|
|
glslang = find_program('glslangValidator')
|
|
|
|
|
2020-03-14 10:59:20 +00:00
|
|
|
# Needs prefix for configure_file()
|
|
|
|
if get_option('append_libdir_mangohud')
|
2020-07-06 16:59:17 +00:00
|
|
|
libdir_mangohud = join_paths(get_option('libdir'), 'mangohud')
|
|
|
|
ld_libdir_mangohud = get_option('prefix') + '/\$LIB/mangohud/'
|
2020-03-14 10:59:20 +00:00
|
|
|
else
|
2020-07-06 16:59:17 +00:00
|
|
|
libdir_mangohud = get_option('libdir')
|
|
|
|
ld_libdir_mangohud = get_option('prefix') + '/\$LIB/'
|
2020-03-14 10:59:20 +00:00
|
|
|
endif
|
|
|
|
|
2020-07-08 20:43:09 +00:00
|
|
|
# For build.sh
|
|
|
|
if get_option('ld_libdir_prefix')
|
|
|
|
# FIXME derive from libdir
|
|
|
|
ld_libdir_mangohud = get_option('prefix') + '/lib/mangohud/\$LIB/'
|
|
|
|
endif
|
|
|
|
|
2021-03-24 17:12:19 +00:00
|
|
|
conf_data = configuration_data()
|
|
|
|
|
2020-11-27 15:43:44 +00:00
|
|
|
if get_option('ld_libdir_abs')
|
2021-03-24 17:12:19 +00:00
|
|
|
conf_data.set('ld_libdir_mangohud_abs', ld_libdir_mangohud)
|
|
|
|
conf_data.set('ld_libdir_mangohud', '')
|
|
|
|
else
|
|
|
|
conf_data.set('ld_libdir_mangohud_abs', '')
|
|
|
|
conf_data.set('ld_libdir_mangohud', ld_libdir_mangohud)
|
2020-11-27 15:43:44 +00:00
|
|
|
endif
|
|
|
|
|
2021-04-18 20:00:06 +00:00
|
|
|
ld_libdir_mangohud_vk = ''
|
|
|
|
if get_option('prepend_libdir_vk')
|
|
|
|
ld_libdir_mangohud_vk = ld_libdir_mangohud
|
|
|
|
endif
|
|
|
|
|
2020-01-28 04:11:05 +00:00
|
|
|
overlay_shaders = [
|
|
|
|
'overlay.frag',
|
|
|
|
'overlay.vert',
|
|
|
|
]
|
|
|
|
overlay_spv = []
|
|
|
|
foreach s : ['overlay.frag', 'overlay.vert']
|
|
|
|
overlay_spv += custom_target(
|
|
|
|
s + '.spv.h', input : s, output : s + '.spv.h',
|
|
|
|
command : [glslang, '-V', '-x', '-o', '@OUTPUT@', '@INPUT@'])
|
|
|
|
endforeach
|
|
|
|
|
2020-09-06 08:30:57 +00:00
|
|
|
vklayer_files = files(
|
2020-11-03 14:34:18 +00:00
|
|
|
'hud_elements.cpp',
|
2020-09-06 08:30:57 +00:00
|
|
|
'overlay.cpp',
|
2020-09-06 11:44:19 +00:00
|
|
|
'overlay_params.cpp',
|
2020-09-06 08:30:57 +00:00
|
|
|
'font.cpp',
|
2020-09-06 09:41:31 +00:00
|
|
|
'keybinds.cpp',
|
|
|
|
'font_unispace.c',
|
|
|
|
'logging.cpp',
|
|
|
|
'config.cpp',
|
2020-09-06 11:55:02 +00:00
|
|
|
'gpu.cpp',
|
2020-09-07 04:36:35 +00:00
|
|
|
'vulkan.cpp',
|
2020-09-07 04:37:27 +00:00
|
|
|
'blacklist.cpp',
|
2021-08-12 10:53:28 +00:00
|
|
|
'file_utils.cpp',
|
2020-09-06 08:30:57 +00:00
|
|
|
)
|
2020-09-05 05:42:39 +00:00
|
|
|
opengl_files = []
|
|
|
|
if ['windows', 'mingw'].contains(host_machine.system())
|
|
|
|
vklayer_files += files(
|
2020-09-06 08:56:24 +00:00
|
|
|
'file_utils_win32.cpp',
|
2020-09-06 11:52:18 +00:00
|
|
|
'cpu_win32.cpp',
|
2020-09-07 02:38:55 +00:00
|
|
|
'nvapi.cpp',
|
2020-09-07 02:38:35 +00:00
|
|
|
'win/dxgi.cpp',
|
2020-09-05 06:09:42 +00:00
|
|
|
'win/main.cpp',
|
2020-09-05 09:16:20 +00:00
|
|
|
'win/kiero.cpp',
|
|
|
|
'win/d3d12_hook.cpp',
|
2020-09-07 05:49:14 +00:00
|
|
|
'win/d3d11_hook.cpp',
|
2020-09-06 11:55:02 +00:00
|
|
|
'win/d3d_shared.cpp',
|
2020-09-05 05:42:39 +00:00
|
|
|
)
|
2020-04-18 16:11:50 +00:00
|
|
|
endif
|
2020-04-01 22:30:47 +00:00
|
|
|
|
2020-09-05 05:42:39 +00:00
|
|
|
if is_unixy
|
2020-09-06 08:30:57 +00:00
|
|
|
vklayer_files += files(
|
2020-09-05 05:42:39 +00:00
|
|
|
'cpu.cpp',
|
|
|
|
'memory.cpp',
|
|
|
|
'iostats.cpp',
|
|
|
|
'notify.cpp',
|
|
|
|
'elfhacks.cpp',
|
|
|
|
'real_dlsym.cpp',
|
|
|
|
'pci_ids.cpp',
|
2021-03-16 08:50:07 +00:00
|
|
|
'battery.cpp',
|
2020-09-05 05:42:39 +00:00
|
|
|
)
|
2020-06-09 10:44:41 +00:00
|
|
|
|
2020-09-05 05:42:39 +00:00
|
|
|
opengl_files = files(
|
|
|
|
'gl/glad.c',
|
|
|
|
'gl/imgui_impl_opengl3.cpp',
|
|
|
|
'gl/imgui_hud.cpp',
|
|
|
|
'gl/inject_egl.cpp',
|
2020-06-09 10:44:41 +00:00
|
|
|
)
|
|
|
|
|
2020-09-05 05:42:39 +00:00
|
|
|
if get_option('with_dlsym').enabled()
|
|
|
|
pre_args += '-DHOOK_DLSYM'
|
|
|
|
endif
|
2020-04-15 16:45:59 +00:00
|
|
|
|
2020-09-05 05:42:39 +00:00
|
|
|
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'
|
2020-04-15 16:45:59 +00:00
|
|
|
endif
|
|
|
|
|
2020-09-05 05:42:39 +00:00
|
|
|
if nvml_h_found
|
|
|
|
pre_args += '-DHAVE_NVML'
|
|
|
|
vklayer_files += files(
|
|
|
|
'nvml.cpp',
|
|
|
|
'loaders/loader_nvml.cpp',
|
|
|
|
)
|
2020-04-15 16:45:59 +00:00
|
|
|
endif
|
2020-04-01 22:30:47 +00:00
|
|
|
|
2020-09-05 05:42:39 +00:00
|
|
|
if get_option('with_xnvctrl').enabled()
|
2020-03-30 19:48:56 +00:00
|
|
|
|
2020-09-05 05:42:39 +00:00
|
|
|
if not get_option('with_x11').enabled()
|
|
|
|
error('XNVCtrl also needs \'with_x11\'')
|
|
|
|
endif
|
2020-04-01 22:30:47 +00:00
|
|
|
|
2020-09-05 05:42:39 +00:00
|
|
|
xnvctrl_h_found = cc.has_header('NVCtrl/NVCtrl.h')
|
|
|
|
if not xnvctrl_h_found
|
|
|
|
error('NVCtrl.h was not found. Disable with \'-Dwith_xnvctrl=disabled\' if gpu stats by XNVCtrl is not needed.')
|
|
|
|
endif
|
2020-04-01 22:30:47 +00:00
|
|
|
|
2020-09-05 05:42:39 +00:00
|
|
|
pre_args += '-DHAVE_XNVCTRL'
|
|
|
|
vklayer_files += files(
|
|
|
|
'loaders/loader_nvctrl.cpp',
|
|
|
|
'nvctrl.cpp',
|
|
|
|
)
|
|
|
|
endif
|
2020-03-10 05:19:18 +00:00
|
|
|
|
2020-09-05 05:42:39 +00:00
|
|
|
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
|
2020-10-22 18:37:20 +00:00
|
|
|
|
|
|
|
# if get_option('with_libdrm_amdgpu').enabled() and dep_libdrm.found() and dep_libdrm_amdgpu.found()
|
|
|
|
if get_option('with_libdrm_amdgpu').enabled() and dep_libdrm.found()
|
|
|
|
pre_args += '-DHAVE_LIBDRM_AMDGPU'
|
|
|
|
#if dep_xcb.found() and dep_xcb_dri2.found()
|
|
|
|
vklayer_files += files(
|
|
|
|
'loaders/loader_libdrm.cpp',
|
|
|
|
)
|
|
|
|
#endif
|
|
|
|
endif
|
2020-04-04 20:47:48 +00:00
|
|
|
endif
|
|
|
|
|
2020-06-19 20:42:30 +00:00
|
|
|
link_args = cc.get_supported_link_arguments(['-Wl,-Bsymbolic-functions', '-Wl,-z,relro', '-Wl,--exclude-libs,ALL'])
|
|
|
|
# meson fails to check version-script so just force add
|
|
|
|
link_args += '-Wl,--version-script,@0@'.format(join_paths(meson.current_source_dir(), 'mangohud.version'))
|
|
|
|
|
2020-01-28 04:11:05 +00:00
|
|
|
vklayer_mesa_overlay = shared_library(
|
|
|
|
'MangoHud',
|
2020-05-02 21:18:25 +00:00
|
|
|
mangohud_version,
|
2020-01-28 04:11:05 +00:00
|
|
|
util_files,
|
|
|
|
vk_enum_to_str,
|
|
|
|
vklayer_files,
|
2020-03-10 05:19:18 +00:00
|
|
|
opengl_files,
|
2020-01-28 04:11:05 +00:00
|
|
|
overlay_spv,
|
|
|
|
c_args : [
|
|
|
|
pre_args,
|
2020-05-10 12:11:56 +00:00
|
|
|
no_override_init_args,
|
2020-01-28 04:11:05 +00:00
|
|
|
vulkan_wsi_args
|
|
|
|
],
|
|
|
|
cpp_args : [
|
|
|
|
pre_args,
|
|
|
|
vulkan_wsi_args
|
|
|
|
],
|
2020-06-21 19:55:13 +00:00
|
|
|
gnu_symbol_visibility : 'hidden',
|
2020-01-28 04:11:05 +00:00
|
|
|
dependencies : [
|
2020-05-10 12:11:56 +00:00
|
|
|
vulkan_wsi_deps,
|
2020-05-04 10:16:09 +00:00
|
|
|
dearimgui_dep,
|
2021-07-16 00:28:46 +00:00
|
|
|
spdlog_dep,
|
2020-10-22 18:37:20 +00:00
|
|
|
dep_libdrm,
|
|
|
|
#dep_libdrm_amdgpu,
|
2020-04-04 20:47:48 +00:00
|
|
|
dbus_dep,
|
2020-01-28 04:11:05 +00:00
|
|
|
dep_dl,
|
2020-04-26 19:43:40 +00:00
|
|
|
dep_rt,
|
2020-02-13 18:16:31 +00:00
|
|
|
dep_pthread,
|
2020-09-06 05:50:31 +00:00
|
|
|
dep_vulkan,
|
|
|
|
windows_deps],
|
2020-04-09 18:24:37 +00:00
|
|
|
include_directories : [inc_common],
|
2020-06-19 20:42:30 +00:00
|
|
|
link_args : link_args,
|
2020-04-21 13:56:46 +00:00
|
|
|
install_dir : libdir_mangohud,
|
|
|
|
install : true
|
|
|
|
)
|
2020-09-05 05:42:39 +00:00
|
|
|
if is_unixy
|
|
|
|
mangohud_dlsym = shared_library(
|
|
|
|
'MangoHud_dlsym',
|
|
|
|
files(
|
|
|
|
'elfhacks.cpp',
|
|
|
|
'real_dlsym.cpp',
|
|
|
|
'hook_dlsym.cpp',
|
|
|
|
),
|
|
|
|
c_args : [
|
|
|
|
pre_args,
|
|
|
|
no_override_init_args,
|
|
|
|
],
|
|
|
|
cpp_args : [
|
|
|
|
pre_args,
|
|
|
|
],
|
|
|
|
gnu_symbol_visibility : 'hidden',
|
|
|
|
dependencies : [dep_dl],
|
|
|
|
include_directories : [inc_common],
|
|
|
|
link_args : link_args,
|
|
|
|
install_dir : libdir_mangohud,
|
|
|
|
install : true
|
|
|
|
)
|
|
|
|
endif
|
2020-01-28 04:11:05 +00:00
|
|
|
|
2020-03-14 11:22:17 +00:00
|
|
|
configure_file(input : 'mangohud.json.in',
|
2020-07-06 16:59:17 +00:00
|
|
|
output : '@0@.json'.format(meson.project_name()),
|
2021-04-18 20:00:06 +00:00
|
|
|
configuration : {'ld_libdir_mangohud' : ld_libdir_mangohud_vk,
|
2020-07-08 20:43:09 +00:00
|
|
|
'PROJECT_NAME' : meson.project_name().to_upper()},
|
2020-03-14 11:22:17 +00:00
|
|
|
install : true,
|
|
|
|
install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'),
|
|
|
|
)
|
2020-03-10 05:19:18 +00:00
|
|
|
|
2020-03-14 10:59:20 +00:00
|
|
|
configure_file(input : '../bin/mangohud.in',
|
2020-07-06 16:59:17 +00:00
|
|
|
output : 'mangohud',
|
2021-03-24 17:12:19 +00:00
|
|
|
configuration : conf_data,
|
2020-03-10 05:19:18 +00:00
|
|
|
install_dir : get_option('bindir'),
|
2020-03-10 21:38:27 +00:00
|
|
|
)
|
2021-04-13 22:49:00 +00:00
|
|
|
|
2020-03-15 15:01:08 +00:00
|
|
|
if get_option('include_doc')
|
|
|
|
install_data(
|
|
|
|
files('../bin/MangoHud.conf'),
|
|
|
|
install_dir : join_paths(get_option('datadir'), 'doc', 'mangohud'),
|
|
|
|
rename : ['MangoHud.conf.example']
|
|
|
|
)
|
2020-02-11 21:29:29 +00:00
|
|
|
endif
|