aboutsummaryrefslogtreecommitdiff
path: root/lib/libk
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libk')
-rw-r--r--lib/libk/BUILD.bazel80
-rw-r--r--lib/libk/meson.build41
2 files changed, 80 insertions, 41 deletions
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'
-)