diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 000000000..48f7a71df --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +0.28.1 diff --git a/.gitignore b/.gitignore index ba197f375..814147644 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,11 @@ samplecode/**/target #generated assembly third_party/ring/pregenerated + +#Bazel +.clwb +bazel-bin +bazel-genfiles +bazel-out +bazel-rust-sgx-sdk +bazel-testlogs diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 000000000..b9626dc96 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,37 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") + +############################################## +# # +# Rust # +# # +############################################## +http_archive( + name = "io_bazel_rules_rust", + sha256 = "29d9fc1cdbd737c51db5983d1ac8e64cdc684c4683bafbcc624d3d81de92a32f", + strip_prefix = "rules_rust-8417c8954efbd0cefc8dd84517b2afff5e907d5a", + urls = [ + "https://github.com/bazelbuild/rules_rust/archive/8417c8954efbd0cefc8dd84517b2afff5e907d5a.tar.gz", + ], +) + +http_archive( + name = "bazel_skylib", + sha256 = "eb5c57e4c12e68c0c20bc774bfbc60a568e800d025557bc4ea022c6479acc867", + strip_prefix = "bazel-skylib-0.6.0", + url = "https://github.com/bazelbuild/bazel-skylib/archive/0.6.0.tar.gz", +) + +load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repository_set") + +rust_repository_set( + name = "rust_linux_x86_64", + exec_triple = "x86_64-unknown-linux-gnu", + extra_target_triples = [], + iso_date = "2019-05-22", + version = "nightly", +) + +load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version") + +bazel_version(name = "bazel_version") \ No newline at end of file diff --git a/sgx_libc/BUILD b/sgx_libc/BUILD new file mode 100644 index 000000000..7c5d2265e --- /dev/null +++ b/sgx_libc/BUILD @@ -0,0 +1,10 @@ +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") + +rust_library( + name = "sgx_libc", + srcs = glob(["src/*.rs"]), + crate_features = ["align"], + edition = "2018", + visibility = ["//visibility:public"], + deps = ["//sgx_types"], +) diff --git a/sgx_trts/BUILD b/sgx_trts/BUILD new file mode 100644 index 000000000..4027e9e96 --- /dev/null +++ b/sgx_trts/BUILD @@ -0,0 +1,12 @@ +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") + +rust_library( + name = "sgx_trts", + srcs = glob(["src/*.rs"]), + edition = "2018", + visibility = ["//visibility:public"], + deps = [ + "//sgx_libc", + "//sgx_types", + ], +) diff --git a/sgx_types/BUILD b/sgx_types/BUILD new file mode 100644 index 000000000..99de06303 --- /dev/null +++ b/sgx_types/BUILD @@ -0,0 +1,9 @@ +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") + +rust_library( + name = "sgx_types", + visibility = ["//visibility:public"], + edition = "2018", + srcs = glob(["src/*.rs"]), + deps = [], +) \ No newline at end of file