Fix Bazel build and make it work on Windows.

Change-Id: Ie40ce2f7c828e9f639a996e56a4d3a014c05d701
Reviewed-on: https://boringssl-review.googlesource.com/18544
Reviewed-by: Yun Peng <pcloudy@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Yun Peng <pcloudy@google.com>
This commit is contained in:
Yun Peng 2017-07-28 13:17:13 +02:00 committed by Adam Langley
parent 4d1b57ae7f
commit d363247f1e

View File

@ -26,8 +26,7 @@ load(
"fips_fragments",
"ssl_headers",
"ssl_internal_headers",
"ssl_c_sources",
"ssl_cc_sources",
"ssl_sources",
"tool_sources",
"tool_headers",
)
@ -42,7 +41,12 @@ config_setting(
values = {"cpu": "darwin"},
)
boringssl_copts = [
config_setting(
name = "windows_x86_64",
values = {"cpu": "x64_windows"},
)
posix_copts = [
# Assembler option --noexecstack adds .note.GNU-stack to each object to
# ensure that binaries can be built with non-executable stack.
"-Wa,--noexecstack",
@ -64,9 +68,15 @@ boringssl_copts = [
# operations for reference counting rather than locks. However, it's
# known not to work on some Android builds.
# "-DOPENSSL_C11_ATOMIC",
] + select({
":linux_x86_64": [],
":mac_x86_64": [],
]
boringssl_copts = select({
":linux_x86_64": posix_copts,
":mac_x86_64": posix_copts,
":windows_x86_64": [
"-DWIN32_LEAN_AND_MEAN",
"-DOPENSSL_NO_ASM",
],
"//conditions:default": ["-DOPENSSL_NO_ASM"],
})
@ -77,19 +87,31 @@ crypto_sources_asm = select({
})
# For C targets only (not C++), compile with C11 support.
boringssl_copts_c11 = boringssl_copts + [
posix_copts_c11 = [
"-std=c11",
"-Wmissing-prototypes",
"-Wold-style-definition",
"-Wstrict-prototypes",
]
# For C targets only (not C++), compile with C11 support.
boringssl_copts_cxx = boringssl_copts + [
boringssl_copts_c11 = boringssl_copts + select({
":linux_x86_64": posix_copts_c11,
":mac_x86_64": posix_copts_c11,
"//conditions:default": [],
})
# For C++ targets only (not C), compile with C++11 support.
posix_copts_cxx = [
"-std=c++11",
"-Wmissing-declarations",
]
boringssl_copts_cxx = boringssl_copts + select({
":linux_x86_64": posix_copts_cxx,
":mac_x86_64": posix_copts_cxx,
"//conditions:default": [],
})
cc_library(
name = "crypto",
srcs = crypto_sources + crypto_internal_headers + crypto_sources_asm,
@ -105,21 +127,14 @@ cc_library(
cc_library(
name = "ssl",
srcs = ssl_c_sources + ssl_internal_headers,
srcs = ssl_sources + ssl_internal_headers,
hdrs = ssl_headers,
copts = boringssl_copts_c11,
copts = boringssl_copts_cxx,
includes = ["src/include"],
visibility = ["//visibility:public"],
deps = [":crypto", ":ssl_cc"],
)
cc_library(
name = "ssl_cc",
srcs = ssl_cc_sources + ssl_internal_headers,
hdrs = ssl_headers,
copts = boringssl_copts,
includes = ["src/include"],
deps = [":crypto"],
deps = [
":crypto",
],
)
cc_binary(