Skip to content

Commit

Permalink
Add configurations for BLS builds (#5254)
Browse files Browse the repository at this point in the history
* Add configurations for BLS builds
* Merge refs/heads/master into bls-configurations
  • Loading branch information
prestonvanloon committed Mar 31, 2020
1 parent 17516b6 commit 6edb301
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
36 changes: 33 additions & 3 deletions third_party/herumi/bls_eth_go_binary.BUILD
@@ -1,8 +1,16 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

config_setting(
name = "use_gmp",
values = {"define": "BLS_USE_GMP=true"},
)

config_setting(
name = "use_openssl",
values = {"define": "BLS_USE_OPENSSL=true"},
)

OPTS = [
"-DMCL_USE_VINT",
"-DMCL_DONT_USE_OPENSSL",
"-DMCL_LLVM_BMI2=0",
"-DMCL_USE_LLVM=1",
"-DMCL_VINT_FIXED_BUFFER",
Expand All @@ -12,7 +20,19 @@ OPTS = [
"-DCYBOZU_DONT_USE_STRING",
"-DBLS_SWAP_G",
"-DBLS_ETH",
]
] + select({
":use_gmp": [],
"//conditions:default": [
"-DMCL_USE_VINT",
],
}) + select({
":use_openssl": [],
"//conditions:default": [
"-DMCL_DONT_USE_OPENSSL",
],
})



genrule(
name = "base64_ll",
Expand Down Expand Up @@ -55,6 +75,16 @@ cc_library(
copts = OPTS + [
"-std=c++03",
],
linkopts = select({
":use_gmp": ["-lgmp"],
"//conditions:default": [],
}) + select({
":use_openssl": [
"-lssl",
"-lcrypto"
],
"//conditions:default": [],
})
)

cc_library(
Expand Down
15 changes: 0 additions & 15 deletions third_party/herumi/mcl.BUILD
@@ -1,18 +1,5 @@
package(default_visibility = ["//visibility:public"])

MCL_OPTS = [
"-DMCL_USE_VINT",
"-DMCL_DONT_USE_OPENSSL",
"-DMCL_LLVM_BMI2=0",
"-DMCL_USE_LLVM=1",
"-DMCL_VINT_FIXED_BUFFER",
"-DMCL_SIZEOF_UNIT=8",
"-DMCL_MAX_BIT_SIZE=384",
"-DCYBOZU_DONT_USE_EXCEPTION",
"-DCYBOZU_DONT_USE_STRING",
"-std=c++03 ",
]

cc_library(
name = "fp",
srcs = [
Expand Down Expand Up @@ -40,7 +27,6 @@ cc_library(
"src/proto.hpp",
"src/low_func_llvm.hpp",
],
copts = MCL_OPTS,
)

cc_library(
Expand All @@ -63,7 +49,6 @@ cc_library(
"include/mcl/operator.hpp",
],
includes = ["include"],
copts = MCL_OPTS,
)

# src_gen is a tool to generate some llvm assembly language file.
Expand Down

0 comments on commit 6edb301

Please sign in to comment.