1files_blake3 = [ 2 'blake3.c', 3 'blake3_dispatch.c', 4 'blake3_portable.c' 5] 6blake3_defs = [] 7 8is_windows = host_machine.system() == 'windows' 9is_msvc = meson.get_compiler('c').get_id() == 'msvc' 10cpu_family = host_machine.cpu_family() 11 12blake3_x86_no_simd_defs = ['-DBLAKE3_NO_SSE2', '-DBLAKE3_NO_SSE41', '-DBLAKE3_NO_AVX2', '-DBLAKE3_NO_AVX512'] 13 14if 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 30elif 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 34elif cpu_family == 'aarch64' 35 files_blake3 += ['blake3_neon.c'] 36endif 37 38blake3 = static_library( 39 'blake3', 40 files_blake3, 41 c_args : blake3_defs, 42 gnu_symbol_visibility : 'hidden', 43) 44 45idep_blake3 = declare_dependency( 46 link_with : blake3, 47) 48