From 155c01f32c46bde7ded877161a9a25e06bdc0925 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Tue, 13 Aug 2024 15:30:57 -0400 Subject: [PATCH] Add google-highway wrap --- releases.json | 8 + subprojects/google-highway.wrap | 9 + .../packagefiles/google-highway/meson.build | 154 ++++++++++++++++++ .../google-highway/meson_options.txt | 1 + 4 files changed, 172 insertions(+) create mode 100644 subprojects/google-highway.wrap create mode 100644 subprojects/packagefiles/google-highway/meson.build create mode 100644 subprojects/packagefiles/google-highway/meson_options.txt diff --git a/releases.json b/releases.json index 928d526f1..c4ae4d003 100644 --- a/releases.json +++ b/releases.json @@ -1068,6 +1068,14 @@ "1.0.7-1" ] }, + "google-highway": { + "dependency_names": [ + "highway" + ], + "versions": [ + "1.2.0-1" + ] + }, "google-snappy": { "dependency_names": [ "snappy" diff --git a/subprojects/google-highway.wrap b/subprojects/google-highway.wrap new file mode 100644 index 000000000..8318f5bbc --- /dev/null +++ b/subprojects/google-highway.wrap @@ -0,0 +1,9 @@ +[wrap-file] +directory = highway-1.2.0 +source_url = https://github.com/google/highway/releases/download/1.2.0/highway-1.2.0.tar.gz +source_filename = highway-1.2.0.tar.gz +source_hash = 58e9d5d41d6573ad15245ad76aec53a69499ca7480c092d899c4424812ed906f +patch_directory = google-highway + +[provide] +highway = google_highway_dep diff --git a/subprojects/packagefiles/google-highway/meson.build b/subprojects/packagefiles/google-highway/meson.build new file mode 100644 index 000000000..c29c6dcfb --- /dev/null +++ b/subprojects/packagefiles/google-highway/meson.build @@ -0,0 +1,154 @@ +project( + 'highway', + 'cpp', + version: '1.2.0', + license: 'Apache-2.0', +) + +highway_sources = files( + 'hwy/abort.cc', + 'hwy/aligned_allocator.cc', + 'hwy/nanobenchmark.cc', + 'hwy/per_target.cc', + 'hwy/print.cc', + 'hwy/targets.cc', + 'hwy/timer.cc', +) + +if host_machine.system() == 'windows' + add_project_arguments('-DNOMINMAX', language: 'cpp') +endif +is_shared = (get_option('default_library') != 'static') +args = is_shared ? ['-DHWY_SHARED_DEFINE', '-Dhwy_EXPORTS'] : ['-DHWY_STATIC_DEFINE'] + +lib_highway = library( + 'highway', + highway_sources, + cpp_args: args, + gnu_symbol_visibility: 'hidden', +) + +inc = include_directories('.') + +google_highway_dep = declare_dependency( + link_with: lib_highway, + include_directories: inc, +) + +if not get_option('tests').disabled() + highway_test_sources = [ + 'hwy/tests/hwy_gtest.h', + 'hwy/tests/test_util-inl.h', + 'hwy/tests/test_util.cc', + 'hwy/tests/test_util.h', + ] + + test_args = is_shared ? ['-DHWY_SHARED_DEFINE', '-Dhwy_test_EXPORTS'] : ['-DHWY_STATIC_DEFINE'] + + highway_test_lib = library( + 'highway-test', + highway_test_sources, + dependencies: [google_highway_dep], + cpp_args: test_args, + gnu_symbol_visibility: 'hidden', + ) + + highway_tests = [ + 'hwy/contrib/algo/copy_test.cc', + 'hwy/contrib/algo/find_test.cc', + 'hwy/contrib/algo/transform_test.cc', + 'hwy/abort_test.cc', + 'hwy/aligned_allocator_test.cc', + 'hwy/base_test.cc', + 'hwy/bit_set_test.cc', + 'hwy/highway_test.cc', + 'hwy/nanobenchmark_test.cc', + 'hwy/targets_test.cc', + 'hwy/examples/skeleton_test.cc', + 'hwy/tests/arithmetic_test.cc', + 'hwy/tests/bit_permute_test.cc', + 'hwy/tests/blockwise_shift_test.cc', + 'hwy/tests/blockwise_test.cc', + 'hwy/tests/cast_test.cc', + 'hwy/tests/combine_test.cc', + 'hwy/tests/compare_test.cc', + 'hwy/tests/compress_test.cc', + 'hwy/tests/convert_test.cc', + 'hwy/tests/count_test.cc', + 'hwy/tests/crypto_test.cc', + 'hwy/tests/demote_test.cc', + 'hwy/tests/div_test.cc', + 'hwy/tests/dup128_vec_test.cc', + 'hwy/tests/expand_test.cc', + 'hwy/tests/float_test.cc', + 'hwy/tests/foreach_vec_test.cc', + 'hwy/tests/if_test.cc', + 'hwy/tests/in_range_float_to_int_conv_test.cc', + 'hwy/tests/interleaved_test.cc', + 'hwy/tests/logical_test.cc', + 'hwy/tests/mask_combine_test.cc', + 'hwy/tests/mask_convert_test.cc', + 'hwy/tests/mask_mem_test.cc', + 'hwy/tests/mask_slide_test.cc', + 'hwy/tests/mask_test.cc', + 'hwy/tests/masked_arithmetic_test.cc', + 'hwy/tests/masked_minmax_test.cc', + 'hwy/tests/memory_test.cc', + 'hwy/tests/minmax_test.cc', + 'hwy/tests/mul_test.cc', + 'hwy/tests/reduction_test.cc', + 'hwy/tests/resize_test.cc', + 'hwy/tests/reverse_test.cc', + 'hwy/tests/saturated_test.cc', + 'hwy/tests/shift_test.cc', + 'hwy/tests/shuffle4_test.cc', + 'hwy/tests/slide_up_down_test.cc', + 'hwy/tests/sums_abs_diff_test.cc', + 'hwy/tests/swizzle_block_test.cc', + 'hwy/tests/swizzle_test.cc', + 'hwy/tests/table_test.cc', + 'hwy/tests/test_util_test.cc', + 'hwy/tests/truncate_test.cc', + 'hwy/tests/tuple_test.cc', + 'hwy/tests/widen_mul_test.cc', + ] + + benchmarks_no_main = [ + 'hwy/contrib/algo/copy_test.cc', + 'hwy/contrib/algo/find_test.cc', + 'hwy/contrib/algo/transform_test.cc', + 'hwy/abort_test.cc', + 'hwy/aligned_allocator_test.cc', + 'hwy/base_test.cc', + 'hwy/bit_set_test.cc', + 'hwy/highway_test.cc', + 'hwy/tests/bit_permute_test.cc', + 'hwy/nanobenchmark_test.cc', + 'hwy/targets_test.cc', + 'hwy/examples/skeleton_test.cc', + 'hwy/tests/arithmetic_test.cc', + 'hwy/tests/blockwise_shift_test.cc', + ] + + fs = import('fs') + + if host_machine.system() == 'windows' + gtest_dep = dependency('gtest') + else + gtest_dep = dependency('gtest_main') + endif + + foreach t : highway_tests + stem = fs.stem(t) + sources = highway_test_sources + t + if stem == 'skeleton_test' + sources += 'hwy/examples/skeleton.cc' + endif + + test(stem, + executable(stem, sources, + link_with: [highway_test_lib], + dependencies: [google_highway_dep, gtest_dep]) + ) + endforeach +endif diff --git a/subprojects/packagefiles/google-highway/meson_options.txt b/subprojects/packagefiles/google-highway/meson_options.txt new file mode 100644 index 000000000..388e88dd0 --- /dev/null +++ b/subprojects/packagefiles/google-highway/meson_options.txt @@ -0,0 +1 @@ +option('tests', type: 'feature', value: 'auto', description: 'Build unit tests')