diff options
Diffstat (limited to 'Source/cmake')
-rw-r--r-- | Source/cmake/FindICU.cmake | 4 | ||||
-rw-r--r-- | Source/cmake/FindWOFF2Dec.cmake | 53 | ||||
-rw-r--r-- | Source/cmake/OptionsQt.cmake | 94 | ||||
-rw-r--r-- | Source/cmake/OptionsWin.cmake | 3 | ||||
-rw-r--r-- | Source/cmake/WebKitCommon.cmake | 3 | ||||
-rw-r--r-- | Source/cmake/WebKitMacros.cmake | 4 |
6 files changed, 141 insertions, 20 deletions
diff --git a/Source/cmake/FindICU.cmake b/Source/cmake/FindICU.cmake index c0de36338..4e93286f3 100644 --- a/Source/cmake/FindICU.cmake +++ b/Source/cmake/FindICU.cmake @@ -24,7 +24,7 @@ mark_as_advanced(ICU_INCLUDE_DIR) # Look for the library. find_library( ICU_LIBRARY - NAMES sicuuc icuuc cygicuuc cygicuuc32 + NAMES icuuc cygicuuc cygicuuc32 HINTS ${PC_ICU_LIBRARY_DIRS} ${PC_ICU_LIBDIR} DOC "Libraries to link against for the common parts of ICU") @@ -49,7 +49,7 @@ if (ICU_INCLUDE_DIR AND ICU_LIBRARY) pkg_check_modules(PC_ICU_I18N icu-i18n) find_library( ICU_I18N_LIBRARY - NAMES sicui18n sicuin icui18n icuin cygicuin cygicuin32 + NAMES icui18n icuin cygicuin cygicuin32 HINTS ${PC_ICU_I18N_LIBRARY_DIRS} ${PC_ICU_I18N_LIBDIR} DOC "Libraries to link against for ICU internationalization") diff --git a/Source/cmake/FindWOFF2Dec.cmake b/Source/cmake/FindWOFF2Dec.cmake new file mode 100644 index 000000000..4927eeeb7 --- /dev/null +++ b/Source/cmake/FindWOFF2Dec.cmake @@ -0,0 +1,53 @@ +# - Try to find WOFF2Dec. +# Once done, this will define +# +# WOFF2DEC_FOUND - system has WOFF2Dec. +# WOFF2DEC_INCLUDE_DIRS - the WOFF2Dec include directories +# WOFF2DEC_LIBRARIES - link these to use WOFF2Dec. +# +# Copyright (C) 2017 Igalia S.L. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS 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 ITS +# 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. + +find_package(PkgConfig) +pkg_check_modules(PC_WOFF2DEC libwoff2dec) + +find_path(WOFF2DEC_INCLUDE_DIRS + NAMES woff2/decode.h + HINTS ${PC_WOFF2DEC_INCLUDEDIR} +) + +find_library(WOFF2DEC_LIBRARIES + NAMES woff2dec + HINTS ${PC_WOFF2DEC_LIBDIR} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WOFF2Dec + REQUIRED_VARS WOFF2DEC_INCLUDE_DIRS WOFF2DEC_LIBRARIES + FOUND_VAR WOFF2DEC_FOUND + VERSION_VAR PC_WOFF2DEC_VERSION) + +mark_as_advanced( + WOFF2DEC_INCLUDE_DIRS + WOFF2DEC_LIBRARIES +) diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index 559b2ab8b..7e1e55340 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -1,3 +1,4 @@ +include(CheckCXXSourceCompiles) include(FeatureSummary) include(ECMEnableSanitizers) include(ECMPackageConfigHelpers) @@ -12,8 +13,21 @@ set(PROJECT_VERSION_STRING "${PROJECT_VERSION}") set(QT_CONAN_DIR "" CACHE PATH "Directory containing conanbuildinfo.cmake and conanfile.txt") if (QT_CONAN_DIR) + find_program(CONAN_COMMAND NAMES conan PATHS $ENV{PIP3_PATH}) + if (NOT CONAN_COMMAND) + message(FATAL_ERROR "conan executable not found. Make sure that Conan is installed and available in PATH") + endif () include("${QT_CONAN_DIR}/conanbuildinfo.cmake") + + # Remove this workaround when libxslt package is fixed + string(REPLACE "include/libxslt" "include" replace_CONAN_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS}) + set(CONAN_INCLUDE_DIRS ${replace_CONAN_INCLUDE_DIRS}) + + # Remove this workaround when libxml2 package is fixed + set(_BACKUP_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) conan_basic_setup() + set(CMAKE_MODULE_PATH ${_BACKUP_CMAKE_MODULE_PATH}) + unset(_BACKUP_CMAKE_MODULE_PATH) install(CODE " set(_conan_imports_dest \${CMAKE_INSTALL_PREFIX}) @@ -23,10 +37,13 @@ if (QT_CONAN_DIR) set(_conan_imports_dest \"\${_absolute_destdir}\${_conan_imports_dest}\") endif () + message(\"Importing dependencies from conan to \${_conan_imports_dest}\") execute_process( - COMMAND conan imports -f \"${QT_CONAN_DIR}/conanfile.txt\" --dest \${_conan_imports_dest} + COMMAND \"${CONAN_COMMAND}\" imports --import-folder \${_conan_imports_dest} \"${QT_CONAN_DIR}/conanfile.txt\" WORKING_DIRECTORY \"${QT_CONAN_DIR}\" + RESULT_VARIABLE _conan_imports_result ) + message(\"conan imports result: \${_conan_imports_result}\") set(_conan_imports_manifest \"\${_conan_imports_dest}/conan_imports_manifest.txt\") if (EXISTS \${_conan_imports_manifest}) @@ -53,6 +70,30 @@ macro(CONVERT_PRL_LIBS_TO_CMAKE _qt_component) endif () endmacro() +macro(CHECK_QT5_PRIVATE_INCLUDE_DIRS _qt_component _header) + set(INCLUDE_TEST_SOURCE + " + #include <${_header}> + int main() { return 0; } + " + ) + set(CMAKE_REQUIRED_INCLUDES ${Qt5${_qt_component}_PRIVATE_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES Qt5::${_qt_component}) + + # Avoid check_include_file_cxx() because it performs linking but doesn't support CMAKE_REQUIRED_LIBRARIES (doh!) + check_cxx_source_compiles("${INCLUDE_TEST_SOURCE}" Qt5${_qt_component}_PRIVATE_HEADER_FOUND) + + unset(INCLUDE_TEST_SOURCE) + unset(CMAKE_REQUIRED_INCLUDES) + unset(CMAKE_REQUIRED_LIBRARIES) + + if (NOT Qt5${_qt_component}_PRIVATE_HEADER_FOUND) + message(FATAL_ERROR "Header ${_header} is not found. Please make sure that: + 1. Private headers of Qt5${_qt_component} are installed + 2. Qt5${_qt_component}_PRIVATE_INCLUDE_DIRS is correctly defined in Qt5${_qt_component}Config.cmake") + endif () +endmacro() + macro(QT_ADD_EXTRA_WEBKIT_TARGET_EXPORT target) if (QT_STATIC_BUILD OR SHARED_CORE) install(TARGETS ${target} EXPORT WebKitTargets @@ -119,6 +160,7 @@ if (COMPILER_IS_GCC_OR_CLANG) add_definitions(-DQT_NO_DYNAMIC_CAST) endif () +# Align build product names with QMake conventions if (WIN32) if (${CMAKE_BUILD_TYPE} MATCHES "Debug") set(CMAKE_DEBUG_POSTFIX d) @@ -126,16 +168,20 @@ if (WIN32) set(CMAKE_SHARED_LIBRARY_PREFIX "") set(CMAKE_SHARED_MODULE_PREFIX "") + # QMake doesn't treat import libraries as a separate product kind + set(CMAKE_IMPORT_LIBRARY_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}") endif () WEBKIT_OPTION_BEGIN() if (APPLE) + set(MACOS_COMPATIBILITY_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}" CACHE STRING "Compatibility version that macOS dylibs should have") + option(MACOS_FORCE_SYSTEM_XML_LIBRARIES "Use system installation of libxml2 and libxslt on macOS" ON) option(MACOS_USE_SYSTEM_ICU "Use system installation of ICU on macOS" ON) option(USE_UNIX_DOMAIN_SOCKETS "Use Unix domain sockets instead of native IPC code on macOS" OFF) option(USE_APPSTORE_COMPLIANT_CODE "Avoid using private macOS APIs which are not allowed on App Store (experimental)" OFF) - set(MACOS_BUILD_FRAMEWORKS ON) # TODO: Make it an option + option(MACOS_BUILD_FRAMEWORKS "Build QtWebKit as framework bundles" ON) if (USE_APPSTORE_COMPLIANT_CODE) set(MACOS_USE_SYSTEM_ICU OFF) @@ -232,6 +278,7 @@ option(USE_STATIC_RUNTIME "Use static runtime (MSVC only)" OFF) # Private options specific to the Qt port. Changing these options is # completely unsupported. They are intended for use only by WebKit developers. WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_ADJUSTMENT "Whether to use touch adjustment" PRIVATE ON) +WEBKIT_OPTION_DEFINE(USE_LIBJPEG "Support JPEG format directly. If it is disabled, QImageReader will be used with possible degradation of user experience" PUBLIC ON) # Public options shared with other WebKit ports. There must be strong reason @@ -267,6 +314,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PUBLIC OFF) # we need a value different from the default defined in WebKitFeatures.cmake. # Changing these options is completely unsupported. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PRIVATE ON) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_COMPOSITING PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_SET PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_REGIONS PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SHAPES PRIVATE ON) @@ -412,23 +460,15 @@ endif () find_package(Threads REQUIRED) -if (NOT QT_BUNDLED_JPEG) - find_package(JPEG REQUIRED) +if (USE_LIBJPEG) + # Additional names of libjpeg to search (fixed in CMake 3.12.0) + set(JPEG_NAMES jpeg-static libjpeg-static) + find_package(JPEG) + if (NOT JPEG_FOUND) + message(FATAL_ERROR "libjpeg not found. Please make sure that CMake can find its header files and libraries, or build with -DUSE_LIBJPEG=OFF with possible degradation of user experience") + endif () else () - set(JPEG_FOUND 1) - # As of Qt 5.10, libjpeg-turbo shipped as a part of Qt requires using a few macro definitions - # WARNING: Keep in sync with libjpeg.pri - # FIXME: Change Qt so we can avoid this - include(CheckTypeSize) - check_type_size(size_t _SIZEOF_SIZE_T) - set(JPEG_DEFINITIONS - -DC_ARITH_CODING_SUPPORTED=1 - -DD_ARITH_CODING_SUPPORTED=1 - -DBITS_IN_JSAMPLE=8 - -DJPEG_LIB_VERSION=80 - -DSIZEOF_SIZE_T=${_SIZEOF_SIZE_T} - ) - unset(_SIZEOF_SIZE_T) + message(WARNING "USE_LIBJPEG is disabled, will attempt using QImageReader to decode JPEG with possible degradation of user experience") endif () if (NOT QT_BUNDLED_PNG) @@ -581,6 +621,15 @@ if (ENABLE_QT_WEBCHANNEL) endif () find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS ${QT_REQUIRED_COMPONENTS}) + +CHECK_QT5_PRIVATE_INCLUDE_DIRS(Gui private/qhexstring_p.h) +if (Qt5_VERSION VERSION_GREATER 5.10.1) + CHECK_QT5_PRIVATE_INCLUDE_DIRS(Network private/http2protocol_p.h) +endif () +if (ENABLE_WEBKIT2) + CHECK_QT5_PRIVATE_INCLUDE_DIRS(Quick private/qsgrendernode_p.h) +endif () + if (QT_STATIC_BUILD) foreach (qt_module ${QT_REQUIRED_COMPONENTS}) CONVERT_PRL_LIBS_TO_CMAKE(${qt_module}) @@ -760,6 +809,15 @@ if (USE_LIBHYPHEN) endif () endif () +if (USE_WOFF2) + find_package(WOFF2Dec 1.0.1) + if (WOFF2DEC_FOUND) + message(STATUS "Using system WOFF2Dec library.") + else () + message(STATUS "WOFF2Dec not found, using the bundled library.") + endif () +endif () + # From OptionsGTK.cmake if (CMAKE_MAJOR_VERSION LESS 3) # Before CMake 3 it was necessary to use a build script instead of using cmake --build directly diff --git a/Source/cmake/OptionsWin.cmake b/Source/cmake/OptionsWin.cmake index be36d92d3..a568258d9 100644 --- a/Source/cmake/OptionsWin.cmake +++ b/Source/cmake/OptionsWin.cmake @@ -128,6 +128,9 @@ if (MSVC) /wd6255 /wd6387 ) + # Eliminate C2139 errors + add_compile_options(/D_ENABLE_EXTENDED_ALIGNED_STORAGE) + # Create pdb files for debugging purposes, also for Release builds add_compile_options(/Zi /GS) diff --git a/Source/cmake/WebKitCommon.cmake b/Source/cmake/WebKitCommon.cmake index 1f7b4ccdf..de4ac8f65 100644 --- a/Source/cmake/WebKitCommon.cmake +++ b/Source/cmake/WebKitCommon.cmake @@ -41,6 +41,9 @@ if (NOT HAS_RUN_WEBKIT_COMMON) # Helper macros and feature defines # ----------------------------------------------------------------------------- + # To prevent multiple inclusion, most modules should be included once here. + include(CheckFunctionExists) + include(WebKitMacros) include(WebKitFS) include(WebKitHelpers) diff --git a/Source/cmake/WebKitMacros.cmake b/Source/cmake/WebKitMacros.cmake index 07e31432a..d58c73eb4 100644 --- a/Source/cmake/WebKitMacros.cmake +++ b/Source/cmake/WebKitMacros.cmake @@ -373,6 +373,10 @@ macro(GENERATE_WEBKIT2_MESSAGE_SOURCES _output_source _input_files) WORKING_DIRECTORY ${WEBKIT2_DIR} VERBATIM) + if (${PORT} STREQUAL "Qt") + set_property(SOURCE ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp PROPERTY SKIP_AUTOMOC ON) + endif () + list(APPEND ${_output_source} ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp) endforeach () endmacro() |