Mesa (master): vulkan: Track dependencies of Python imports
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 8 14:38:25 UTC 2021
Module: Mesa
Branch: master
Commit: 0845cabc7250cc793c6943d6a10d92e385fb89fb
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0845cabc7250cc793c6943d6a10d92e385fb89fb
Author: Chad Versace <chad at kiwitree.net>
Date: Mon Mar 29 12:39:07 2021 -0700
vulkan: Track dependencies of Python imports
The meson.build was unaware of transitive dependencies introduced by
Python imports.
Android still needs fixing. But I did not update the Android files lest
I break the build.
Ideally, we would fix this by using a Python runner that generates
a depfile, similar to how meson creates depfiles for C files by passing
flags -MD -MQ -MF to gcc. But this patch gets the job done, without
stalling on the ideal general solution, by manually tracking the Python
imports in new 'foo_depend_files' variables.
CC: mesa-stable at lists.freedesktop.org
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
---
src/amd/vulkan/meson.build | 1 +
src/broadcom/vulkan/meson.build | 1 +
src/freedreno/vulkan/meson.build | 1 +
src/gallium/frontends/lavapipe/meson.build | 1 +
src/intel/vulkan/meson.build | 1 +
src/vulkan/util/meson.build | 21 ++++++++++++++++++++-
src/vulkan/util/vk_dispatch_table_gen.py | 2 ++
src/vulkan/util/vk_entrypoints_gen.py | 2 ++
src/vulkan/util/vk_extensions_gen.py | 2 ++
9 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build
index d1a9b0d8fd7..abe80db75cb 100644
--- a/src/amd/vulkan/meson.build
+++ b/src/amd/vulkan/meson.build
@@ -27,6 +27,7 @@ radv_entrypoints = custom_target(
'--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'radv',
'--device-prefix', 'sqtt',
],
+ depend_files : vk_entrypoints_gen_depend_files,
)
libradv_files = files(
diff --git a/src/broadcom/vulkan/meson.build b/src/broadcom/vulkan/meson.build
index a6b6e75f57a..88bee8c1380 100644
--- a/src/broadcom/vulkan/meson.build
+++ b/src/broadcom/vulkan/meson.build
@@ -26,6 +26,7 @@ v3dv_entrypoints = custom_target(
prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
'--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'v3dv',
],
+ depend_files : vk_entrypoints_gen_depend_files,
)
v3dv_extensions_c = custom_target(
diff --git a/src/freedreno/vulkan/meson.build b/src/freedreno/vulkan/meson.build
index fa537019bcb..1f9bf57df03 100644
--- a/src/freedreno/vulkan/meson.build
+++ b/src/freedreno/vulkan/meson.build
@@ -26,6 +26,7 @@ tu_entrypoints = custom_target(
prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
'--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'tu',
],
+ depend_files : vk_entrypoints_gen_depend_files,
)
tu_extensions_c = custom_target(
diff --git a/src/gallium/frontends/lavapipe/meson.build b/src/gallium/frontends/lavapipe/meson.build
index d084c924a79..66468c5c52f 100644
--- a/src/gallium/frontends/lavapipe/meson.build
+++ b/src/gallium/frontends/lavapipe/meson.build
@@ -7,6 +7,7 @@ lvp_entrypoints = custom_target(
prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
'--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'lvp',
],
+ depend_files : vk_entrypoints_gen_depend_files,
)
liblvp_files = files(
diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build
index 7171532382c..9bac66dd0cf 100644
--- a/src/intel/vulkan/meson.build
+++ b/src/intel/vulkan/meson.build
@@ -30,6 +30,7 @@ anv_entrypoints = custom_target(
'--device-prefix', 'gfx11', '--device-prefix', 'gfx12',
'--device-prefix', 'gfx125',
],
+ depend_files : vk_entrypoints_gen_depend_files,
)
intel_icd = custom_target(
diff --git a/src/vulkan/util/meson.build b/src/vulkan/util/meson.build
index 6338b0b92d3..c5526a2f52f 100644
--- a/src/vulkan/util/meson.build
+++ b/src/vulkan/util/meson.build
@@ -18,6 +18,23 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+# Mesa-local imports in the Python files must be declared here for correct
+# dependency tracking.
+vk_extensions_depend_files = [
+]
+vk_extensions_gen_depend_files = [
+ files('vk_extensions.py'),
+ vk_extensions_depend_files,
+]
+vk_dispatch_table_gen_depend_files = [
+ files('vk_extensions.py'),
+ vk_extensions_depend_files,
+]
+vk_entrypoints_gen_depend_files = [
+ files('vk_dispatch_table_gen.py'),
+ vk_dispatch_table_gen_depend_files,
+]
+
vk_entrypoints_gen = files('vk_entrypoints_gen.py')
vk_extensions_gen = files('vk_extensions_gen.py')
vk_icd_gen = files('vk_icd_gen.py')
@@ -55,6 +72,7 @@ vk_common_entrypoints = custom_target(
prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
'--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'vk_common',
],
+ depend_files : vk_entrypoints_gen_depend_files,
)
vk_dispatch_table = custom_target(
@@ -65,6 +83,7 @@ vk_dispatch_table = custom_target(
prog_python, '@INPUT0@', '--xml', '@INPUT1@',
'--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@'
],
+ depend_files : vk_dispatch_table_gen_depend_files,
)
vk_enum_to_str = custom_target(
@@ -85,7 +104,7 @@ vk_extensions = custom_target(
prog_python, '@INPUT0@', '--xml', '@INPUT1@',
'--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@'
],
- depend_files : files('vk_extensions.py'),
+ depend_files : vk_extensions_gen_depend_files,
)
libvulkan_util = static_library(
diff --git a/src/vulkan/util/vk_dispatch_table_gen.py b/src/vulkan/util/vk_dispatch_table_gen.py
index 8a4a07d4cdd..359437544c2 100644
--- a/src/vulkan/util/vk_dispatch_table_gen.py
+++ b/src/vulkan/util/vk_dispatch_table_gen.py
@@ -33,6 +33,8 @@ import xml.etree.ElementTree as et
from collections import OrderedDict, namedtuple
from mako.template import Template
+# Mesa-local imports must be declared in meson variable
+# '{file_without_suffix}_depend_files'.
from vk_extensions import *
# We generate a static hash table for entry point lookup
diff --git a/src/vulkan/util/vk_entrypoints_gen.py b/src/vulkan/util/vk_entrypoints_gen.py
index ef2d047ff56..6e4cdc90065 100644
--- a/src/vulkan/util/vk_entrypoints_gen.py
+++ b/src/vulkan/util/vk_entrypoints_gen.py
@@ -28,6 +28,8 @@ import os
from mako.template import Template
+# Mesa-local imports must be declared in meson variable
+# '{file_without_suffix}_depend_files'.
from vk_dispatch_table_gen import get_entrypoints_from_xml
TEMPLATE_H = Template(COPYRIGHT + """\
diff --git a/src/vulkan/util/vk_extensions_gen.py b/src/vulkan/util/vk_extensions_gen.py
index ca3a6a992cb..4f8f66c40e5 100644
--- a/src/vulkan/util/vk_extensions_gen.py
+++ b/src/vulkan/util/vk_extensions_gen.py
@@ -28,6 +28,8 @@ import xml.etree.ElementTree as et
from mako.template import Template
+# Mesa-local imports must be declared in meson variable
+# '{file_without_suffix}_depend_files'.
from vk_extensions import *
_TEMPLATE_H = Template(COPYRIGHT + """
More information about the mesa-commit
mailing list