forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bazel support (bytecodealliance#28)
* add bazel support * add wasmtime cc_import * rename BUILD to BUILD.bazel to avoid conflict * test bazelisk * install bazelisk by go get * fix bazel test on windows * try exclude wildcard * try use cmd on bazel in windows * fmt * try abhinavsingh/setup-bazel * with version v3.3.1 * try msys2 git * fix matrix.os * use bash shell * mv git folder * fix spelling * use bazelisk back * remove pwsh * push again * fix yml * disable verify ssl to avoid reinstalling git * use C:\git\cmd rather than bin * specify target to ease problem * use msys2 * fix shell type * use mingw-gcc * omit compiler in msys2 * install gcc * add compiler option back * use mingw-gcc * remove gazelle
- Loading branch information
Showing
4 changed files
with
196 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
build | ||
/bazel-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
cc_import( | ||
name = "wasmtime", | ||
static_library = select({ | ||
"@io_bazel_rules_go//go/platform:darwin": "build/macos-x86_64/libwasmtime.a", | ||
"@io_bazel_rules_go//go/platform:linux_amd64": "build/linux-x86_64/libwasmtime.a", | ||
"@io_bazel_rules_go//go/platform:windows_amd64": "build/windows-x86_64/libwasmtime.a", | ||
}), | ||
hdrs = glob(["build/include/*.h"]), | ||
visibility = ["//visibility:public"] | ||
) | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = [ | ||
"config.go", | ||
"doc.go", | ||
"engine.go", | ||
"error.go", | ||
"exporttype.go", | ||
"extern.go", | ||
"externtype.go", | ||
"ffi.go", | ||
"freelist.go", | ||
"func.go", | ||
"functype.go", | ||
"global.go", | ||
"globaltype.go", | ||
"importtype.go", | ||
"instance.go", | ||
"limits.go", | ||
"linker.go", | ||
"maybe_gc_no.go", | ||
"memory.go", | ||
"memorytype.go", | ||
"module.go", | ||
"shims.c", | ||
"shims.h", | ||
"slab.go", | ||
"store.go", | ||
"table.go", | ||
"tabletype.go", | ||
"trap.go", | ||
"val.go", | ||
"valtype.go", | ||
"wasi.go", | ||
"wat2wasm.go", | ||
], | ||
cgo = True, | ||
clinkopts = select({ | ||
"@io_bazel_rules_go//go/platform:aix": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:android": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:darwin": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:dragonfly": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:freebsd": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:illumos": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:ios": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:js": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:linux": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:nacl": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:netbsd": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:openbsd": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:plan9": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:solaris": [ | ||
"-lwasmtime -lm -ldl", | ||
], | ||
"@io_bazel_rules_go//go/platform:windows": [ | ||
"-lwasmtime -luserenv -lole32 -lntdll -lws2_32 -lkernel32", | ||
], | ||
"//conditions:default": [], | ||
}) + select({ | ||
"@io_bazel_rules_go//go/platform:android_amd64": [ | ||
"-Lbuild/linux-x86_64", | ||
], | ||
"@io_bazel_rules_go//go/platform:darwin_amd64": [ | ||
"-Lbuild/macos-x86_64", | ||
], | ||
"@io_bazel_rules_go//go/platform:ios_amd64": [ | ||
"-Lbuild/macos-x86_64", | ||
], | ||
"@io_bazel_rules_go//go/platform:linux_amd64": [ | ||
"-Lbuild/linux-x86_64", | ||
], | ||
"@io_bazel_rules_go//go/platform:windows_amd64": [ | ||
"-Lbuild/windows-x86_64", | ||
], | ||
"//conditions:default": [], | ||
}), | ||
cdeps = [":wasmtime"], # add wasmtime dep | ||
copts = [ | ||
"-Ibuild/include", | ||
] + select({ | ||
"@io_bazel_rules_go//go/platform:windows": [ | ||
"-DWASM_API_EXTERN= -DWASI_API_EXTERN=", | ||
], | ||
"//conditions:default": [], | ||
}), | ||
importpath = "github.com/bytecodealliance/wasmtime-go", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
go_test( | ||
name = "go_default_test", | ||
srcs = [ | ||
"config_test.go", | ||
"doc_test.go", | ||
"engine_test.go", | ||
"exporttype_test.go", | ||
"func_test.go", | ||
"functype_test.go", | ||
"global_test.go", | ||
"globaltype_test.go", | ||
"importtype_test.go", | ||
"instance_test.go", | ||
"linker_test.go", | ||
"memorytype_test.go", | ||
"module_test.go", | ||
"slab_test.go", | ||
"store_test.go", | ||
"table_test.go", | ||
"tabletype_test.go", | ||
"trap_test.go", | ||
"valtype_test.go", | ||
"wasi_test.go", | ||
"wasm2wat_test.go", | ||
], | ||
embed = [":go_default_library"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "io_bazel_rules_go", | ||
sha256 = "e5de048e72612598c45f564202f6a3c74616be4ffd2dbd6f7bc75045f8ecbdce", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.23.4/rules_go-v0.23.4.tar.gz", | ||
"https://github.com/bazelbuild/rules_go/releases/download/v0.23.4/rules_go-v0.23.4.tar.gz", | ||
], | ||
) | ||
|
||
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains") | ||
|
||
go_rules_dependencies() | ||
|
||
go_register_toolchains() |