From 2083a14179eb04d22feebc5751a1a145828d07cf Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 12 Dec 2017 12:22:56 -0800 Subject: [PATCH] meson: Use dependencies for nir This creates two new internal dependencies, idep_nir_headers and idep_nir. The former encapsulates the generation of nir_opcodes.h and nir_builder_opcodes.h and adding src/compiler/nir as an include path. This ensures that any target that needs nir headers will have the includes and that the generated headers will be generated before the target is build. The second, idep_nir, includes the first and additionally links to libnir. This is intended to make it easier to avoid race conditions in the build when using nir, since the number of consumers for libnir and it's headers are quite high. Acked-by: Eric Engestrom Signed-off-by: Dylan Baker --- src/amd/common/meson.build | 5 +++-- src/amd/vulkan/meson.build | 6 +++--- src/broadcom/compiler/meson.build | 4 ++-- src/compiler/glsl/meson.build | 3 ++- src/compiler/meson.build | 4 ++-- src/compiler/nir/meson.build | 18 +++++++++++++++--- src/gallium/auxiliary/meson.build | 8 +++++--- src/gallium/drivers/freedreno/meson.build | 8 ++++---- src/gallium/drivers/radeonsi/meson.build | 6 +++--- src/gallium/drivers/vc4/meson.build | 7 ++++--- src/gallium/drivers/vc5/meson.build | 7 ++++--- src/gallium/targets/xa/meson.build | 2 +- src/intel/blorp/meson.build | 3 ++- src/intel/compiler/meson.build | 12 ++++++------ src/intel/vulkan/meson.build | 12 +++++++----- src/mesa/drivers/dri/i965/meson.build | 10 +++++----- src/mesa/drivers/dri/meson.build | 4 ++-- src/mesa/meson.build | 3 ++- 18 files changed, 72 insertions(+), 50 deletions(-) diff --git a/src/amd/common/meson.build b/src/amd/common/meson.build index 43a633a493a..22c13b955fa 100644 --- a/src/amd/common/meson.build +++ b/src/amd/common/meson.build @@ -52,12 +52,13 @@ amd_common_files = files( libamd_common = static_library( 'amd_common', - [amd_common_files, sid_tables_h, nir_opcodes_h], + [amd_common_files, sid_tables_h], include_directories : [ - inc_common, inc_compiler, inc_nir, inc_mesa, inc_mapi, inc_amd, + inc_common, inc_compiler, inc_mesa, inc_mapi, inc_amd, ], dependencies : [ dep_llvm, dep_thread, dep_elf, dep_libdrm_amdgpu, dep_valgrind, + idep_nir_headers, ], c_args : [c_vis_args], cpp_args : [cpp_vis_args], diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build index 054ee5e282b..74f6399ed7f 100644 --- a/src/amd/vulkan/meson.build +++ b/src/amd/vulkan/meson.build @@ -114,19 +114,19 @@ endif libvulkan_radeon = shared_library( 'vulkan_radeon', - [libradv_files, radv_entrypoints, radv_extensions_c, nir_opcodes_h, - vk_format_table_c], + [libradv_files, radv_entrypoints, radv_extensions_c, vk_format_table_c], include_directories : [ inc_common, inc_amd, inc_amd_common, inc_compiler, inc_vulkan_util, inc_vulkan_wsi, ], link_with : [ - libamd_common, libamdgpu_addrlib, libvulkan_util, libvulkan_wsi, libnir, + libamd_common, libamdgpu_addrlib, libvulkan_util, libvulkan_wsi, libmesa_util, ], dependencies : [ dep_llvm, dep_libdrm_amdgpu, dep_thread, dep_elf, dep_dl, dep_m, dep_valgrind, + idep_nir, ], c_args : [c_vis_args, no_override_init_args, radv_flags], link_args : [ld_args_bsymbolic, ld_args_gc_sections], diff --git a/src/broadcom/compiler/meson.build b/src/broadcom/compiler/meson.build index fd4d05fdbb7..8f2ee7542c0 100644 --- a/src/broadcom/compiler/meson.build +++ b/src/broadcom/compiler/meson.build @@ -36,10 +36,10 @@ libbroadcom_compiler_files = files( ) libbroadcom_compiler = static_library( - ['broadcom_compiler', v3d_xml_pack, nir_opcodes_h, nir_builder_opcodes_h], + ['broadcom_compiler', v3d_xml_pack], libbroadcom_compiler_files, include_directories : [inc_common, inc_broadcom], c_args : [c_vis_args, no_override_init_args], - dependencies : [dep_libdrm, dep_valgrind], + dependencies : [dep_libdrm, dep_valgrind, idep_nir_headers], build_by_default : false, ) diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build index 2a6bddf4a84..b0c0de810a6 100644 --- a/src/compiler/glsl/meson.build +++ b/src/compiler/glsl/meson.build @@ -205,8 +205,9 @@ libglsl = static_library( ir_expression_operation_strings_h, ir_expression_operation_constant_h], c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], cpp_args : [cpp_vis_args, cpp_msvc_compat_args], - link_with : [libnir, libglcpp], + link_with : libglcpp, include_directories : [inc_common, inc_compiler, inc_nir], + dependencies : idep_nir, build_by_default : false, ) diff --git a/src/compiler/meson.build b/src/compiler/meson.build index 783be11c926..d86bdde61d8 100644 --- a/src/compiler/meson.build +++ b/src/compiler/meson.build @@ -58,9 +58,9 @@ subdir('nir') spirv2nir = executable( 'spirv2nir', [files('spirv/spirv2nir.c'), dummy_cpp], - dependencies : [dep_m, dep_thread], + dependencies : [dep_m, dep_thread, idep_nir], include_directories : [inc_common, inc_nir, include_directories('spirv')], - link_with : [libnir, libmesa_util], + link_with : libmesa_util, c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], build_by_default : false, ) diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build index 54cef67e9e0..b5f27ad667b 100644 --- a/src/compiler/nir/meson.build +++ b/src/compiler/nir/meson.build @@ -205,6 +205,18 @@ libnir = static_library( build_by_default : false, ) +# Headers-only dependency +idep_nir_headers = declare_dependency( + sources : [nir_opcodes_h, nir_builder_opcodes_h], + include_directories : include_directories('.'), +) + +# Also link with nir +idep_nir = declare_dependency( + dependencies : idep_nir_headers, + link_with : libnir, +) + nir_algebraic_py = files('nir_algebraic.py') if with_tests @@ -212,11 +224,11 @@ if with_tests 'nir_control_flow', executable( 'nir_control_flow_test', - [files('tests/control_flow_tests.cpp'), nir_opcodes_h], + files('tests/control_flow_tests.cpp'), c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], include_directories : [inc_common], - dependencies : [dep_thread, idep_gtest], - link_with : [libmesa_util, libnir], + dependencies : [dep_thread, idep_gtest, idep_nir], + link_with : libmesa_util, ) ) endif diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index 584cbe4509c..acef71bb3a8 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -490,14 +490,16 @@ u_format_table_c = custom_target( libgallium = static_library( 'gallium', - [files_libgallium, u_indices_gen_c, u_unfilled_gen_c, u_format_table_c, - nir_opcodes_h, nir_builder_opcodes_h], + [files_libgallium, u_indices_gen_c, u_unfilled_gen_c, u_format_table_c], include_directories : [ inc_loader, inc_gallium, inc_src, inc_include, include_directories('util') ], c_args : [c_vis_args, c_msvc_compat_args], cpp_args : [cpp_vis_args, cpp_msvc_compat_args], - dependencies : [dep_libdrm, dep_llvm, dep_unwind, dep_dl, dep_m, dep_thread], + dependencies : [ + dep_libdrm, dep_llvm, dep_unwind, dep_dl, dep_m, dep_thread, + idep_nir_headers, + ], build_by_default : false, ) diff --git a/src/gallium/drivers/freedreno/meson.build b/src/gallium/drivers/freedreno/meson.build index af288ced1a8..23c85cfa71b 100644 --- a/src/gallium/drivers/freedreno/meson.build +++ b/src/gallium/drivers/freedreno/meson.build @@ -203,7 +203,7 @@ files_libfreedreno = files( ) freedreno_includes = [ - inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_nir, + inc_src, inc_include, inc_gallium, inc_gallium_aux, include_directories('ir3') ] @@ -219,11 +219,11 @@ endif libfreedreno = static_library( 'freedreno', - [files_libfreedreno, ir3_nir_trig_c, nir_opcodes_h], + [files_libfreedreno, ir3_nir_trig_c], include_directories : freedreno_includes, c_args : [freedreno_c_args, c_vis_args], cpp_args : [freedreno_cpp_args, cpp_vis_args], - dependencies : [dep_libdrm, dep_libdrm_freedreno], + dependencies : [dep_libdrm, dep_libdrm_freedreno, idep_nir_headers], ) driver_freedreno = declare_dependency( @@ -240,11 +240,11 @@ ir3_compiler = executable( dep_libdrm_freedreno, dep_thread, dep_lmsensors, + idep_nir, ], link_with : [ libfreedreno, libgallium, - libnir, libglsl_standalone, libmesa_util, ], diff --git a/src/gallium/drivers/radeonsi/meson.build b/src/gallium/drivers/radeonsi/meson.build index 58132bf0720..97c7a412444 100644 --- a/src/gallium/drivers/radeonsi/meson.build +++ b/src/gallium/drivers/radeonsi/meson.build @@ -70,14 +70,14 @@ si_driinfo_h = custom_target( libradeonsi = static_library( 'radeonsi', - [files_libradeonsi, si_driinfo_h, nir_opcodes_h, sid_tables_h], + [files_libradeonsi, si_driinfo_h, sid_tables_h], include_directories : [ inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_amd_common, inc_gallium_drivers, ], c_args : [c_vis_args], cpp_args : [cpp_vis_args], - dependencies : dep_llvm, + dependencies : [dep_llvm, idep_nir_headers], ) driver_radeonsi = declare_dependency( @@ -85,6 +85,6 @@ driver_radeonsi = declare_dependency( sources : si_driinfo_h, link_with : [ libradeonsi, libradeon, libradeonwinsys, libamdgpuwinsys, libamd_common, - libnir, ], + dependencies : idep_nir, ) diff --git a/src/gallium/drivers/vc4/meson.build b/src/gallium/drivers/vc4/meson.build index 9b816cc8fd5..ef7e7bcac5c 100644 --- a/src/gallium/drivers/vc4/meson.build +++ b/src/gallium/drivers/vc4/meson.build @@ -101,7 +101,7 @@ endif libvc4 = static_library( 'vc4', - [files_libvc4, v3d_xml_pack, nir_opcodes_h, nir_builder_opcodes_h], + [files_libvc4, v3d_xml_pack], include_directories : [ inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_broadcom, inc_gallium_drivers, inc_drm_uapi, @@ -109,11 +109,12 @@ libvc4 = static_library( link_with: libvc4_neon, c_args : [c_vis_args, simpenrose_c_args], cpp_args : [cpp_vis_args], - dependencies : [dep_simpenrose, dep_libdrm, dep_valgrind], + dependencies : [dep_simpenrose, dep_libdrm, dep_valgrind, idep_nir_headers], build_by_default : false, ) driver_vc4 = declare_dependency( compile_args : '-DGALLIUM_VC4', - link_with : [libvc4, libvc4winsys, libbroadcom_cle, libnir], + link_with : [libvc4, libvc4winsys, libbroadcom_cle], + dependencies : idep_nir, ) diff --git a/src/gallium/drivers/vc5/meson.build b/src/gallium/drivers/vc5/meson.build index ee7fe9dc83c..deaa81fdb9d 100644 --- a/src/gallium/drivers/vc5/meson.build +++ b/src/gallium/drivers/vc5/meson.build @@ -54,17 +54,18 @@ endif libvc5 = static_library( 'vc5', - [files_libvc5, v3d_xml_pack, nir_opcodes_h, nir_builder_opcodes_h], + [files_libvc5, v3d_xml_pack], include_directories : [ inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_broadcom, inc_gallium_drivers, inc_drm_uapi, ], c_args : [c_vis_args, v3dv3_c_args], cpp_args : [cpp_vis_args, v3dv3_c_args], - dependencies : [dep_v3dv3, dep_libdrm, dep_valgrind], + dependencies : [dep_v3dv3, dep_libdrm, dep_valgrind, idep_nir_headers], ) driver_vc5 = declare_dependency( compile_args : '-DGALLIUM_VC5', - link_with : [libvc5, libvc5winsys, libbroadcom_cle, libbroadcom_vc5, libnir], + link_with : [libvc5, libvc5winsys, libbroadcom_cle, libbroadcom_vc5], + dependencies : idep_nir, ) diff --git a/src/gallium/targets/xa/meson.build b/src/gallium/targets/xa/meson.build index f25999d1603..8ff6486a5ac 100644 --- a/src/gallium/targets/xa/meson.build +++ b/src/gallium/targets/xa/meson.build @@ -40,7 +40,7 @@ libxatracker = shared_library( inc_common, inc_util, inc_gallium_winsys, inc_gallium_drivers, ], link_with : [ - libxa_st, libgalliumvl_stub, libgallium, libmesa_util, libnir, + libxa_st, libgalliumvl_stub, libgallium, libmesa_util, libpipe_loader_static, libws_null, libwsw, ], link_depends : xa_link_depends, diff --git a/src/intel/blorp/meson.build b/src/intel/blorp/meson.build index febdea97f3c..c1201b0aa16 100644 --- a/src/intel/blorp/meson.build +++ b/src/intel/blorp/meson.build @@ -30,7 +30,8 @@ files_libblorp = files( libblorp = static_library( 'blorp', - [files_libblorp, nir_opcodes_h], + files_libblorp, include_directories : [inc_common, inc_intel], c_args : [c_vis_args, no_override_init_args], + dependencies : idep_nir_headers, ) diff --git a/src/intel/compiler/meson.build b/src/intel/compiler/meson.build index 19e5926a0d9..602206c725f 100644 --- a/src/intel/compiler/meson.build +++ b/src/intel/compiler/meson.build @@ -131,11 +131,11 @@ brw_nir_trig = custom_target( libintel_compiler = static_library( 'intel_compiler', - [libintel_compiler_files, brw_nir_trig, nir_opcodes_h, nir_builder_opcodes_h, - ir_expression_operation_h], - include_directories : [inc_common, inc_intel, inc_nir], + [libintel_compiler_files, brw_nir_trig, ir_expression_operation_h], + include_directories : [inc_common, inc_intel], c_args : [c_vis_args, no_override_init_args], cpp_args : [cpp_vis_args], + dependencies : idep_nir_headers, build_by_default : false, ) @@ -148,13 +148,13 @@ if with_tests test( t, executable( - [t, nir_opcodes_h, ir_expression_operation_h], + [t, ir_expression_operation_h], 'test_@0@.cpp'.format(t), include_directories : [inc_common, inc_intel], link_with : [ - libintel_compiler, libintel_common, libnir, libmesa_util, libisl, + libintel_compiler, libintel_common, libmesa_util, libisl, ], - dependencies : [dep_thread, dep_dl, idep_gtest], + dependencies : [dep_thread, dep_dl, idep_gtest, idep_nir], ) ) endforeach diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build index 4cd7a025813..a0ec35dadc4 100644 --- a/src/intel/vulkan/meson.build +++ b/src/intel/vulkan/meson.build @@ -100,7 +100,7 @@ foreach g : [['70', ['gen7_cmd_buffer.c']], ['75', ['gen7_cmd_buffer.c']], c_vis_args, no_override_init_args, '-msse2', '-DGEN_VERSIONx10=@0@'.format(_gen), ], - dependencies : [dep_libdrm, dep_valgrind], + dependencies : [dep_libdrm, dep_valgrind, idep_nir_headers], ) endforeach @@ -153,13 +153,13 @@ endif libanv_common = static_library( 'anv_common', - [libanv_files, anv_entrypoints, anv_extensions_c, nir_opcodes_h], + [libanv_files, anv_entrypoints, anv_extensions_c], include_directories : [ inc_common, inc_intel, inc_compiler, inc_drm_uapi, inc_vulkan_util, inc_vulkan_wsi, ], c_args : [c_vis_args, no_override_init_args, '-msse2', anv_flags], - dependencies : [dep_valgrind, anv_deps, dep_libdrm], + dependencies : [dep_valgrind, anv_deps, dep_libdrm, idep_nir_headers], ) libvulkan_intel = shared_library( @@ -172,9 +172,11 @@ libvulkan_intel = shared_library( link_whole : [libanv_common, libanv_gen_libs], link_with : [ libintel_compiler, libintel_common, libisl, libblorp, libvulkan_util, - libvulkan_wsi, libnir, libmesa_util, + libvulkan_wsi, libmesa_util, + ], + dependencies : [ + dep_libdrm, dep_thread, dep_dl, dep_m, anv_deps, dep_valgrind, idep_nir, ], - dependencies : [dep_libdrm, dep_thread, dep_dl, dep_m, anv_deps, dep_valgrind], c_args : [c_vis_args, no_override_init_args, '-msse2', anv_flags], link_args : ['-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections], install : true, diff --git a/src/mesa/drivers/dri/i965/meson.build b/src/mesa/drivers/dri/i965/meson.build index 1183978b7b3..9adda06183d 100644 --- a/src/mesa/drivers/dri/i965/meson.build +++ b/src/mesa/drivers/dri/i965/meson.build @@ -138,13 +138,13 @@ i965_gen_libs = [] foreach v : ['40', '45', '50', '60', '70', '75', '80', '90', '100'] i965_gen_libs += static_library( 'libi965_gen@0@'.format(v), - ['genX_blorp_exec.c', 'genX_state_upload.c', nir_opcodes_h, gen_xml_pack], + ['genX_blorp_exec.c', 'genX_state_upload.c', gen_xml_pack], include_directories : [inc_common, inc_intel, inc_dri_common], c_args : [ c_vis_args, no_override_init_args, '-msse2', '-DGEN_VERSIONx10=@0@'.format(v), ], - dependencies : [dep_libdrm], + dependencies : [dep_libdrm, idep_nir_headers], ) endforeach @@ -166,17 +166,17 @@ endforeach libi965 = static_library( 'i965', - [files_i965, i965_oa_sources, nir_opcodes_h, ir_expression_operation_h, + [files_i965, i965_oa_sources, ir_expression_operation_h, xmlpool_options_h], include_directories : [ - inc_common, inc_intel, inc_dri_common, inc_util, inc_drm_uapi, inc_nir, + inc_common, inc_intel, inc_dri_common, inc_util, inc_drm_uapi, ], c_args : [c_vis_args, no_override_init_args, '-msse2'], cpp_args : [cpp_vis_args, '-msse2'], link_with : [ i965_gen_libs, libintel_common, libisl, libintel_compiler, libblorp, ], - dependencies : [dep_libdrm, dep_valgrind], + dependencies : [dep_libdrm, dep_valgrind, idep_nir_headers], ) dri_drivers += libi965 diff --git a/src/mesa/drivers/dri/meson.build b/src/mesa/drivers/dri/meson.build index e73ee39381e..94798b0f5da 100644 --- a/src/mesa/drivers/dri/meson.build +++ b/src/mesa/drivers/dri/meson.build @@ -48,10 +48,10 @@ if dri_drivers != [] link_whole : dri_drivers, link_with : [ libmegadriver_stub, libdricommon, libxmlconfig, libglapi, libmesa_util, - libnir, libmesa_classic, + libmesa_classic, ], dependencies : [ - dep_selinux, dep_libdrm, dep_expat, dep_m, dep_thread, dep_dl, + dep_selinux, dep_libdrm, dep_expat, dep_m, dep_thread, dep_dl, idep_nir, ], link_args : ['-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections], ) diff --git a/src/mesa/meson.build b/src/mesa/meson.build index ab6bc273129..998953d6411 100644 --- a/src/mesa/meson.build +++ b/src/mesa/meson.build @@ -687,7 +687,6 @@ files_libmesa_common += [ main_marshal_generated_h, main_dispatch_h, ir_expression_operation_h, - nir_opcodes_h, main_remap_helper_h, matypes_h, sha1_h, @@ -711,6 +710,7 @@ libmesa_classic = static_library( cpp_args : [cpp_vis_args, cpp_msvc_compat_args], include_directories : [inc_common, include_directories('main')], link_with : [libglsl, libmesa_sse41], + dependencies : idep_nir_headers, build_by_default : false, ) @@ -721,6 +721,7 @@ libmesa_gallium = static_library( cpp_args : [cpp_vis_args, cpp_msvc_compat_args], include_directories : [inc_common, include_directories('main')], link_with : [libglsl, libmesa_sse41], + dependencies : idep_nir_headers, build_by_default : false, ) -- 2.30.2