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>
diff --git a/util/BUILD.toplevel b/util/BUILD.toplevel index 68a17a6..af7bd30 100644 --- a/util/BUILD.toplevel +++ b/util/BUILD.toplevel
@@ -26,8 +26,7 @@ "fips_fragments", "ssl_headers", "ssl_internal_headers", - "ssl_c_sources", - "ssl_cc_sources", + "ssl_sources", "tool_sources", "tool_headers", ) @@ -42,7 +41,12 @@ 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 @@ # 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 @@ }) # 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( 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(