From 348c60112235b74add06ff0d13d948898a309e44 Mon Sep 17 00:00:00 2001 From: Hennadii Zabula Date: Fri, 23 Jun 2017 16:40:16 +0300 Subject: [PATCH 1/2] Fix uwp build --- ports/angle/001-fix-uwp.patch | 113 ++++++++++++++++++++++++++++ ports/angle/CMakeListsUwp.txt | 136 ++++++++++++++++++++++++++++++++++ ports/angle/portfile.cmake | 11 ++- 3 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 ports/angle/001-fix-uwp.patch create mode 100644 ports/angle/CMakeListsUwp.txt diff --git a/ports/angle/001-fix-uwp.patch b/ports/angle/001-fix-uwp.patch new file mode 100644 index 0000000000..bae1c87244 --- /dev/null +++ b/ports/angle/001-fix-uwp.patch @@ -0,0 +1,113 @@ +diff --git "a//src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp" "b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp" +index dd37ace8..9116b9e6 100644 +--- "a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp" ++++ "b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp" +@@ -141,6 +141,7 @@ HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, + unsigned int width, + unsigned int height, + bool containsAlpha, ++ unsigned int samples, + IDXGISwapChain1 **swapChain) + { + if (device == nullptr || factory == nullptr || swapChain == nullptr || width == 0 || +@@ -154,7 +155,7 @@ HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, + swapChainDesc.Height = height; + swapChainDesc.Format = format; + swapChainDesc.Stereo = FALSE; +- swapChainDesc.SampleDesc.Count = 1; ++ swapChainDesc.SampleDesc.Count = samples; + swapChainDesc.SampleDesc.Quality = 0; + swapChainDesc.BufferUsage = + DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER; +diff --git "a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h" "b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h" +index d43bf0ba..77b4ae95 100644 +--- "a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h" ++++ "b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h" +@@ -32,7 +32,8 @@ class CoreWindowNativeWindow : public InspectableNativeWindow, public std::enabl + DXGI_FORMAT format, + unsigned int width, + unsigned int height, +- bool containsAlpha, ++ bool containsAlpha, ++ unsigned int samples, + IDXGISwapChain1 **swapChain) override; + + protected: +diff --git "a/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h" "b/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h" +index 3e67269f..a66935ce 100644 +--- "a/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h" ++++ "b/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h" +@@ -53,6 +53,7 @@ class InspectableNativeWindow + unsigned int width, + unsigned int height, + bool containsAlpha, ++ unsigned int samples, + IDXGISwapChain1 **swapChain) = 0; + + bool getClientRect(RECT *rect) +diff --git "a/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp" "b/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp" +index 2ef2235c..284fccbb 100644 +--- "a/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp" ++++ "b/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp" +@@ -89,6 +89,7 @@ HRESULT NativeWindow11WinRT::createSwapChain(ID3D11Device *device, + DXGI_FORMAT format, + UINT width, + UINT height, ++ UINT samples, + IDXGISwapChain **swapChain) + { + if (mImpl) +@@ -96,7 +97,7 @@ HRESULT NativeWindow11WinRT::createSwapChain(ID3D11Device *device, + IDXGIFactory2 *factory2 = d3d11::DynamicCastComObject(factory); + IDXGISwapChain1 *swapChain1 = nullptr; + HRESULT result = +- mImpl->createSwapChain(device, factory2, format, width, height, mHasAlpha, &swapChain1); ++ mImpl->createSwapChain(device, factory2, format, width, height, mHasAlpha, samples, &swapChain1); + SafeRelease(factory2); + *swapChain = static_cast(swapChain1); + return result; +diff --git "a/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h" "b/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h" +index 996fd3a1..97a2c2c4 100644 +--- "a/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h" ++++ "b/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h" +@@ -34,6 +34,7 @@ class NativeWindow11WinRT : public NativeWindow11 + DXGI_FORMAT format, + UINT width, + UINT height, ++ UINT samples, + IDXGISwapChain **swapChain) override; + + void commitChange() override; +diff --git "a/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp" "b/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp" +index c6d07fc8..89d9f870 100644 +--- "a/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp" ++++ "b/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp" +@@ -246,6 +246,7 @@ HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, + unsigned int width, + unsigned int height, + bool containsAlpha, ++ unsigned int samples, + IDXGISwapChain1 **swapChain) + { + if (device == nullptr || factory == nullptr || swapChain == nullptr || width == 0 || +@@ -259,7 +260,7 @@ HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, + swapChainDesc.Height = height; + swapChainDesc.Format = format; + swapChainDesc.Stereo = FALSE; +- swapChainDesc.SampleDesc.Count = 1; ++ swapChainDesc.SampleDesc.Count = samples; + swapChainDesc.SampleDesc.Quality = 0; + swapChainDesc.BufferUsage = + DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER; +diff --git "a/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h" "b/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h" +index f9a2fc0e..dc5c804e 100644 +--- "a/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h" ++++ "b/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h" +@@ -27,6 +27,7 @@ class SwapChainPanelNativeWindow : public InspectableNativeWindow, public std::e + unsigned int width, + unsigned int height, + bool containsAlpha, ++ unsigned int samples, + IDXGISwapChain1 **swapChain) override; + + protected: diff --git a/ports/angle/CMakeListsUwp.txt b/ports/angle/CMakeListsUwp.txt new file mode 100644 index 0000000000..b339ca4e51 --- /dev/null +++ b/ports/angle/CMakeListsUwp.txt @@ -0,0 +1,136 @@ +cmake_minimum_required(VERSION 3.8) +project(angle) + +add_compile_options(/d2guard4 /Wv:18 /WX) +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /guard:cf") + +add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DANGLE_STANDALONE_BUILD -DANGLE_ENABLE_DEBUG_ANNOTATIONS) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/include/id/commit.h" "#define ANGLE_COMMIT_HASH \"invalid-hash\"\n#define ANGLE_COMMIT_HASH_SIZE 12\n#define ANGLE_COMMIT_DATE \"invalid-date\"\n") + +include_directories(include src ${CMAKE_CURRENT_BINARY_DIR}/include) + +########## +# anglebase +add_library(anglebase INTERFACE) +file(GLOB_RECURSE anglebase_SOURCES "src/common/third_party/base/*.h") +target_sources(anglebase INTERFACE ${anglebase_SOURCES}) +target_include_directories(anglebase INTERFACE src/common/third_party/base) + +########## +# angle_common +file(GLOB ANGLE_COMMON_SOURCES "src/common/*.h" "src/common/*.inl" "src/common/*.cpp") +list(FILTER ANGLE_COMMON_SOURCES EXCLUDE REGEX "_unittest|event_tracer|_linux|_mac") +add_library(angle_common STATIC ${ANGLE_COMMON_SOURCES}) +target_link_libraries(angle_common PUBLIC anglebase) + +########## +# angle_image_util +file(GLOB ANGLE_IMAGE_UTIL_SOURCES "src/image_util/*.h" "src/image_util/*.inl" "src/image_util/*.cpp") +add_library(angle_image_util STATIC ${ANGLE_IMAGE_UTIL_SOURCES}) +target_link_libraries(angle_image_util PRIVATE angle_common) + +########## +# translator +file(GLOB TRANSLATOR_SOURCES + "src/compiler/translator/glslang.l" + "src/compiler/translator/glslang.y" + "src/compiler/translator/*.h" + "src/compiler/translator/*.cpp" + "src/third_party/compiler/ArrayBoundsClamper.cpp" +) +add_library(translator STATIC ${TRANSLATOR_SOURCES}) +target_compile_definitions(translator PUBLIC + -DANGLE_ENABLE_ESSL + -DANGLE_ENABLE_GLSL + -DANGLE_ENABLE_HLSL +) +target_link_libraries(translator PRIVATE angle_common) + +########## +# preprocessor +file(GLOB PREPROCESSOR_SOURCES + "src/compiler/preprocessor/*.h" + "src/compiler/preprocessor/*.cpp" +) +add_library(preprocessor STATIC ${PREPROCESSOR_SOURCES}) +target_link_libraries(preprocessor PRIVATE angle_common) + +########## +# libANGLE +file(GLOB LIBANGLE_SOURCES + "src/third_party/systeminfo/SystemInfo.cpp" + "src/common/third_party/murmurhash/MurmurHash3.cpp" + "src/common/event_tracer.cpp" + + "src/libANGLE/*.cpp" + "src/libANGLE/*.inl" + "src/libANGLE/*.h" + + "src/libANGLE/renderer/*.cpp" + "src/libANGLE/renderer/*.inl" + "src/libANGLE/renderer/*.h" + + "src/libANGLE/renderer/null/*.cpp" + "src/libANGLE/renderer/null/*.inl" + "src/libANGLE/renderer/null/*.h" +) +file(GLOB_RECURSE LIBANGLE_D3D_SOURCES "src/libANGLE/renderer/d3d/*.h" "src/libANGLE/renderer/d3d/*.cpp" "src/libANGLE/renderer/d3d/*.inl") +list(FILTER LIBANGLE_SOURCES EXCLUDE REGEX "_unittest") +list(FILTER LIBANGLE_D3D_SOURCES EXCLUDE REGEX "_unittest|d3d9|win32") +add_library(libANGLE STATIC ${LIBANGLE_SOURCES} ${LIBANGLE_D3D_SOURCES}) +find_library(D3D11_LIB NAMES d3d11) +find_library(DXGUID_LIB NAMES dxguid) +target_link_libraries(libANGLE PRIVATE angle_common angle_image_util translator ${D3D9_LIB} ${DXGUID_LIB} preprocessor) +target_include_directories(libANGLE PRIVATE "src/third_party/khronos") + +list(APPEND ANGLE_DEFINITIONS -DANGLE_ENABLE_D3D11) +list(APPEND ANGLE_DEFINITIONS -DANGLE_ENABLE_NULL) + +target_compile_definitions(libANGLE PUBLIC + ${ANGLE_DEFINITIONS} +) +target_compile_definitions(libANGLE PRIVATE -DLIBANGLE_IMPLEMENTATION) + +########## +# libGLESv2 +file(GLOB LIBGLESV2_SOURCES "src/libGLESv2/*.h" "src/libGLESv2/*.cpp" "src/libGLESv2/libGLESv2.def") +add_library(libGLESv2 ${LIBGLESV2_SOURCES}) +target_link_libraries(libGLESv2 PRIVATE angle_common libANGLE) +target_compile_definitions(libGLESv2 PRIVATE + -DLIBGLESV2_IMPLEMENTATION + -DLIBANGLE_IMPLEMENTATION + -DGL_GLEXT_PROTOTYPES + "-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" + -DGL_APICALL= + -DEGLAPI= +) + +########## +# libEGL +add_library(libEGL "src/libEGL/libEGL.def" "src/libEGL/libEGL.cpp" "src/libEGL/libEGL.rc" "src/libEGL/resource.h") +target_link_libraries(libEGL PRIVATE angle_common libANGLE libGLESv2) +target_compile_definitions(libEGL PRIVATE + -DLIBANGLE_IMPLEMENTATION + -DGL_GLEXT_PROTOTYPES + "-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" + -DGL_APICALL= + -DEGLAPI= +) + + +install(TARGETS libEGL libGLESv2 + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +if(NOT DISABLE_INSTALL_HEADERS) + install( + DIRECTORY include/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN "GLSLANG" EXCLUDE + PATTERN "export.h" EXCLUDE + ) +endif() diff --git a/ports/angle/portfile.cmake b/ports/angle/portfile.cmake index 4668b7dea9..d2b61c9cf9 100644 --- a/ports/angle/portfile.cmake +++ b/ports/angle/portfile.cmake @@ -13,7 +13,16 @@ vcpkg_from_github( HEAD_REF master ) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +if(NOT TARGET_TRIPLET MATCHES "uwp") + file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +else() + file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeListsUwp.txt DESTINATION ${SOURCE_PATH}) + file(RENAME ${SOURCE_PATH}/CMakeListsUwp.txt ${SOURCE_PATH}/CMakeLists.txt) + vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/001-fix-uwp.patch + ) +endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} From c21a2fe38ab9523974a80194d6cea5dae6fcb76a Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 30 Jun 2017 17:33:48 -0700 Subject: [PATCH 2/2] [angle] Add preliminary UWP support --- ports/angle/CMakeLists.txt | 354 ++++++++++++++++++------------- ports/angle/CMakeListsUwp.txt | 136 ------------ ports/angle/CONTROL | 2 +- ports/angle/commit.h | 3 + ports/angle/portfile.cmake | 20 +- scripts/buildsystems/vcpkg.cmake | 7 + 6 files changed, 227 insertions(+), 295 deletions(-) delete mode 100644 ports/angle/CMakeListsUwp.txt create mode 100644 ports/angle/commit.h diff --git a/ports/angle/CMakeLists.txt b/ports/angle/CMakeLists.txt index 2d7af54cc0..5a4c053591 100644 --- a/ports/angle/CMakeLists.txt +++ b/ports/angle/CMakeLists.txt @@ -1,148 +1,206 @@ -cmake_minimum_required(VERSION 3.8) -project(angle) - -add_compile_options(/d2guard4 /Wv:18 /WX) -set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /guard:cf") - -add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DANGLE_STANDALONE_BUILD -DANGLE_ENABLE_DEBUG_ANNOTATIONS) - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/include/id/commit.h" "#define ANGLE_COMMIT_HASH \"invalid-hash\"\n#define ANGLE_COMMIT_HASH_SIZE 12\n#define ANGLE_COMMIT_DATE \"invalid-date\"\n") - -include_directories(include src ${CMAKE_CURRENT_BINARY_DIR}/include) - -########## -# anglebase -add_library(anglebase INTERFACE) -file(GLOB_RECURSE anglebase_SOURCES "src/common/third_party/base/*.h") -target_sources(anglebase INTERFACE ${anglebase_SOURCES}) -target_include_directories(anglebase INTERFACE src/common/third_party/base) - -########## -# angle_common -file(GLOB ANGLE_COMMON_SOURCES "src/common/*.h" "src/common/*.inl" "src/common/*.cpp") -list(FILTER ANGLE_COMMON_SOURCES EXCLUDE REGEX "_unittest|event_tracer|_linux|_mac") -add_library(angle_common STATIC ${ANGLE_COMMON_SOURCES}) -target_link_libraries(angle_common PUBLIC anglebase) - -########## -# angle_image_util -file(GLOB ANGLE_IMAGE_UTIL_SOURCES "src/image_util/*.h" "src/image_util/*.inl" "src/image_util/*.cpp") -add_library(angle_image_util STATIC ${ANGLE_IMAGE_UTIL_SOURCES}) -target_link_libraries(angle_image_util PRIVATE angle_common) - -########## -# translator -file(GLOB TRANSLATOR_SOURCES - "src/compiler/translator/glslang.l" - "src/compiler/translator/glslang.y" - "src/compiler/translator/*.h" - "src/compiler/translator/*.cpp" - "src/third_party/compiler/ArrayBoundsClamper.cpp" -) -add_library(translator STATIC ${TRANSLATOR_SOURCES}) -target_compile_definitions(translator PUBLIC - -DANGLE_ENABLE_ESSL - -DANGLE_ENABLE_GLSL - -DANGLE_ENABLE_HLSL -) -target_link_libraries(translator PRIVATE angle_common) - -########## -# preprocessor -file(GLOB PREPROCESSOR_SOURCES - "src/compiler/preprocessor/*.h" - "src/compiler/preprocessor/*.cpp" -) -add_library(preprocessor STATIC ${PREPROCESSOR_SOURCES}) -target_link_libraries(preprocessor PRIVATE angle_common) - -########## -# libANGLE -file(GLOB LIBANGLE_SOURCES - "src/third_party/systeminfo/SystemInfo.cpp" - "src/common/third_party/murmurhash/MurmurHash3.cpp" - "src/common/event_tracer.cpp" - - "src/libANGLE/*.cpp" - "src/libANGLE/*.inl" - "src/libANGLE/*.h" - - "src/libANGLE/renderer/*.cpp" - "src/libANGLE/renderer/*.inl" - "src/libANGLE/renderer/*.h" - - "src/libANGLE/renderer/gl/*.cpp" - "src/libANGLE/renderer/gl/*.inl" - "src/libANGLE/renderer/gl/*.h" - - "src/libANGLE/renderer/gl/wgl/*.cpp" - "src/libANGLE/renderer/gl/wgl/*.inl" - "src/libANGLE/renderer/gl/wgl/*.h" - - # "src/libANGLE/renderer/vulkan/*.cpp" - # "src/libANGLE/renderer/vulkan/*.inl" - # "src/libANGLE/renderer/vulkan/*.h" - - "src/libANGLE/renderer/null/*.cpp" - "src/libANGLE/renderer/null/*.inl" - "src/libANGLE/renderer/null/*.h" -) -file(GLOB_RECURSE LIBANGLE_D3D_SOURCES "src/libANGLE/renderer/d3d/*.h" "src/libANGLE/renderer/d3d/*.cpp" "src/libANGLE/renderer/d3d/*.inl") -list(FILTER LIBANGLE_SOURCES EXCLUDE REGEX "_unittest") -list(FILTER LIBANGLE_D3D_SOURCES EXCLUDE REGEX "_unittest|winrt") -add_library(libANGLE STATIC ${LIBANGLE_SOURCES} ${LIBANGLE_D3D_SOURCES}) -find_library(D3D9_LIB NAMES d3d9) -find_library(DXGUID_LIB NAMES dxguid) -target_link_libraries(libANGLE PRIVATE angle_common angle_image_util translator ${D3D9_LIB} ${DXGUID_LIB} preprocessor) -target_include_directories(libANGLE PRIVATE "src/third_party/khronos") -target_compile_definitions(libANGLE PUBLIC - -DANGLE_ENABLE_D3D9 - -DANGLE_ENABLE_D3D11 - -DANGLE_ENABLE_OPENGL - # -DANGLE_ENABLE_VULKAN - -DANGLE_ENABLE_NULL -) -target_compile_definitions(libANGLE PRIVATE -DLIBANGLE_IMPLEMENTATION) - -########## -# libGLESv2 -file(GLOB LIBGLESV2_SOURCES "src/libGLESv2/*.h" "src/libGLESv2/*.cpp" "src/libGLESv2/libGLESv2.def") -add_library(libGLESv2 ${LIBGLESV2_SOURCES}) -target_link_libraries(libGLESv2 PRIVATE angle_common libANGLE) -target_compile_definitions(libGLESv2 PRIVATE - -DLIBGLESV2_IMPLEMENTATION - -DLIBANGLE_IMPLEMENTATION - -DGL_GLEXT_PROTOTYPES - "-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" - -DGL_APICALL= - -DEGLAPI= -) - -########## -# libEGL -add_library(libEGL "src/libEGL/libEGL.def" "src/libEGL/libEGL.cpp" "src/libEGL/libEGL.rc" "src/libEGL/resource.h") -target_link_libraries(libEGL PRIVATE angle_common libANGLE libGLESv2) -target_compile_definitions(libEGL PRIVATE - -DLIBANGLE_IMPLEMENTATION - -DGL_GLEXT_PROTOTYPES - "-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" - -DGL_APICALL= - -DEGLAPI= -) - - -install(TARGETS libEGL libGLESv2 - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib -) - -if(NOT DISABLE_INSTALL_HEADERS) - install( - DIRECTORY include/ - DESTINATION include - FILES_MATCHING PATTERN "*.h" - PATTERN "GLSLANG" EXCLUDE - PATTERN "export.h" EXCLUDE - ) -endif() +cmake_minimum_required(VERSION 3.8) +project(angle CXX) + +if(WIN32 AND NOT WINDOWS_STORE) + set(WINDOWS_DESKTOP 1) +else() + set(WINDOWS_DESKTOP 0) +endif() + +add_compile_options(/d2guard4 /Wv:18) +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /guard:cf") + +add_definitions( + -D_CRT_SECURE_NO_DEPRECATE + -D_SCL_SECURE_NO_WARNINGS + -D_HAS_EXCEPTIONS=0 + -DNOMINMAX + -DANGLE_STANDALONE_BUILD + -DANGLE_ENABLE_DEBUG_ANNOTATIONS +) + +configure_file(commit.h include/id/commit.h COPYONLY) +include_directories(include src ${CMAKE_CURRENT_BINARY_DIR}/include) + +########## +# angle::common +file(GLOB ANGLE_COMMON_SOURCES "src/common/*.h" "src/common/*.inl" "src/common/*.cpp" "src/common/third_party/base/*.h") +list(FILTER ANGLE_COMMON_SOURCES EXCLUDE REGEX "_unittest|event_tracer|_linux|_mac") +add_library(angle_common STATIC ${ANGLE_COMMON_SOURCES}) +target_include_directories(angle_common PUBLIC src/common/third_party/base) +add_library(angle::common ALIAS angle_common) + +########## +# angle::image_util +file(GLOB ANGLE_IMAGE_UTIL_SOURCES "src/image_util/*.h" "src/image_util/*.inl" "src/image_util/*.cpp") +add_library(angle_image_util STATIC ${ANGLE_IMAGE_UTIL_SOURCES}) +target_link_libraries(angle_image_util PRIVATE angle::common) +add_library(angle::image_util ALIAS angle_image_util) + +########## +# angle::translator +file(GLOB TRANSLATOR_SOURCES + "src/compiler/translator/glslang.l" + "src/compiler/translator/glslang.y" + "src/compiler/translator/*.h" + "src/compiler/translator/*.cpp" + "src/third_party/compiler/ArrayBoundsClamper.cpp" +) +add_library(angle_translator STATIC ${TRANSLATOR_SOURCES}) +target_compile_definitions(angle_translator PUBLIC + -DANGLE_ENABLE_ESSL + -DANGLE_ENABLE_GLSL + -DANGLE_ENABLE_HLSL +) +target_link_libraries(angle_translator PRIVATE angle::common) +add_library(angle::translator ALIAS angle_translator) + +########## +# angle::preprocessor +file(GLOB PREPROCESSOR_SOURCES + "src/compiler/preprocessor/*.h" + "src/compiler/preprocessor/*.cpp" +) +add_library(angle_preprocessor STATIC ${PREPROCESSOR_SOURCES}) +target_link_libraries(angle_preprocessor PRIVATE angle::common) +add_library(angle::preprocessor ALIAS angle_preprocessor) + +########## +# libANGLE + +## OpenGL Renderer +if(WINDOWS_DESKTOP) + file(GLOB LIBANGLE_GL_SOURCES + "src/libANGLE/renderer/gl/*.cpp" + "src/libANGLE/renderer/gl/*.inl" + "src/libANGLE/renderer/gl/*.h" + + "src/libANGLE/renderer/gl/wgl/*.cpp" + "src/libANGLE/renderer/gl/wgl/*.inl" + "src/libANGLE/renderer/gl/wgl/*.h" + ) + list(FILTER LIBANGLE_GL_SOURCES EXCLUDE REGEX "_unittest") + add_library(angle_renderer_opengl INTERFACE) + target_sources(angle_renderer_opengl INTERFACE ${LIBANGLE_GL_SOURCES}) + target_compile_definitions(angle_renderer_opengl INTERFACE -DANGLE_ENABLE_OPENGL) + add_library(angle::renderer::opengl ALIAS angle_renderer_opengl) +endif() + +## All D3D Sources +file(GLOB_RECURSE LIBANGLE_D3D_SOURCES + "src/libANGLE/renderer/d3d/*.cpp" + "src/libANGLE/renderer/d3d/*.inl" + "src/libANGLE/renderer/d3d/*.h" +) +list(FILTER LIBANGLE_D3D_SOURCES EXCLUDE REGEX "_unittest") + +## WinRT D3D Renderer +if(WINDOWS_STORE) + set(LIBANGLE_D3D_WINRT_SOURCES ${LIBANGLE_D3D_SOURCES}) + list(FILTER LIBANGLE_D3D_WINRT_SOURCES INCLUDE REGEX "winrt") + add_library(angle_renderer_winrt INTERFACE) + target_sources(angle_renderer_winrt INTERFACE ${LIBANGLE_D3D_WINRT_SOURCES}) + add_library(angle::renderer::winrt ALIAS angle_renderer_winrt) +endif() + +## Win32/d3d9 D3D Renderer +if(WINDOWS_DESKTOP) + set(LIBANGLE_D3D_DESKTOP_SOURCES ${LIBANGLE_D3D_SOURCES}) + list(FILTER LIBANGLE_D3D_DESKTOP_SOURCES INCLUDE REGEX "d3d9|win32") + find_library(D3D9_LIB NAMES d3d9) + add_library(angle_renderer_win32 INTERFACE) + target_sources(angle_renderer_win32 INTERFACE ${LIBANGLE_D3D_DESKTOP_SOURCES}) + target_compile_definitions(angle_renderer_win32 INTERFACE -DANGLE_ENABLE_D3D9) + target_link_libraries(angle_renderer_win32 INTERFACE ${D3D9_LIB}) + add_library(angle::renderer::win32 ALIAS angle_renderer_win32) +endif() + +## D3D11 Base renderer +list(FILTER LIBANGLE_D3D_SOURCES EXCLUDE REGEX "winrt|d3d9|win32") +find_library(DXGUID_LIB NAMES dxguid) +find_library(D3D11_LIB NAMES d3d11) +add_library(angle_renderer_d3d INTERFACE) +target_sources(angle_renderer_d3d INTERFACE ${LIBANGLE_D3D_SOURCES}) +target_compile_definitions(angle_renderer_d3d INTERFACE + -DANGLE_ENABLE_D3D11 + "-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" +) +target_link_libraries(angle_renderer_d3d INTERFACE ${D3D11_LIB} ${DXGUID_LIB}) +add_library(angle::renderer::d3d ALIAS angle_renderer_d3d) + +## Core libANGLE library +file(GLOB LIBANGLE_SOURCES + "src/third_party/systeminfo/SystemInfo.cpp" + "src/common/third_party/murmurhash/MurmurHash3.cpp" + "src/common/event_tracer.cpp" + + "src/libANGLE/*.cpp" + "src/libANGLE/*.inl" + "src/libANGLE/*.h" + + "src/libANGLE/renderer/*.cpp" + "src/libANGLE/renderer/*.inl" + "src/libANGLE/renderer/*.h" + + "src/libANGLE/renderer/null/*.cpp" + "src/libANGLE/renderer/null/*.inl" + "src/libANGLE/renderer/null/*.h" +) +list(FILTER LIBANGLE_SOURCES EXCLUDE REGEX "_unittest") + +add_library(libANGLE STATIC ${LIBANGLE_SOURCES}) +target_link_libraries(libANGLE PRIVATE + angle::common + angle::image_util + angle::translator + angle::preprocessor + angle::renderer::d3d + $<$:angle::renderer::winrt> + $<$:angle::renderer::win32> + $<$:angle::renderer::opengl> +) +target_include_directories(libANGLE PRIVATE "src/third_party/khronos") +target_compile_definitions(libANGLE + PRIVATE -DANGLE_ENABLE_NULL + PUBLIC -DLIBANGLE_IMPLEMENTATION +) +add_library(angle::libANGLE ALIAS libANGLE) + +########## +# libGLESv2 +file(GLOB LIBGLESV2_SOURCES "src/libGLESv2/*.h" "src/libGLESv2/*.cpp" "src/libGLESv2/libGLESv2.def") +add_library(libGLESv2 ${LIBGLESV2_SOURCES}) +target_link_libraries(libGLESv2 PRIVATE angle::common angle::libANGLE) +target_compile_definitions(libGLESv2 + PRIVATE -DLIBGLESV2_IMPLEMENTATION + PUBLIC + -DGL_GLEXT_PROTOTYPES + -DGL_APICALL= + -DEGLAPI= +) + +########## +# libEGL +add_library(libEGL + "src/libEGL/libEGL.def" + "src/libEGL/libEGL.cpp" + "src/libEGL/libEGL.rc" + "src/libEGL/resource.h" +) +target_link_libraries(libEGL PRIVATE angle::common angle::libANGLE libGLESv2) + +install(TARGETS libEGL libGLESv2 + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +if(NOT DISABLE_INSTALL_HEADERS) + install( + DIRECTORY include/ + DESTINATION include + FILES_MATCHING PATTERN "*.h" + PATTERN "GLSLANG" EXCLUDE + PATTERN "export.h" EXCLUDE + ) +endif() diff --git a/ports/angle/CMakeListsUwp.txt b/ports/angle/CMakeListsUwp.txt deleted file mode 100644 index b339ca4e51..0000000000 --- a/ports/angle/CMakeListsUwp.txt +++ /dev/null @@ -1,136 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(angle) - -add_compile_options(/d2guard4 /Wv:18 /WX) -set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /guard:cf") - -add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DANGLE_STANDALONE_BUILD -DANGLE_ENABLE_DEBUG_ANNOTATIONS) - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/include/id/commit.h" "#define ANGLE_COMMIT_HASH \"invalid-hash\"\n#define ANGLE_COMMIT_HASH_SIZE 12\n#define ANGLE_COMMIT_DATE \"invalid-date\"\n") - -include_directories(include src ${CMAKE_CURRENT_BINARY_DIR}/include) - -########## -# anglebase -add_library(anglebase INTERFACE) -file(GLOB_RECURSE anglebase_SOURCES "src/common/third_party/base/*.h") -target_sources(anglebase INTERFACE ${anglebase_SOURCES}) -target_include_directories(anglebase INTERFACE src/common/third_party/base) - -########## -# angle_common -file(GLOB ANGLE_COMMON_SOURCES "src/common/*.h" "src/common/*.inl" "src/common/*.cpp") -list(FILTER ANGLE_COMMON_SOURCES EXCLUDE REGEX "_unittest|event_tracer|_linux|_mac") -add_library(angle_common STATIC ${ANGLE_COMMON_SOURCES}) -target_link_libraries(angle_common PUBLIC anglebase) - -########## -# angle_image_util -file(GLOB ANGLE_IMAGE_UTIL_SOURCES "src/image_util/*.h" "src/image_util/*.inl" "src/image_util/*.cpp") -add_library(angle_image_util STATIC ${ANGLE_IMAGE_UTIL_SOURCES}) -target_link_libraries(angle_image_util PRIVATE angle_common) - -########## -# translator -file(GLOB TRANSLATOR_SOURCES - "src/compiler/translator/glslang.l" - "src/compiler/translator/glslang.y" - "src/compiler/translator/*.h" - "src/compiler/translator/*.cpp" - "src/third_party/compiler/ArrayBoundsClamper.cpp" -) -add_library(translator STATIC ${TRANSLATOR_SOURCES}) -target_compile_definitions(translator PUBLIC - -DANGLE_ENABLE_ESSL - -DANGLE_ENABLE_GLSL - -DANGLE_ENABLE_HLSL -) -target_link_libraries(translator PRIVATE angle_common) - -########## -# preprocessor -file(GLOB PREPROCESSOR_SOURCES - "src/compiler/preprocessor/*.h" - "src/compiler/preprocessor/*.cpp" -) -add_library(preprocessor STATIC ${PREPROCESSOR_SOURCES}) -target_link_libraries(preprocessor PRIVATE angle_common) - -########## -# libANGLE -file(GLOB LIBANGLE_SOURCES - "src/third_party/systeminfo/SystemInfo.cpp" - "src/common/third_party/murmurhash/MurmurHash3.cpp" - "src/common/event_tracer.cpp" - - "src/libANGLE/*.cpp" - "src/libANGLE/*.inl" - "src/libANGLE/*.h" - - "src/libANGLE/renderer/*.cpp" - "src/libANGLE/renderer/*.inl" - "src/libANGLE/renderer/*.h" - - "src/libANGLE/renderer/null/*.cpp" - "src/libANGLE/renderer/null/*.inl" - "src/libANGLE/renderer/null/*.h" -) -file(GLOB_RECURSE LIBANGLE_D3D_SOURCES "src/libANGLE/renderer/d3d/*.h" "src/libANGLE/renderer/d3d/*.cpp" "src/libANGLE/renderer/d3d/*.inl") -list(FILTER LIBANGLE_SOURCES EXCLUDE REGEX "_unittest") -list(FILTER LIBANGLE_D3D_SOURCES EXCLUDE REGEX "_unittest|d3d9|win32") -add_library(libANGLE STATIC ${LIBANGLE_SOURCES} ${LIBANGLE_D3D_SOURCES}) -find_library(D3D11_LIB NAMES d3d11) -find_library(DXGUID_LIB NAMES dxguid) -target_link_libraries(libANGLE PRIVATE angle_common angle_image_util translator ${D3D9_LIB} ${DXGUID_LIB} preprocessor) -target_include_directories(libANGLE PRIVATE "src/third_party/khronos") - -list(APPEND ANGLE_DEFINITIONS -DANGLE_ENABLE_D3D11) -list(APPEND ANGLE_DEFINITIONS -DANGLE_ENABLE_NULL) - -target_compile_definitions(libANGLE PUBLIC - ${ANGLE_DEFINITIONS} -) -target_compile_definitions(libANGLE PRIVATE -DLIBANGLE_IMPLEMENTATION) - -########## -# libGLESv2 -file(GLOB LIBGLESV2_SOURCES "src/libGLESv2/*.h" "src/libGLESv2/*.cpp" "src/libGLESv2/libGLESv2.def") -add_library(libGLESv2 ${LIBGLESV2_SOURCES}) -target_link_libraries(libGLESv2 PRIVATE angle_common libANGLE) -target_compile_definitions(libGLESv2 PRIVATE - -DLIBGLESV2_IMPLEMENTATION - -DLIBANGLE_IMPLEMENTATION - -DGL_GLEXT_PROTOTYPES - "-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" - -DGL_APICALL= - -DEGLAPI= -) - -########## -# libEGL -add_library(libEGL "src/libEGL/libEGL.def" "src/libEGL/libEGL.cpp" "src/libEGL/libEGL.rc" "src/libEGL/resource.h") -target_link_libraries(libEGL PRIVATE angle_common libANGLE libGLESv2) -target_compile_definitions(libEGL PRIVATE - -DLIBANGLE_IMPLEMENTATION - -DGL_GLEXT_PROTOTYPES - "-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" - -DGL_APICALL= - -DEGLAPI= -) - - -install(TARGETS libEGL libGLESv2 - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib -) - -if(NOT DISABLE_INSTALL_HEADERS) - install( - DIRECTORY include/ - DESTINATION include - FILES_MATCHING PATTERN "*.h" - PATTERN "GLSLANG" EXCLUDE - PATTERN "export.h" EXCLUDE - ) -endif() diff --git a/ports/angle/CONTROL b/ports/angle/CONTROL index 4f5f8880da..a7e261bb1e 100644 --- a/ports/angle/CONTROL +++ b/ports/angle/CONTROL @@ -1,4 +1,4 @@ Source: angle -Version: 2017-06-14-8d471f +Version: 2017-06-14-8d471f-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. diff --git a/ports/angle/commit.h b/ports/angle/commit.h new file mode 100644 index 0000000000..57a20e3b7c --- /dev/null +++ b/ports/angle/commit.h @@ -0,0 +1,3 @@ +#define ANGLE_COMMIT_HASH "invalid-hash" +#define ANGLE_COMMIT_HASH_SIZE 12 +#define ANGLE_COMMIT_DATE "invalid-date" diff --git a/ports/angle/portfile.cmake b/ports/angle/portfile.cmake index d2b61c9cf9..aebf528dd7 100644 --- a/ports/angle/portfile.cmake +++ b/ports/angle/portfile.cmake @@ -5,6 +5,10 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL static) set(VCPKG_LIBRARY_LINKAGE dynamic) endif() +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "ANGLE currently only supports being built for desktop") +endif() + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO google/angle @@ -12,17 +16,13 @@ vcpkg_from_github( SHA512 b9235d2a98330bc8533c3fe871129e7235c680420eac16610eae4ca7224c5284313ab6377f30ddfb8a2da39b69f3ef0d16023fe1e7cec3fc2198f4eb4bdccb26 HEAD_REF master ) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/001-fix-uwp.patch +) -if(NOT TARGET_TRIPLET MATCHES "uwp") - file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) -else() - file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeListsUwp.txt DESTINATION ${SOURCE_PATH}) - file(RENAME ${SOURCE_PATH}/CMakeListsUwp.txt ${SOURCE_PATH}/CMakeLists.txt) - vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES ${CMAKE_CURRENT_LIST_DIR}/001-fix-uwp.patch - ) -endif() +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/commit.h DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 513c33ecba..41bdb3e60a 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -140,3 +140,10 @@ if(NOT VCPKG_TOOLCHAIN) set(VCPKG_TOOLCHAIN ON) endif() + +set(_UNUSED ${CMAKE_TOOLCHAIN_FILE}) +set(_UNUSED ${CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION}) +set(_UNUSED ${CMAKE_EXPORT_NO_PACKAGE_REGISTRY}) +set(_UNUSED ${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY}) +set(_UNUSED ${CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY}) +set(_UNUSED ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP})