diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2020-03-03 06:24:06 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2020-03-03 07:08:12 +0300 |
commit | b1586d3ee311c81dbc5914f6527a7271357015ca (patch) | |
tree | c50029235e3256e8082636b242d270c743784c1b | |
parent | 4351bcf3a4044ec08937434e814470322545641c (diff) |
Import QtWebKit commit 0f8a0856b4e8db1bea298f74c02172a9aa5fc2f3
Change-Id: Ibbe58ea5d84cfb170f1e07980a61aac7b85649c5
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
-rw-r--r-- | Source/cmake/FindDwz.cmake | 54 | ||||
-rw-r--r-- | Source/cmake/OptionsQt.cmake | 16 |
2 files changed, 69 insertions, 1 deletions
diff --git a/Source/cmake/FindDwz.cmake b/Source/cmake/FindDwz.cmake new file mode 100644 index 000000000..c5ba3ce14 --- /dev/null +++ b/Source/cmake/FindDwz.cmake @@ -0,0 +1,54 @@ +# - Find dwz +# This module looks for dwz. This module defines the +# following values: +# +# DWZ_EXECUTABLE - The full path to the dwz tool. +# DWZ_FOUND - True if dwz has been found. +# DWZ_VERSION_STRING - dwz version found, e.g. 0.12 +# +# Copyright (C) 2019 Konstantin Tokarev <annulen@yandex.ru> +# +# 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_program(DWZ_EXECUTABLE NAMES dwz) + +if (DWZ_EXECUTABLE) + execute_process( + COMMAND "${DWZ_EXECUTABLE}" -v + RESULT_VARIABLE _DWZ_VERSION_RESULT + ERROR_VARIABLE _DWZ_VERSION_OUTPUT + OUTPUT_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if (NOT _DWZ_VERSION_RESULT AND _DWZ_VERSION_OUTPUT MATCHES "dwz version ([0-9\\.]+)") + set(DWZ_VERSION_STRING "${CMAKE_MATCH_1}") + endif () +endif () + +# handle the QUIETLY and REQUIRED arguments and set DWZ_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Dwz + REQUIRED_VARS DWZ_EXECUTABLE + VERSION_VAR DWZ_VERSION_STRING) + +mark_as_advanced(DWZ_EXECUTABLE) diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index 28b38fbf5..1ee60b777 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -145,8 +145,15 @@ macro(QTWEBKIT_SEPARATE_DEBUG_INFO _target _target_debug) else () set(_target_file "$<TARGET_FILE:${_target}>") set(${_target_debug} "${_target_file}.debug") + + if (DWZ_FOUND AND NOT SKIP_DWZ) + set(EXTRACT_DEBUG_INFO_COMMAND COMMAND ${DWZ_EXECUTABLE} -L 1000000000 -o ${${_target_debug}} ${_target_file}) + else () + set(EXTRACT_DEBUG_INFO_COMMAND COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${_target_file} ${${_target_debug}}) + endif () + add_custom_command(TARGET ${_target} POST_BUILD - COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${_target_file} ${${_target_debug}} + ${EXTRACT_DEBUG_INFO_COMMAND} COMMAND ${CMAKE_OBJCOPY} --strip-debug ${_target_file} COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${${_target_debug}} ${_target_file} VERBATIM @@ -529,6 +536,13 @@ else () endif () endif () +if (UNIX AND NOT APPLE AND CMAKE_OBJCOPY AND NOT SKIP_DWZ) + find_package(Dwz 0.13) + if (DWZ_FOUND) + message(STATUS "WARNING: dwz may use a lot of RAM - build with -DSKIP_DWZ=ON if you don't have enough") + endif () +endif () + if (ENABLE_TEST_SUPPORT) find_package(Fontconfig) if (FONTCONFIG_FOUND) |