Enable libcxx_static for Windows

- Use Win32 threads.  MinGW pthreads throws an error when building
libcxx since it's pthread_mutex_initializer is not constant (needs a
cast).
- Disable visibility annotations for libcxx and libcxxabi since we are
only going to support these as static libraries.
- Build sources for Windows platform support.
- Use SjLj exceptions for 32-bit.  libgcc_eh implements SjLj exception
model for 32-bit.
- Undefine WIN32_LEAN_AND_MEAN macro.  libcxx sources define them where
necessary.

Test: Build and test Windows binaries under Wine.

Change-Id: I76a440ff5d71eb5a3b7d57dd97e742a458ffbe16
This commit is contained in:
Pirama Arumuga Nainar
2018-08-08 10:31:09 -07:00
parent e2284c4c44
commit 5383d2f0ba

View File

@@ -70,6 +70,24 @@ cc_library_static {
linux_bionic: {
enabled: true,
},
windows: {
enabled: true,
cflags: [
"-D_LIBCPP_HAS_THREAD_API_WIN32",
"-D_LIBCXXABI_BUILDING_LIBRARY",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-UWIN32_LEAN_AND_MEAN",
],
srcs: [
"src/support/win32/*.cpp",
]
},
windows_x86: {
cflags: [
"-fsjlj-exceptions",
],
},
},
}