~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/util/blake3/meson.build

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
files_blake3 = [
 
2
    'blake3.c',
 
3
    'blake3_dispatch.c',
 
4
    'blake3_portable.c'
 
5
]
 
6
blake3_defs = []
 
7
 
 
8
is_windows = host_machine.system() == 'windows'
 
9
is_msvc = meson.get_compiler('c').get_id() == 'msvc'
 
10
cpu_family = host_machine.cpu_family()
 
11
 
 
12
blake3_x86_no_simd_defs = ['-DBLAKE3_NO_SSE2', '-DBLAKE3_NO_SSE41', '-DBLAKE3_NO_AVX2', '-DBLAKE3_NO_AVX512']
 
13
 
 
14
if cpu_family == 'x86_64'
 
15
  if is_windows
 
16
    if is_msvc
 
17
      # An up-to-date version of Meson, not using the VS backend is needed.
 
18
      # See https://github.com/mesonbuild/meson/issues/11653
 
19
      if meson.backend() == 'ninja' and add_languages('masm', required : false)
 
20
        files_blake3 += ['blake3_sse2_x86-64_windows_msvc.masm', 'blake3_sse41_x86-64_windows_msvc.masm', 'blake3_avx2_x86-64_windows_msvc.masm', 'blake3_avx512_x86-64_windows_msvc.masm']
 
21
      else
 
22
        blake3_defs += blake3_x86_no_simd_defs
 
23
      endif
 
24
    else
 
25
      files_blake3 += ['blake3_sse2_x86-64_windows_gnu.S', 'blake3_sse41_x86-64_windows_gnu.S', 'blake3_avx2_x86-64_windows_gnu.S', 'blake3_avx512_x86-64_windows_gnu.S']
 
26
    endif
 
27
  else
 
28
    files_blake3 += ['blake3_sse2_x86-64_unix.S', 'blake3_sse41_x86-64_unix.S', 'blake3_avx2_x86-64_unix.S', 'blake3_avx512_x86-64_unix.S']
 
29
  endif
 
30
elif cpu_family == 'x86'
 
31
  # There are no assembly versions for 32-bit x86. Compiling the C versions require a different compilation flag per
 
32
  # file, which is not well supported by Meson. Leave SIMD support out for now.
 
33
  blake3_defs += blake3_x86_no_simd_defs
 
34
elif cpu_family == 'aarch64'
 
35
  files_blake3 += ['blake3_neon.c']
 
36
endif
 
37
 
 
38
blake3 = static_library(
 
39
  'blake3',
 
40
  files_blake3,
 
41
  c_args : blake3_defs,
 
42
  gnu_symbol_visibility : 'hidden',
 
43
)
 
44
 
 
45
idep_blake3 = declare_dependency(
 
46
  link_with : blake3,
 
47
)