diff options
author | aqua <aqua@iserlohn-fortress.net> | 2024-03-08 17:24:49 +0200 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2024-03-08 22:00:07 +0200 |
commit | 20b97ea7c0dbbdc13800e12ff5c86c00c4a342ec (patch) | |
tree | 473281e5fc8b256827ce1a678573444e1aa5f669 /lib | |
parent | Generate src/conf.h (diff) | |
download | kernel-20b97ea7c0dbbdc13800e12ff5c86c00c4a342ec.tar.xz |
Bazel build
Diffstat (limited to 'lib')
-rw-r--r-- | lib/blake2/BUILD.bazel | 28 | ||||
-rw-r--r-- | lib/blake2/blake2s_kat.h (renamed from lib/blake2/tests/blake2s_kat.h) | 0 | ||||
-rw-r--r-- | lib/blake2/blake2s_selftest.cc (renamed from lib/blake2/tests/blake2s_selftest.cc) | 0 | ||||
-rw-r--r-- | lib/blake2/meson.build | 24 | ||||
-rw-r--r-- | lib/libk/BUILD.bazel | 80 | ||||
-rw-r--r-- | lib/libk/meson.build | 41 |
6 files changed, 108 insertions, 65 deletions
diff --git a/lib/blake2/BUILD.bazel b/lib/blake2/BUILD.bazel new file mode 100644 index 0000000..4723ae6 --- /dev/null +++ b/lib/blake2/BUILD.bazel @@ -0,0 +1,28 @@ +package(default_visibility = ["//visibility:public"]) + +cc_library( + name = "blake2s", + srcs = ["blake2s.c"], + hdrs = ["include/blake2s.h"], + includes = ["include"], + deps = select({ + "@platforms//os:none": ["//lib/libk:k"], + "//conditions:default": [], + }), +) + +cc_test( + name = "test_blake2s", + srcs = [ + "blake2s_kat.h", + "blake2s_selftest.cc", + ], + target_compatible_with = select({ + "@platforms//os:none": ["@platforms//:incompatible"], + "//conditions:default": [], + }), + deps = [ + "//lib/blake2:blake2s", + "@googletest//:gtest_main", + ], +) diff --git a/lib/blake2/tests/blake2s_kat.h b/lib/blake2/blake2s_kat.h index dec250a..dec250a 100644 --- a/lib/blake2/tests/blake2s_kat.h +++ b/lib/blake2/blake2s_kat.h diff --git a/lib/blake2/tests/blake2s_selftest.cc b/lib/blake2/blake2s_selftest.cc index 420544d..420544d 100644 --- a/lib/blake2/tests/blake2s_selftest.cc +++ b/lib/blake2/blake2s_selftest.cc diff --git a/lib/blake2/meson.build b/lib/blake2/meson.build deleted file mode 100644 index dc06f3e..0000000 --- a/lib/blake2/meson.build +++ /dev/null @@ -1,24 +0,0 @@ - -blake2s_srcs = files('blake2s.c') -blake2s_incl = include_directories('include') - -blake2s = declare_dependency( - link_with: static_library('blake2s', blake2s_srcs, - include_directories: blake2s_incl, - dependencies: libk), - include_directories: blake2s_incl, -) - -# tests -blake2s_sut = declare_dependency( - link_with: library('blake2s_sut', blake2s_srcs, - include_directories: blake2s_incl, - native: true), - include_directories: blake2s_incl, -) - -test('blake2s selftest', - executable('test_blake2s_selftest', 'tests/blake2s_selftest.cc', - dependencies: [ blake2s_sut, gtest ], - native: true) -) diff --git a/lib/libk/BUILD.bazel b/lib/libk/BUILD.bazel new file mode 100644 index 0000000..51b4c1b --- /dev/null +++ b/lib/libk/BUILD.bazel @@ -0,0 +1,80 @@ +filegroup( + name = "k_srcs", + srcs = [ + "endian/little.c", + "stdio/fprintf.c", + "stdio/printf.c", + "stdio/vfprintf.c", + "stdlib/linked_list_allocator.c", + "stdlib/memcpy.c", + "stdlib/memset.c", + "string/itoa.c", + ], +) + +cc_library( + name = "k", + srcs = [":k_srcs"], + hdrs = glob(["include/*.h"]), + includes = ["include"], + target_compatible_with = [ + "@platforms//os:none", + ], + visibility = ["//visibility:public"], +) + +# tests +cc_library( + name = "k_sut", + includes = ["."], + target_compatible_with = select({ + "@platforms//os:none": ["@platforms//:incompatible"], + "//conditions:default": [], + }), + textual_hdrs = [":k_srcs"], +) + +cc_test( + name = "test_endian_little", + srcs = [ + "endian/test_endian_little.cc", + ], + deps = [ + ":k_sut", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "test_linked_list_allocator", + srcs = [ + "stdlib/test_allocator.hh", + "stdlib/test_linked_list_allocator.cc", + ], + deps = [ + ":k_sut", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "test_mem", + srcs = [ + "stdlib/test_mem.cc", + ], + deps = [ + ":k_sut", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "test_string", + srcs = [ + "string/test_string.cc", + ], + deps = [ + ":k_sut", + "@googletest//:gtest_main", + ], +) diff --git a/lib/libk/meson.build b/lib/libk/meson.build deleted file mode 100644 index 669780b..0000000 --- a/lib/libk/meson.build +++ /dev/null @@ -1,41 +0,0 @@ - -libk_srcs = files( - 'endian/little.c', - 'stdio/printf.c', 'stdio/fprintf.c', 'stdio/vfprintf.c', - 'stdlib/memcpy.c', 'stdlib/memset.c', 'stdlib/linked_list_allocator.c', - 'string/itoa.c') -libk_incl = include_directories('include') - -libk = declare_dependency( - link_with: static_library('k', libk_srcs, include_directories: libk_incl), - include_directories: libk_incl, -) - -# tests -test('endian little', - executable('test_endian_little', 'endian/test_endian_little.cc', - dependencies: [ gtest ], - native: true), - suite: 'libk' -) - -test('linked list allocator', - executable('test_linked_list_allocator', 'stdlib/test_linked_list_allocator.cc', - dependencies: [ gtest ], - native: true), - suite: 'libk' -) - -test('mem', - executable('test_mem', 'stdlib/test_mem.cc', - dependencies: [ gtest ], - native: true), - suite: 'libk' -) - -test('string', - executable('test_string', 'string/test_string.cc', - dependencies: [ gtest ], - native: true), - suite: 'libk' -) |