Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[angle] Fix mingw build #19307

Merged
merged 3 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ports/angle/003-fix-mingw.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/src/common/mathutil.h b/src/common/mathutil.h
index 1d73bbf..c5b9cc8 100644
--- a/src/common/mathutil.h
+++ b/src/common/mathutil.h
@@ -1073,7 +1073,7 @@ inline int BitCount(uint64_t bits)
# endif // defined(_M_IX86) || defined(_M_X64)
#endif // defined(_MSC_VER) && !defined(__clang__)

-#if defined(ANGLE_PLATFORM_POSIX) || defined(__clang__)
+#if defined(ANGLE_PLATFORM_POSIX) || defined(__clang__) || defined(__MINGW32__)
inline int BitCount(uint32_t bits)
{
return __builtin_popcount(bits);
@@ -1083,7 +1083,7 @@ inline int BitCount(uint64_t bits)
{
return __builtin_popcountll(bits);
}
-#endif // defined(ANGLE_PLATFORM_POSIX) || defined(__clang__)
+#endif // defined(ANGLE_PLATFORM_POSIX) || defined(__clang__) || defined(__MINGW32__)

inline int BitCount(uint8_t bits)
{
17 changes: 12 additions & 5 deletions ports/angle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ if(WIN32)
"src/libANGLE/renderer/d3d/*.h"
)
list(FILTER LIBANGLE_D3D_SOURCES EXCLUDE REGEX "_unittest")
if(MINGW)
list(FILTER LIBANGLE_D3D_SOURCES EXCLUDE REGEX "CompositorNativeWindow11")
endif()

## WinRT D3D Renderer
if(WINDOWS_STORE)
Expand Down Expand Up @@ -406,8 +409,12 @@ if(WIN32)
target_compile_definitions(angle_renderer_d3d INTERFACE
-DANGLE_ENABLE_D3D11
"-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }"
-DANGLE_ENABLE_D3D11_COMPOSITOR_NATIVE_WINDOW
)
)
if(NOT MINGW)
target_compile_definitions(angle_renderer_d3d INTERFACE
-DANGLE_ENABLE_D3D11_COMPOSITOR_NATIVE_WINDOW
)
endif()
target_link_libraries(angle_renderer_d3d INTERFACE d3d11 dxguid)
add_library(angle::renderer::d3d ALIAS angle_renderer_d3d)
endif()
Expand Down Expand Up @@ -679,9 +686,9 @@ if(NOT BUILD_SHARED_LIBS)
add_definitions("-DANGLE_EXPORT=" "-DANGLE_UTIL_EXPORT=" "-DEGLAPI=" "-DGL_APICALL=" "-DGL_API=")
endif()

SET_TARGET_PROPERTIES(libANGLE PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(libGLESv2 PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(libEGL PROPERTIES PREFIX "")
set_target_properties(libANGLE PROPERTIES PREFIX "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't libANGLE be given a similar IMPORT_PREFIX ""?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libANGLE is STATIC so there is no import library:

add_library(libANGLE STATIC ${LIBANGLE_SOURCES})

set_target_properties(libGLESv2 PROPERTIES PREFIX "" IMPORT_PREFIX "")
set_target_properties(libEGL PROPERTIES PREFIX "" IMPORT_PREFIX "")

install(TARGETS libEGL libGLESv2 libANGLE angle_common angle_compression_utils angle_image_util angle_gpu_info_util angle_translator angle_preprocessor GL_VISIBILITY EXPORT ANGLEExport
RUNTIME DESTINATION bin
Expand Down
1 change: 1 addition & 0 deletions ports/angle/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ vcpkg_from_github(
PATCHES
001-fix-uwp.patch
002-fix-builder-error.patch
003-fix-mingw.patch
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
Expand Down
1 change: 1 addition & 0 deletions ports/angle/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "angle",
"version-string": "chromium_4472",
"port-version": 1,
"description": [
"A conformant OpenGL ES implementation for Windows, Mac and Linux.",
"The goal of ANGLE is to allow users of multiple operating systems to seamlessly run WebGL and other OpenGL ES content by translating OpenGL ES API calls to one of the hardware-supported APIs available for that platform. ANGLE currently provides translation from OpenGL ES 2.0 and 3.0 to desktop OpenGL, OpenGL ES, Direct3D 9, and Direct3D 11. Support for translation from OpenGL ES to Vulkan is underway, and future plans include compute shader support (ES 3.1) and MacOS support."
Expand Down
5 changes: 5 additions & 0 deletions versions/a-/angle.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d59efcadc61eb7a7be987e4dcc03540490af89b8",
"version-string": "chromium_4472",
"port-version": 1
},
{
"git-tree": "5bd610babb6f0fb15119aa94644494c0dc2bcd2c",
"version-string": "chromium_4472",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
},
"angle": {
"baseline": "chromium_4472",
"port-version": 0
"port-version": 1
},
"antlr4": {
"baseline": "4.9.1",
Expand Down