diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/angle/cmake-buildsystem/cmake | |
Diffstat (limited to 'vcpkg/ports/angle/cmake-buildsystem/cmake')
4 files changed, 362 insertions, 0 deletions
diff --git a/vcpkg/ports/angle/cmake-buildsystem/cmake/DetectSSE2.cmake b/vcpkg/ports/angle/cmake-buildsystem/cmake/DetectSSE2.cmake new file mode 100644 index 0000000..cdd1ac5 --- /dev/null +++ b/vcpkg/ports/angle/cmake-buildsystem/cmake/DetectSSE2.cmake @@ -0,0 +1,63 @@ +# https://github.com/WebKit/WebKit/blob/0742522b24152262b04913242cb0b3c48de92ba0/Source/cmake/DetectSSE2.cmake + +################################# +# Check for the presence of SSE2. +# +# Once done, this will define: +# - SSE2_SUPPORT_FOUND - the system supports (at least) SSE2. +# +# Copyright (c) 2014, Pablo Fernandez Alcantarilla, Jesus Nuevo +# Copyright (c) 2019, Igalia S.L. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# * Neither the name of the copyright holders nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set(SSE2_SUPPORT_FOUND FALSE) + +macro(CHECK_FOR_SSE2) + include(CheckCXXSourceRuns) + + check_cxx_source_runs(" + #include <emmintrin.h> + int main () + { + __m128d a, b; + double vals[2] = {0}; + a = _mm_loadu_pd (vals); + b = _mm_add_pd (a,a); + _mm_storeu_pd (vals,b); + return 0; + }" + HAVE_SSE2_EXTENSIONS) + + if (COMPILER_IS_GCC_OR_CLANG OR (MSVC AND NOT CMAKE_CL_64)) + if (HAVE_SSE2_EXTENSIONS) + set(SSE2_SUPPORT_FOUND TRUE) + message(STATUS "Found SSE2 extensions") + endif () + endif () + +endmacro(CHECK_FOR_SSE2) + +CHECK_FOR_SSE2()
\ No newline at end of file diff --git a/vcpkg/ports/angle/cmake-buildsystem/cmake/WebKitCommon-minimal.cmake b/vcpkg/ports/angle/cmake-buildsystem/cmake/WebKitCommon-minimal.cmake new file mode 100644 index 0000000..894cf9c --- /dev/null +++ b/vcpkg/ports/angle/cmake-buildsystem/cmake/WebKitCommon-minimal.cmake @@ -0,0 +1,192 @@ +# VCPKG NOTE: A minimal version of WebKit's https://github.com/WebKit/WebKit/blob/647e67b23883960fef8890465c0f70d7ab6e63f1/Source/cmake/WebKitCommon.cmake +# To support the adapted ANGLE CMake buildsystem + +# ----------------------------------------------------------------------------- +# This file is included individually from various subdirectories (JSC, WTF, +# WebCore, WebKit) in order to allow scripts to build only part of WebKit. +# We want to run this file only once. +# ----------------------------------------------------------------------------- +if (NOT HAS_RUN_WEBKIT_COMMON) + set(HAS_RUN_WEBKIT_COMMON TRUE) + + if (NOT CMAKE_BUILD_TYPE) + message(WARNING "No CMAKE_BUILD_TYPE value specified, defaulting to RelWithDebInfo.") + set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE) + else () + message(STATUS "The CMake build type is: ${CMAKE_BUILD_TYPE}") + endif () + + # ----------------------------------------------------------------------------- + # Determine which port will be built + # ----------------------------------------------------------------------------- + set(ALL_PORTS + AppleWin + Efl + FTW + GTK + JSCOnly + Mac + PlayStation + WPE + WinCairo + Linux # VCPKG EDIT: Add "Linux" so it's properly supported for ANGLE build + Win # VCPKG EDIT: Add "Win" so it's properly supported for ANGLE build + ) + set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})") + + list(FIND ALL_PORTS ${PORT} RET) + if (${RET} EQUAL -1) + if (APPLE) + set(PORT "Mac") + else () + message(WARNING "Please choose which WebKit port to build (one of ${ALL_PORTS})") + endif () + endif () + + string(TOLOWER ${PORT} WEBKIT_PORT_DIR) + + # ----------------------------------------------------------------------------- + # Determine the compiler + # ----------------------------------------------------------------------------- + if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") + set(COMPILER_IS_CLANG ON) + endif () + + if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "9.3.0") + message(FATAL_ERROR "GCC 9.3 or newer is required to build WebKit. Use a newer GCC version or Clang.") + endif () + endif () + + if (CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG) + set(COMPILER_IS_GCC_OR_CLANG ON) + endif () + + if (MSVC AND COMPILER_IS_CLANG) + set(COMPILER_IS_CLANG_CL ON) + endif () + + # ----------------------------------------------------------------------------- + # Determine the target processor + # ----------------------------------------------------------------------------- + # Use MSVC_CXX_ARCHITECTURE_ID instead of CMAKE_SYSTEM_PROCESSOR when defined, + # since the later one just resolves to the host processor on Windows. + if (MSVC_CXX_ARCHITECTURE_ID) + string(TOLOWER ${MSVC_CXX_ARCHITECTURE_ID} LOWERCASE_CMAKE_SYSTEM_PROCESSOR) + else () + string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR) + endif () + if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(^aarch64|^arm64|^cortex-?[am][2-7][2-8])") + set(WTF_CPU_ARM64 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(^arm|^cortex)") + set(WTF_CPU_ARM 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips64") + set(WTF_CPU_MIPS64 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") + set(WTF_CPU_MIPS 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)") + # FORCE_32BIT is set in the build script when --32-bit is passed + # on a Linux/intel 64bit host. This allows us to produce 32bit + # binaries without setting the build up as a crosscompilation, + # which is the only way to modify CMAKE_SYSTEM_PROCESSOR. + if (FORCE_32BIT) + set(WTF_CPU_X86 1) + else () + set(WTF_CPU_X86_64 1) + endif () + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)") + set(WTF_CPU_X86 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc") + set(WTF_CPU_PPC 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64") + set(WTF_CPU_PPC64 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le") + set(WTF_CPU_PPC64LE 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^riscv64") + set(WTF_CPU_RISCV64 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^loongarch64") + set(WTF_CPU_LOONGARCH64 1) + else () + set(WTF_CPU_UNKNOWN 1) + endif () + + # ----------------------------------------------------------------------------- + # Determine the operating system + # ----------------------------------------------------------------------------- + if (UNIX) + if (APPLE) + set(WTF_OS_MAC_OS_X 1) + elseif (CMAKE_SYSTEM_NAME MATCHES "Linux") + set(WTF_OS_LINUX 1) + else () + set(WTF_OS_UNIX 1) + endif () + elseif (CMAKE_SYSTEM_NAME MATCHES "Windows") + set(WTF_OS_WINDOWS 1) + elseif (CMAKE_SYSTEM_NAME MATCHES "Fuchsia") + set(WTF_OS_FUCHSIA 1) + else () + message(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'") + endif () + + # ----------------------------------------------------------------------------- + # Default library types + # ----------------------------------------------------------------------------- + + set(CMAKE_POSITION_INDEPENDENT_CODE True) + + # ----------------------------------------------------------------------------- + # Default output directories, which can be overwritten by ports + #------------------------------------------------------------------------------ + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + + # ----------------------------------------------------------------------------- + # Find common packages (used by all ports) + # ----------------------------------------------------------------------------- + if (WIN32) + list(APPEND CMAKE_PROGRAM_PATH $ENV{SystemDrive}/cygwin/bin) + endif () + + # ----------------------------------------------------------------------------- + # Helper macros and feature defines + # ----------------------------------------------------------------------------- + + # To prevent multiple inclusion, most modules should be included once here. + include(CheckCCompilerFlag) + include(CheckCXXCompilerFlag) + include(CheckCXXSourceCompiles) + include(CheckFunctionExists) + include(CheckIncludeFile) + include(CheckSymbolExists) + include(CheckStructHasMember) + include(CheckTypeSize) + include(CMakeDependentOption) + include(CMakeParseArguments) + include(CMakePushCheckState) + include(ProcessorCount) + + # include(WebKitPackaging) + include(WebKitMacros-minimal) + # include(WebKitFS) + # include(WebKitCCache) + include(WebKitCompilerFlags-minimal) + # include(WebKitStaticAnalysis) + # include(WebKitFeatures) + # include(WebKitFindPackage) + + # include(OptionsCommon) + # include(Options${PORT}) + + # ----------------------------------------------------------------------------- + # Job pool to avoid running too many memory hungry linker processes + # ----------------------------------------------------------------------------- + if (${CMAKE_BUILD_TYPE} STREQUAL "Release" OR ${CMAKE_BUILD_TYPE} STREQUAL "MinSizeRel") + set_property(GLOBAL PROPERTY JOB_POOLS link_pool_jobs=4) + else () + set_property(GLOBAL PROPERTY JOB_POOLS link_pool_jobs=2) + endif () + set(CMAKE_JOB_POOL_LINK link_pool_jobs) + +endif () diff --git a/vcpkg/ports/angle/cmake-buildsystem/cmake/WebKitCompilerFlags-minimal.cmake b/vcpkg/ports/angle/cmake-buildsystem/cmake/WebKitCompilerFlags-minimal.cmake new file mode 100644 index 0000000..d259276 --- /dev/null +++ b/vcpkg/ports/angle/cmake-buildsystem/cmake/WebKitCompilerFlags-minimal.cmake @@ -0,0 +1,58 @@ +# VCPKG NOTE: A minimal version of WebKit's https://github.com/WebKit/WebKit/blob/0742522b24152262b04913242cb0b3c48de92ba0/Source/cmake/WebKitCompilerFlags.cmake +# To support the adapted ANGLE CMake buildsystem + +# Checks whether all the given compiler flags are supported by the compiler. +# The _compiler may be either "C" or "CXX", and the result from the check +# will be stored in the variable named by _result. +function(WEBKIT_CHECK_COMPILER_FLAGS _compiler _result) + string(TOUPPER "${_compiler}" _compiler) + set(${_result} FALSE PARENT_SCOPE) + foreach (_flag IN LISTS ARGN) + # If an equals (=) character is present in a variable name, it will + # not be cached correctly, and the check will be retried ad nauseam. + string(REPLACE "=" "__" _cachevar "${_compiler}_COMPILER_SUPPORTS_${_flag}") + if (${_compiler} STREQUAL CXX) + check_cxx_compiler_flag("${_flag}" "${_cachevar}") + elseif (${_compiler} STREQUAL C) + check_c_compiler_flag("${_flag}" "${_cachevar}") + else () + set(${_cachevar} FALSE CACHE INTERNAL "" FORCE) + message(WARNING "WEBKIT_CHECK_COMPILER_FLAGS: unknown compiler '${_compiler}'") + return() + endif () + if (NOT ${_cachevar}) + return() + endif () + endforeach () + set(${_result} TRUE PARENT_SCOPE) +endfunction() + + +# Appends flags to COMPILE_OPTIONS of _subject if supported by the C +# or CXX _compiler. The _subject argument depends on its _kind, it may be +# a target name (with TARGET as _kind), or a path (with SOURCE or DIRECTORY +# as _kind). +function(WEBKIT_ADD_COMPILER_FLAGS _compiler _kind _subject) + foreach (_flag IN LISTS ARGN) + WEBKIT_CHECK_COMPILER_FLAGS(${_compiler} flag_supported "${_flag}") + if (flag_supported) + set_property(${_kind} ${_subject} APPEND PROPERTY COMPILE_OPTIONS "${_flag}") + endif () + endforeach () +endfunction() + +# Appends flags to COMPILE_FLAGS of _target if supported by the C compiler. +# Note that it is simply not possible to pass different C and C++ flags, unless +# we drop support for the Visual Studio backend and use the COMPILE_LANGUAGE +# generator expression. This is a very serious limitation. +macro(WEBKIT_ADD_TARGET_C_FLAGS _target) + WEBKIT_ADD_COMPILER_FLAGS(C TARGET ${_target} ${ARGN}) +endmacro() + +# Appends flags to COMPILE_FLAGS of _target if supported by the C++ compiler. +# Note that it is simply not possible to pass different C and C++ flags, unless +# we drop support for the Visual Studio backend and use the COMPILE_LANGUAGE +# generator expression. This is a very serious limitation. +macro(WEBKIT_ADD_TARGET_CXX_FLAGS _target) + WEBKIT_ADD_COMPILER_FLAGS(CXX TARGET ${_target} ${ARGN}) +endmacro() diff --git a/vcpkg/ports/angle/cmake-buildsystem/cmake/WebKitMacros-minimal.cmake b/vcpkg/ports/angle/cmake-buildsystem/cmake/WebKitMacros-minimal.cmake new file mode 100644 index 0000000..f9d5b0d --- /dev/null +++ b/vcpkg/ports/angle/cmake-buildsystem/cmake/WebKitMacros-minimal.cmake @@ -0,0 +1,49 @@ +# VCPKG NOTE: A minimal version of WebKit's https://github.com/WebKit/WebKit/blob/0742522b24152262b04913242cb0b3c48de92ba0/Source/cmake/WebKitMacros.cmake +# To support the adapted ANGLE CMake buildsystem + +# This file is for macros that are used by multiple projects. If your macro is +# exclusively needed in only one subdirectory of Source (e.g. only needed by +# WebCore), then put it there instead. + +macro(WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS) + set(_file ${CMAKE_CURRENT_SOURCE_DIR}/Platform${PORT}.cmake) + if (EXISTS ${_file}) + message(STATUS "Using platform-specific CMakeLists: ${_file}") + include(${_file}) + else () + message(STATUS "Platform-specific CMakeLists not found: ${_file}") + endif () +endmacro() + +function(WEBKIT_COPY_FILES target_name) + set(options FLATTENED) + set(oneValueArgs DESTINATION) + set(multiValueArgs FILES) + cmake_parse_arguments(opt "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(files ${opt_FILES}) + set(dst_files) + foreach (file IN LISTS files) + if (IS_ABSOLUTE ${file}) + set(src_file ${file}) + else () + set(src_file ${CMAKE_CURRENT_SOURCE_DIR}/${file}) + endif () + if (opt_FLATTENED) + get_filename_component(filename ${file} NAME) + set(dst_file ${opt_DESTINATION}/${filename}) + else () + get_filename_component(file_dir ${file} DIRECTORY) + file(MAKE_DIRECTORY ${opt_DESTINATION}/${file_dir}) + set(dst_file ${opt_DESTINATION}/${file}) + endif () + add_custom_command(OUTPUT ${dst_file} + COMMAND ${CMAKE_COMMAND} -E copy ${src_file} ${dst_file} + MAIN_DEPENDENCY ${file} + VERBATIM + ) + list(APPEND dst_files ${dst_file}) + endforeach () + add_custom_target(${target_name} ALL DEPENDS ${dst_files}) +endfunction() + + |