--- src/intel/Android.vulkan.mk | 8 ++++---- src/intel/Makefile.vulkan.am | 10 +++++----- src/intel/vulkan/anv_entrypoints_gen.py | 9 ++++++--- src/intel/vulkan/anv_extensions_gen.py | 9 ++++++--- src/intel/vulkan/anv_icd.py | 7 +++++-- src/intel/vulkan/meson.build | 26 ++++++++++++++----------- 6 files changed, 41 insertions(+), 28 deletions(-)
diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk index af59963c66d..2dc9de6b901 100644 --- a/src/intel/Android.vulkan.mk +++ b/src/intel/Android.vulkan.mk @@ -70,8 +70,8 @@ $(intermediates)/vulkan/dummy.c: $(hide) touch $@ $(intermediates)/vulkan/anv_entrypoints.h: $(intermediates)/vulkan/dummy.c - PYTHONPATH=$(MESA_TOP)/src/vulkan/util \ $(VK_ENTRYPOINTS_SCRIPT) \ + --import-pah=$(MESA_TOP)/src/vulkan/util \ --outdir $(dir $@) \ --xml $(MESA_TOP)/src/vulkan/registry/vk.xml @@ -248,22 +248,22 @@ LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_extensions.h $(intermediates)/vulkan/anv_entrypoints.c: @mkdir -p $(dir $@) - PYTHONPATH=$(MESA_TOP)/src/vulkan/util \ $(VK_ENTRYPOINTS_SCRIPT) \ + --import-pah=$(MESA_TOP)/src/vulkan/util \ --xml $(MESA_TOP)/src/vulkan/registry/vk.xml \ --outdir $(dir $@) $(intermediates)/vulkan/anv_extensions.c: @mkdir -p $(dir $@) - PYTHONPATH=$(MESA_TOP)/src/vulkan/util \ $(VK_EXTENSIONS_SCRIPT) \ + --import-pah=$(MESA_TOP)/src/vulkan/util \ --xml $(MESA_TOP)/src/vulkan/registry/vk.xml \ --out-c $@ $(intermediates)/vulkan/anv_extensions.h: @mkdir -p $(dir $@) - PYTHONPATH=$(MESA_TOP)/src/vulkan/util \ $(VK_EXTENSIONS_SCRIPT) \ + --import-pah=$(MESA_TOP)/src/vulkan/util \ --xml $(MESA_TOP)/src/vulkan/registry/vk.xml \ --out-h $@ diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am index 91577bc9026..462ff98d359 100644 --- a/src/intel/Makefile.vulkan.am +++ b/src/intel/Makefile.vulkan.am @@ -34,8 +34,8 @@ vulkan/anv_entrypoints.c: vulkan/anv_entrypoints_gen.py \ $(vulkan_api_xml) \ $(vulkan_api_generators_py) $(MKDIR_GEN) - PYTHONPATH=$(top_srcdir)/src/vulkan/util \ $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_entrypoints_gen.py \ + --import-path=$(top_srcdir)/src/vulkan/util \ --xml $(vulkan_api_xml) \ --outdir $(builddir)/vulkan vulkan/anv_entrypoints.h: vulkan/anv_entrypoints.c @@ -45,8 +45,8 @@ vulkan/anv_extensions.c: vulkan/anv_extensions_gen.py \ $(vulkan_api_xml) \ $(vulkan_api_generators_py) $(MKDIR_GEN) - PYTHONPATH=$(top_srcdir)/src/vulkan/util \ $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_extensions_gen.py \ + --import-path=$(top_srcdir)/src/vulkan/util \ --xml $(vulkan_api_xml) \ --out-c $@ @@ -55,8 +55,8 @@ vulkan/anv_extensions.h: vulkan/anv_extensions_gen.py \ $(vulkan_api_xml) \ $(vulkan_api_generators_py) $(MKDIR_GEN) - PYTHONPATH=$(top_srcdir)/src/vulkan/util \ $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_extensions_gen.py \ + --import-path=$(top_srcdir)/src/vulkan/util \ --xml $(vulkan_api_xml) \ --out-h $@ @@ -77,15 +77,15 @@ EXTRA_DIST += \ vulkan/dev_icd.json : vulkan/anv_extensions.py vulkan/anv_icd.py \ $(vulkan_api_generators_py) $(MKDIR_GEN) - PYTHONPATH=$(top_srcdir)/src/vulkan/util \ $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_icd.py \ + --import-path=$(top_srcdir)/src/vulkan/util \ --lib-path="${abs_top_builddir}/${LIB_DIR}" --out $@ vulkan/intel_icd.@host_cpu@.json : vulkan/anv_extensions.py vulkan/anv_icd.py \ $(vulkan_api_generators_py) $(MKDIR_GEN) - PYTHONPATH=$(top_srcdir)/src/vulkan/util \ $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_icd.py \ + --import-path=$(top_srcdir)/src/vulkan/util \ --lib-path="${libdir}" --out $@ if HAVE_INTEL_VULKAN diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index 219369ecc67..e82afd34615 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -24,9 +24,7 @@ import argparse import os - -from anv_extensions import MAX_API_VERSION, EXTENSIONS -import vk_entrypoints_gen +import sys # We generate a static hash table for entry point lookup # (vkGetProcAddress). We use a linear congruential generator for our hash @@ -45,6 +43,7 @@ LAYERS = [ def main(): parser = argparse.ArgumentParser() + parser.add_argument('--import-path', required=True) parser.add_argument('--outdir', help='Where to write the files.', required=True) parser.add_argument('--xml', @@ -53,6 +52,10 @@ def main(): action='append', dest='xml_files') args = parser.parse_args() + sys.path.insert(0, args.import_path) + + from anv_extensions import MAX_API_VERSION, EXTENSIONS + import vk_entrypoints_gen vk_entrypoints_gen.generate_entrypoints(MAX_API_VERSION, EXTENSIONS, LAYERS, 'anv', args.xml_files, os.path.join(args.outdir, 'anv_entrypoints.c'), diff --git a/src/intel/vulkan/anv_extensions_gen.py b/src/intel/vulkan/anv_extensions_gen.py index 6e8361c7227..8e7522f5fbf 100644 --- a/src/intel/vulkan/anv_extensions_gen.py +++ b/src/intel/vulkan/anv_extensions_gen.py @@ -25,12 +25,11 @@ COPYRIGHT = """\ """ import argparse - -from anv_extensions import * -import vk_extensions_gen +import sys if __name__ == '__main__': parser = argparse.ArgumentParser() + parser.add_argument('--import-path', required=True) parser.add_argument('--out-c', help='Output C file.') parser.add_argument('--out-h', help='Output H file.') parser.add_argument('--xml', @@ -39,6 +38,10 @@ if __name__ == '__main__': action='append', dest='xml_files') args = parser.parse_args() + sys.path.insert(0, args.import_path) + + from anv_extensions import * + import vk_extensions_gen vk_extensions_gen.generate_extensions(MAX_API_VERSION, API_VERSIONS, EXTENSIONS, 'anv', args.xml_files, args.out_c, args.out_h) diff --git a/src/intel/vulkan/anv_icd.py b/src/intel/vulkan/anv_icd.py index 73cc6453d51..5b99432df3e 100644 --- a/src/intel/vulkan/anv_icd.py +++ b/src/intel/vulkan/anv_icd.py @@ -23,14 +23,17 @@ import json import os.path import argparse - -from anv_extensions import MAX_API_VERSION +import sys if __name__ == '__main__': parser = argparse.ArgumentParser() + parser.add_argument('--import-path', required=True) parser.add_argument('--out', help='Output jsono file.', required=True) parser.add_argument('--lib-path', help='Path to libvulkan_intel.so') args = parser.parse_args() + sys.path.insert(0, args.import_path) + + from anv_extensions import MAX_API_VERSION path = 'libvulkan_intel.so' if args.lib_path: diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build index 9a5aac75aed..4196a5d3cd8 100644 --- a/src/intel/vulkan/meson.build +++ b/src/intel/vulkan/meson.build @@ -25,8 +25,9 @@ anv_entrypoints = custom_target( input : ['anv_entrypoints_gen.py', vk_api_xml], output : ['anv_entrypoints.h', 'anv_entrypoints.c'], command : [ - 'env', 'PYTHONPATH=@0@'.format(join_paths(meson.source_root(), 'src/vulkan/util/')), - prog_python, '@INPUT0@', '--xml', '@INPUT1@', + prog_python, '@INPUT0@', + '--import-path', join_paths(meson.source_root(), 'src/vulkan/util/')), + '--xml', '@INPUT1@', '--outdir', meson.current_build_dir(), ], depend_files : [anv_extensions_py, vk_api_generators_py], @@ -37,8 +38,9 @@ anv_extensions_c = custom_target( input : ['anv_extensions_gen.py', vk_api_xml], output : 'anv_extensions.c', command : [ - 'env', 'PYTHONPATH=@0@'.format(join_paths(meson.source_root(), 'src/vulkan/util/')), - prog_python, '@INPUT0@', '--xml', '@INPUT1@', + prog_python, '@INPUT0@', + '--import-path', join_paths(meson.source_root(), 'src/vulkan/util/')), + '--xml', '@INPUT1@', '--out-c', '@OUTPUT@', ], depend_files : [anv_extensions_py, vk_api_generators_py], @@ -49,9 +51,10 @@ anv_extensions_h = custom_target( input : ['anv_extensions_gen.py', vk_api_xml], output : 'anv_extensions.h', command : [ - 'env', 'PYTHONPATH=@0@'.format(join_paths(meson.source_root(), 'src/vulkan/util/')), - prog_python, '@INPUT0@', '--xml', '@INPUT1@', - '--out-h', '@OUTPUT@', + prog_python, '@INPUT0@', + '--import-path', join_paths(meson.source_root(), 'src/vulkan/util/')), + '--xml', '@INPUT1@', + '--out-h', '@OUTPUT@' ], depend_files : [anv_extensions_py, vk_api_generators_py], ) @@ -61,8 +64,8 @@ intel_icd = custom_target( input : 'anv_icd.py', output : 'intel_icd.@0@.json'.format(host_machine.cpu()), command : [ - 'env', 'PYTHONPATH=@0@'.format(join_paths(meson.source_root(), 'src/vulkan/util/')), prog_python, '@INPUT@', + '--import-path', join_paths(meson.source_root(), 'src/vulkan/util/')), '--lib-path', join_paths(get_option('prefix'), get_option('libdir')), '--out', '@OUTPUT@', ], @@ -77,9 +80,10 @@ dev_icd = custom_target( input : 'anv_icd.py', output : 'dev_icd.@0@.json'.format(host_machine.cpu()), command : [ - 'env', 'PYTHONPATH=@0@'.format(join_paths(meson.source_root(), 'src/vulkan/util/')), - prog_python, '@INPUT@', '--lib-path', meson.current_build_dir(), - '--out', '@OUTPUT@' + prog_python, '@INPUT@', + '--import-path', join_paths(meson.source_root(), 'src/vulkan/util/')), + '--lib-path', meson.current_build_dir(), + '--out', '@OUTPUT@', ], depend_files : [anv_extensions_py, vk_api_generators_py], build_by_default : true, -- 2.18.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev