compiler: Use a meson dependency for libcompiler

That will make sure the include directories are passed on and also
make sure the generated headers are properly built before whoever code
depends on it. NIR dependency propagates that dependency too.

Since the right include directory is always propagated, we can remove
the extra "compiler/" prefix from the `#include`s in glsl_types.h.

Note: NIR has a special "header only" dependency, so include the
generated headers for compiler there too.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9843
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25314>
This commit is contained in:
Caio Oliveira 2023-09-20 11:22:22 -07:00 committed by Marge Bot
parent 9442571664
commit ec835595f0
8 changed files with 20 additions and 17 deletions

View file

@ -269,7 +269,7 @@ libglsl_standalone = static_library(
gnu_symbol_visibility : 'hidden',
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
link_with : [libglsl, libglsl_util, libglcpp_standalone],
dependencies : [idep_mesautil, idep_getopt],
dependencies : [idep_mesautil, idep_getopt, idep_compiler],
build_by_default : false,
)
@ -294,7 +294,7 @@ glsl_test = executable(
cpp_args : [cpp_msvc_compat_args],
gnu_symbol_visibility : 'hidden',
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
dependencies : [dep_clock, dep_thread, idep_getopt, idep_mesautil],
dependencies : [dep_clock, dep_thread, idep_getopt, idep_mesautil, idep_compiler],
link_with : [libglsl, libglsl_standalone, libglsl_util],
build_by_default : with_tools.contains('glsl'),
install : with_tools.contains('glsl'),

View file

@ -55,7 +55,7 @@ test(
gnu_symbol_visibility : 'hidden',
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_glsl],
link_with : [libglsl, libglsl_util],
dependencies : [dep_thread, idep_gtest, idep_mesautil],
dependencies : [dep_thread, idep_gtest, idep_mesautil, idep_compiler],
),
suite : ['compiler', 'glsl'],
protocol : 'gtest',

View file

@ -361,7 +361,7 @@ struct glsl_type {
*/
/*@{*/
#define BUILTIN_TYPES_CPP_DECLARATIONS
#include "compiler/builtin_types_cpp.h"
#include "builtin_types_cpp.h"
#undef BUILTIN_TYPES_CPP_DECLARATIONS
/*@}*/
@ -1234,7 +1234,7 @@ private:
#endif /* __cplusplus */
};
#include "compiler/builtin_types.h"
#include "builtin_types.h"
struct glsl_struct_field {
const struct glsl_type *type;
@ -1374,7 +1374,7 @@ struct glsl_struct_field {
#ifdef __cplusplus
#define BUILTIN_TYPES_CPP_DEFINITIONS
#include "compiler/builtin_types_cpp.h"
#include "builtin_types_cpp.h"
#undef BUILTIN_TYPES_CPP_DEFINITIONS
#endif

View file

@ -77,6 +77,12 @@ libcompiler = static_library(
build_by_default : false,
)
idep_compiler = declare_dependency(
sources : [ir_expression_operation_h, builtin_types_h, builtin_types_cpp_h],
include_directories : inc_compiler,
link_with : libcompiler,
)
subdir('nir')
subdir('spirv')

View file

@ -314,8 +314,7 @@ _libnir = static_library(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_compiler],
c_args : [c_msvc_compat_args, no_override_init_args],
gnu_symbol_visibility : 'hidden',
dependencies : dep_valgrind,
link_with : libcompiler,
dependencies : [idep_compiler, dep_valgrind],
build_by_default : false,
)
@ -323,13 +322,14 @@ inc_nir = include_directories('.')
# Headers-only dependency
idep_nir_headers = declare_dependency(
sources : [nir_opcodes_h, nir_builder_opcodes_h, nir_intrinsics_h, nir_intrinsics_indices_h],
include_directories : inc_nir,
sources : [nir_opcodes_h, nir_builder_opcodes_h, nir_intrinsics_h, nir_intrinsics_indices_h,
ir_expression_operation_h, builtin_types_h, builtin_types_cpp_h],
include_directories : [inc_nir, inc_compiler],
)
# Also link with nir
idep_nir = declare_dependency(
dependencies : [idep_nir_headers, idep_mesautil],
dependencies : [idep_nir_headers, idep_mesautil, idep_compiler],
link_with : _libnir,
)

View file

@ -66,11 +66,10 @@ libvtn = static_library(
vtn_gather_types_c,
vtn_generator_ids_h,
],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_compiler],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa],
c_args : [c_msvc_compat_args, no_override_init_args],
gnu_symbol_visibility : 'hidden',
dependencies : [idep_nir, dep_valgrind],
link_with : libcompiler,
build_by_default : false,
)

View file

@ -39,8 +39,8 @@ if dep_dxheaders.found() and host_machine.system() == 'windows' and with_tests
['clc_compiler_test.cpp', 'compute_test.cpp'],
link_with : [libclc_compiler],
dependencies : [idep_gtest, idep_mesautil, idep_libdxil_compiler, dep_dxheaders,
dep_spirv_tools],
include_directories : [inc_include, inc_src, inc_compiler, inc_spirv],
dep_spirv_tools, idep_compiler],
include_directories : [inc_include, inc_src, inc_spirv],
)
if build_machine.system() == 'windows'

View file

@ -224,8 +224,6 @@ libvulkan_runtime = static_library(
vk_physical_device_properties, vk_format_info],
include_directories : [inc_include, inc_src, inc_gallium],
dependencies : vulkan_runtime_deps,
# For glsl_type_singleton
link_with : libcompiler,
c_args : c_msvc_compat_args,
gnu_symbol_visibility : 'hidden',
build_by_default : false,