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 <eric.engestrom@imgtec.com> Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>tags/18.0-branchpoint
@@ -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], |
@@ -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], |
@@ -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, | |||
) |
@@ -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, | |||
) | |||
@@ -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, | |||
) |
@@ -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 |
@@ -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, | |||
) | |||
@@ -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, | |||
], |
@@ -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, | |||
) |
@@ -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, | |||
) |
@@ -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, | |||
) |
@@ -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, |
@@ -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, | |||
) |
@@ -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 |
@@ -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, |
@@ -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 |
@@ -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], | |||
) |
@@ -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, | |||
) | |||