2021-06-07 22:52:29 +03:00
|
|
|
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
|
|
|
|
2021-04-10 01:05:01 +03:00
|
|
|
cc_binary(
|
|
|
|
name = "hello",
|
|
|
|
srcs = ["hello.cpp"],
|
2021-06-07 22:10:33 +03:00
|
|
|
target_compatible_with = select({
|
|
|
|
"@platforms//os:linux": ["@com_github_ziglang_zig//:musl"],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
2021-04-10 01:05:01 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_binary(
|
|
|
|
name = "exception",
|
|
|
|
srcs = ["exception.cpp"],
|
|
|
|
)
|
2021-06-07 22:33:34 +03:00
|
|
|
|
|
|
|
# go build -ldflags "-linkmode external -extldflags -static" hello.go
|
2021-06-07 22:52:29 +03:00
|
|
|
|
|
|
|
go_library(
|
|
|
|
name = "test_lib",
|
|
|
|
srcs = [
|
|
|
|
"exception.cpp",
|
|
|
|
"hello.cpp",
|
|
|
|
"hello.go",
|
|
|
|
],
|
|
|
|
cgo = True,
|
|
|
|
importpath = "github.com/motiejus/bazel-zig-cc/test",
|
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
)
|
|
|
|
|
|
|
|
go_binary(
|
|
|
|
name = "test",
|
|
|
|
embed = [":test_lib"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|