From ad64bf345d7bf32521a0bb46820101daec9fe7b6 Mon Sep 17 00:00:00 2001 From: jackun Date: Sat, 14 Mar 2020 12:59:20 +0200 Subject: [PATCH] Update build scripts, again Install to $prefix$libdir/mangohud by default. --- meson.build | 13 ------------- meson_options.txt | 2 +- src/meson.build | 46 +++++++++++++++++++++++++++++----------------- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/meson.build b/meson.build index 35a5ff2e..9e39d26c 100644 --- a/meson.build +++ b/meson.build @@ -30,12 +30,6 @@ cpp = meson.get_compiler('cpp') prog_python = import('python').find_installation('python3') null_dep = dependency('', required : false) -# Needs prefix for configure_file() -libdir_mangohud = join_paths(get_option('prefix'), get_option('libdir'), 'mangohud') -if get_option('using_build_sh') - libdir_mangohud = join_paths(get_option('prefix'), get_option('libdir')) -endif - pre_args = [ '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', @@ -212,13 +206,6 @@ vk_enum_to_str = custom_target( '--outdir', meson.current_build_dir() ], ) -if get_option('using_build_sh') - configure_file(input : 'libmangohud.conf.in', - output : get_option('mangohud_prefix') + 'libmangohud.conf', - configuration : { 'libdir_mangohud' : libdir_mangohud }, - install_dir : join_paths(get_option('sysconfdir'), 'ld.so.conf.d'), - ) -endif util_files = files( 'src/mesa/util/os_socket.c', diff --git a/meson_options.txt b/meson_options.txt index a2e30de2..cfcc6752 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,4 @@ option('glibcxx_asserts', type : 'boolean', value : false) option('use_system_vulkan', type : 'feature', value : 'disabled', description: 'Use system vulkan headers instead of the provided ones') option('mangohud_prefix', type : 'string', value : '', description: 'Add prefix to cross-compiled library, like "lib32-".') -option('using_build_sh', type : 'boolean', value : false, description: 'Add "mangohud" suffix to libdir or not.') +option('append_libdir_mangohud', type : 'boolean', value : true, description: 'Append "mangohud" to libdir path or not.') diff --git a/src/meson.build b/src/meson.build index c269be8c..55524c02 100644 --- a/src/meson.build +++ b/src/meson.build @@ -20,6 +20,13 @@ glslang = find_program('glslangValidator') +# Needs prefix for configure_file() +if get_option('append_libdir_mangohud') + libdir_mangohud = join_paths(get_option('prefix'), get_option('libdir'), 'mangohud') +else + libdir_mangohud = join_paths(get_option('prefix'), get_option('libdir')) +endif + overlay_shaders = [ 'overlay.frag', 'overlay.vert', @@ -87,31 +94,36 @@ vklayer_mesa_overlay = shared_library( install : true ) -if get_option('using_build_sh') +if get_option('append_libdir_mangohud') configure_file(input : 'mangohud.json.in', - output : '@0@.json'.format(meson.project_name()), - configuration : {'PROJECT_NAME' : meson.project_name(), - 'libdir_mangohud' : '', - 'LAYER_SUFFIX' : ''}, - install : true, - install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), + output : '@0@.@1@.json'.format(meson.project_name(), target_machine.cpu_family()), + configuration : {'libdir_mangohud' : libdir_mangohud + '/', + 'PROJECT_NAME' : meson.project_name() + ' ', + 'LAYER_SUFFIX' : target_machine.cpu_family()}, + install : true, + install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), ) else configure_file(input : 'mangohud.json.in', - output : '@0@.@1@.json'.format(meson.project_name(), target_machine.cpu_family()), - configuration : {'libdir_mangohud' : join_paths(get_option('prefix'), get_option('libdir'), 'mangohud') + '/', - 'PROJECT_NAME' : meson.project_name() + ' ', - 'LAYER_SUFFIX' : target_machine.cpu_family()}, - install : true, - install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), + output : '@0@.json'.format(meson.project_name()), + configuration : {'PROJECT_NAME' : meson.project_name(), + 'libdir_mangohud' : '', + 'LAYER_SUFFIX' : ''}, + install : true, + install_dir : join_paths(get_option('datadir'), 'vulkan', 'implicit_layer.d'), ) endif -install_data( - files('../bin/run-mangohud-gl-pkg.sh'), +if target_machine.cpu_family() == 'x86_64' + mangohud_cpu_family = '' +else + mangohud_cpu_family = '.@0@'.format(target_machine.cpu_family()) +endif + +configure_file(input : '../bin/mangohud.in', + output : 'mangohud@0@'.format(mangohud_cpu_family), + configuration : {'libdir_mangohud' : libdir_mangohud}, install_dir : get_option('bindir'), - install_mode: 'rwxr-xr-x', - rename : ['mangohud'] ) install_data(