Commit 6a1d2f93 by Corentin Wallez Committed by Commit Bot

Fix compilation of the Vulkan loader / layers in standalone

This commit introduces a stamping mechanism to make sure the order of build dependencies is correct. In GYP there are the following build order dependencies (between others): - A target link depends on previous target links - A target source compile depends on that target actions outputs - An action output depends on the action inputs The problem was that there were actions in vulkan_layer_utils_static that generated headers needed by vulkan_loader's sources (between others) Making a "dependencies" relationship between the two was not enough to ensure the headers were generated before the source were compiled. Instead we replicated the "stamping" mechanism used in GN using GYP actions that depend on the headers and output a dummy stamp file. This completes the build order dependencies: the sources depend on the stamp which depend on the action's input, i.e. the generated headers. BUG=angleproject:1668 Change-Id: I2de15ac2ea8f838acdbf43da1f111b28b8cc2184 Reviewed-on: https://chromium-review.googlesource.com/493892 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarFrank Henigman <fjhenigman@chromium.org>
parent 677bb6ff
#!/usr/bin/python
#
# Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# touch_stamp.py: similar to the Unix touch command, used to manual make
# stamp files when building with GYP
import os
import sys
stamp_name = sys.argv[1]
with open(stamp_name, 'a'):
os.utime(stamp_name, None)
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
['OS=="linux" and use_x11==1 and chromeos==0', ['OS=="linux" and use_x11==1 and chromeos==0',
{ {
'angle_enable_gl%': 1, 'angle_enable_gl%': 1,
'angle_enable_vulkan%': 0, 'angle_enable_vulkan%': 1,
}], }],
['OS=="mac"', ['OS=="mac"',
{ {
......
...@@ -53,6 +53,19 @@ ...@@ -53,6 +53,19 @@
'/wd4706', # Assignment within conditional expression '/wd4706', # Assignment within conditional expression
'/wd4996', # Unsafe stdlib function '/wd4996', # Unsafe stdlib function
], ],
'vulkan_layer_generated_files':
[
'<(angle_gen_path)/vulkan/vk_enum_string_helper.h',
'<(angle_gen_path)/vulkan/vk_struct_size_helper.h',
'<(angle_gen_path)/vulkan/vk_struct_size_helper.c',
'<(angle_gen_path)/vulkan/vk_safe_struct.h',
'<(angle_gen_path)/vulkan/vk_safe_struct.cpp',
'<(angle_gen_path)/vulkan/vk_layer_dispatch_table.h',
'<(angle_gen_path)/vulkan/vk_dispatch_table_helper.h',
'<(angle_gen_path)/vulkan/vk_loader_extensions.h',
'<(angle_gen_path)/vulkan/vk_loader_extensions.c',
'<@(vulkan_gen_json_files_outputs)',
],
'glslang_sources': 'glslang_sources':
[ [
'<(glslang_path)/glslang/GenericCodeGen/CodeGen.cpp', '<(glslang_path)/glslang/GenericCodeGen/CodeGen.cpp',
...@@ -873,7 +886,6 @@ ...@@ -873,7 +886,6 @@
{ {
'target_name': 'vulkan_loader', 'target_name': 'vulkan_loader',
'type': 'static_library', 'type': 'static_library',
'deps': 'vulkan_layer_utils_static',
'sources': 'sources':
[ [
'<@(vulkan_loader_sources)', '<@(vulkan_loader_sources)',
...@@ -994,6 +1006,17 @@ ...@@ -994,6 +1006,17 @@
'<(angle_gen_path)/vulkan/angle_loader.h', '<(PRODUCT_DIR)', '<(angle_gen_path)/vulkan/angle_loader.h', '<(PRODUCT_DIR)',
], ],
}, },
{
'action_name': 'vulkan_loader_order_deps',
'message': 'stamping for vulkan_loader_order_deps',
'inputs': [ '<@(vulkan_layer_generated_files)' ],
'outputs': [ '<(angle_gen_path)/vulkan/vulkan_loader_order_deps.stamp' ],
'action':
[
'python', '<(angle_path)/gyp/touch_stamp.py',
'<(angle_gen_path)/vulkan/vulkan_loader_order_deps.stamp',
]
},
], ],
}, },
...@@ -1009,6 +1032,20 @@ ...@@ -1009,6 +1032,20 @@
[ [
'<@(VkLayer_core_validation_sources)', '<@(VkLayer_core_validation_sources)',
], ],
'actions':
[
{
'action_name': 'layer_core_validation_order_deps',
'message': 'stamping for layer_core_validation_order_deps',
'inputs': [ '<@(vulkan_layer_generated_files)' ],
'outputs': [ '<(angle_gen_path)/vulkan/layer_core_validation_order_deps.stamp' ],
'action':
[
'python', '<(angle_path)/gyp/touch_stamp.py',
'<(angle_gen_path)/vulkan/layer_core_validation_order_deps.stamp',
]
},
],
'conditions': 'conditions':
[ [
['OS=="win"', ['OS=="win"',
...@@ -1032,6 +1069,20 @@ ...@@ -1032,6 +1069,20 @@
[ [
'<@(VkLayer_swapchain_sources)', '<@(VkLayer_swapchain_sources)',
], ],
'actions':
[
{
'action_name': 'layer_swapchain_order_deps',
'message': 'stamping for layer_swapchain_order_deps',
'inputs': [ '<@(vulkan_layer_generated_files)' ],
'outputs': [ '<(angle_gen_path)/vulkan/layer_swapchain_order_deps.stamp' ],
'action':
[
'python', '<(angle_path)/gyp/touch_stamp.py',
'<(angle_gen_path)/vulkan/layer_swapchain_order_deps.stamp',
]
},
],
'conditions': 'conditions':
[ [
['OS=="win"', ['OS=="win"',
...@@ -1055,6 +1106,20 @@ ...@@ -1055,6 +1106,20 @@
[ [
'<@(VkLayer_object_tracker_sources)', '<@(VkLayer_object_tracker_sources)',
], ],
'actions':
[
{
'action_name': 'layer_object_tracker_order_deps',
'message': 'stamping for layer_object_tracker_order_deps',
'inputs': [ '<@(vulkan_layer_generated_files)' ],
'outputs': [ '<(angle_gen_path)/vulkan/layer_object_tracker_order_deps.stamp' ],
'action':
[
'python', '<(angle_path)/gyp/touch_stamp.py',
'<(angle_gen_path)/vulkan/layer_object_tracker_order_deps.stamp',
]
},
],
'conditions': 'conditions':
[ [
['OS=="win"', ['OS=="win"',
...@@ -1091,6 +1156,17 @@ ...@@ -1091,6 +1156,17 @@
'actions': 'actions':
[ [
{ {
'action_name': 'layer_unique_objects_order_deps',
'message': 'stamping for layer_unique_objects_order_deps',
'inputs': [ '<@(vulkan_layer_generated_files)' ],
'outputs': [ '<(angle_gen_path)/vulkan/layer_unique_objects_order_deps.stamp' ],
'action':
[
'python', '<(angle_path)/gyp/touch_stamp.py',
'<(angle_gen_path)/vulkan/layer_unique_objects_order_deps.stamp',
]
},
{
'action_name': 'vulkan_layer_unique_objects_generate', 'action_name': 'vulkan_layer_unique_objects_generate',
'message': 'generating Vulkan unique_objects helpers', 'message': 'generating Vulkan unique_objects helpers',
'inputs': 'inputs':
...@@ -1138,6 +1214,17 @@ ...@@ -1138,6 +1214,17 @@
'actions': 'actions':
[ [
{ {
'action_name': 'layer_threading_order_deps',
'message': 'stamping for layer_threading_order_deps',
'inputs': [ '<@(vulkan_layer_generated_files)' ],
'outputs': [ '<(angle_gen_path)/vulkan/layer_threading_order_deps.stamp' ],
'action':
[
'python', '<(angle_path)/gyp/touch_stamp.py',
'<(angle_gen_path)/vulkan/layer_threading_order_deps.stamp',
]
},
{
'action_name': 'vulkan_layer_threading_generate', 'action_name': 'vulkan_layer_threading_generate',
'message': 'generating Vulkan threading header', 'message': 'generating Vulkan threading header',
'inputs': 'inputs':
...@@ -1185,6 +1272,17 @@ ...@@ -1185,6 +1272,17 @@
'actions': 'actions':
[ [
{ {
'action_name': 'layer_parameter_validation_order_deps',
'message': 'stamping for layer_parameter_validation_order_deps',
'inputs': [ '<@(vulkan_layer_generated_files)' ],
'outputs': [ '<(angle_gen_path)/vulkan/layer_parameter_validation_order_deps.stamp' ],
'action':
[
'python', '<(angle_path)/gyp/touch_stamp.py',
'<(angle_gen_path)/vulkan/layer_parameter_validation_order_deps.stamp',
]
},
{
'action_name': 'vulkan_layer_parameter_validation_generate', 'action_name': 'vulkan_layer_parameter_validation_generate',
'message': 'generating Vulkan parameter_validation header', 'message': 'generating Vulkan parameter_validation header',
'inputs': 'inputs':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment