mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-23 04:04:54 +08:00
Adding support for the bazel build system
This includes the libraries and examples. The correct implementation should automatically be configured depending on the platform.
This commit is contained in:
parent
cbcca7c837
commit
abba176643
2
.gitignore
vendored
2
.gitignore
vendored
@ -32,3 +32,5 @@ doc/html
|
|||||||
ipch
|
ipch
|
||||||
Debug
|
Debug
|
||||||
Release
|
Release
|
||||||
|
|
||||||
|
bazel-*
|
||||||
65
BUILD
Normal file
65
BUILD
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_binary")
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "serial",
|
||||||
|
deps = [
|
||||||
|
":serial_facade",
|
||||||
|
":common_impl",
|
||||||
|
] + select({
|
||||||
|
":windows": [":windows_impl"],
|
||||||
|
":linux": [":linux_impl"],
|
||||||
|
":macos": [":unix_impl"],
|
||||||
|
}),
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "serial_facade",
|
||||||
|
hdrs = glob(["**/*.h"]),
|
||||||
|
includes = ["include"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "windows_impl",
|
||||||
|
srcs = [
|
||||||
|
"src/impl/list_ports/list_ports_win.cc",
|
||||||
|
"src/impl/win.cc",
|
||||||
|
],
|
||||||
|
deps = [":serial_facade"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "linux_impl",
|
||||||
|
srcs = [
|
||||||
|
"src/impl/list_ports/list_ports_linux.cc",
|
||||||
|
"src/impl/unix.cc",
|
||||||
|
],
|
||||||
|
deps = [":serial_facade"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "common_impl",
|
||||||
|
srcs = ["src/serial.cc"],
|
||||||
|
deps = [":serial_facade"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_binary(
|
||||||
|
name = "example",
|
||||||
|
srcs = ["examples/serial_example.cc"],
|
||||||
|
deps = [":serial"],
|
||||||
|
)
|
||||||
|
|
||||||
|
config_setting(
|
||||||
|
name = "windows",
|
||||||
|
constraint_values = ["@platforms//os:windows"],
|
||||||
|
)
|
||||||
|
|
||||||
|
config_setting(
|
||||||
|
name = "linux",
|
||||||
|
constraint_values = ["@platforms//os:linux"],
|
||||||
|
)
|
||||||
|
|
||||||
|
config_setting(
|
||||||
|
name = "macos",
|
||||||
|
constraint_values = ["@platforms//os:macos"],
|
||||||
|
)
|
||||||
Loading…
x
Reference in New Issue
Block a user