split go and c examples
This commit is contained in:
parent
d3af35cbc6
commit
c449706594
20
test/BUILD
20
test/BUILD
@ -1,5 +1,3 @@
|
|||||||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
|
||||||
|
|
||||||
cc_binary(
|
cc_binary(
|
||||||
name = "hello",
|
name = "hello",
|
||||||
srcs = ["hello.cpp"],
|
srcs = ["hello.cpp"],
|
||||||
@ -15,21 +13,3 @@ cc_binary(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# go build -ldflags "-linkmode external -extldflags -static" hello.go
|
# go build -ldflags "-linkmode external -extldflags -static" hello.go
|
||||||
|
|
||||||
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"],
|
|
||||||
)
|
|
||||||
|
13
test/c/BUILD
Normal file
13
test/c/BUILD
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
cc_binary(
|
||||||
|
name = "hello",
|
||||||
|
srcs = ["hello.cpp"],
|
||||||
|
target_compatible_with = select({
|
||||||
|
"@platforms//os:linux": ["@com_github_ziglang_zig//:musl"],
|
||||||
|
"//conditions:default": [],
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_binary(
|
||||||
|
name = "exception",
|
||||||
|
srcs = ["exception.cpp"],
|
||||||
|
)
|
16
test/go/BUILD
Normal file
16
test/go/BUILD
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
||||||
|
|
||||||
|
# go build -ldflags "-linkmode external -extldflags -static" hello.go
|
||||||
|
go_library(
|
||||||
|
name = "go_lib",
|
||||||
|
srcs = ["hello.go"],
|
||||||
|
cgo = True,
|
||||||
|
importpath = "github.com/motiejus/bazel-zig-cc/test/go",
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
|
go_binary(
|
||||||
|
name = "go",
|
||||||
|
embed = [":go_lib"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user