vcpkg/scripts/cmake/vcpkg_configure_qmake.cmake
Alexander Neumann f8165f7270 [qt5-base] Fix Qt5 linux build and be a bit less flaky in CI (#9260)
* Fix static qt5 builds and ignore system qmake
closes #9234 and #9239

* fix angle conflict and icu dependency

* add egl-registry as a dependency

* remove space

* adding spaces resolved the problem

* move files only if they exist

* Update the Wrapper to use the Postgres target

fixes some observed linkage issues

* update baseline

* add fontconfig on linux so CI is less flaky in a full rebuild

* fix linkage dependent qt5-imageformats libs

* Fix Wrapper for Linux and add other platform libs to Qt5::Core

* fix plugin properties in cmake files

* fix cmake files.

* fix missing plugin qminimal deployment into tools dir

* change wrapper slightly

* UNIX also means APPLE so it needs to be excluded

* fix the static windows build

* mark the parts of fixcmake which require further work to work with single configuration builds

* Update ci.baseline.txt

make qt5-tools pass for CI testing

* fix last regression

* break auto fontconfig in configure script to fix qt5-tools

* update baseline

* enable verbose to debug ci

* try to help it instead of breaking it

* completly link icu

* try to fix fontconfig configure

* fix configure call. cannot be called with a list!

* remove invalid line from patch

* force icu and reduce the required icu libs according to the configure script

* fix icu linkage

* add more icu dependencies and names for windows

* add more icu libs. Seems like all are needed

* fix typo

* print icu libs in debug

* check releasenames

* try again

* change link order

* add icu to wrapper

* fix typo

* patch icu configure for static windows builds

* add other icu libraries to the icu patch

* fix icu in x64-windows-static

* update baseline. VTK builds in local WSL so it should work in CI

* update VTK control to force rebuild

* remove qt5-tools=pass from baseline

* remove qcustomplot:x64-linux=fail from baseline

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-01-06 12:36:51 -08:00

91 lines
3.9 KiB
CMake

#.rst:
# .. command:: vcpkg_configure_qmake
#
# Configure a qmake-based project.
#
# ::
# vcpkg_configure_qmake(SOURCE_PATH <pro_file_path>
# [OPTIONS arg1 [arg2 ...]]
# [OPTIONS_RELEASE arg1 [arg2 ...]]
# [OPTIONS_DEBUG arg1 [arg2 ...]]
# )
#
# ``SOURCE_PATH``
# The path to the *.pro qmake project file.
# ``OPTIONS[_RELEASE|_DEBUG]``
# The options passed to qmake.
function(vcpkg_configure_qmake)
cmake_parse_arguments(_csc "" "SOURCE_PATH" "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG;BUILD_OPTIONS;BUILD_OPTIONS_RELEASE;BUILD_OPTIONS_DEBUG" ${ARGN})
# Find qmake executable
set(_triplet_hostbindir ${CURRENT_INSTALLED_DIR}/tools/qt5/bin)
if(DEFINED VCPKG_QT_HOST_TOOLS_ROOT_DIR)
find_program(QMAKE_COMMAND NAMES qmake PATHS ${VCPKG_QT_HOST_TOOLS_ROOT_DIR}/bin ${_triplet_hostbindir} NO_DEFAULT_PATH)
else()
find_program(QMAKE_COMMAND NAMES qmake PATHS ${_triplet_hostbindir} NO_DEFAULT_PATH)
endif()
if(NOT QMAKE_COMMAND)
message(FATAL_ERROR "vcpkg_configure_qmake: unable to find qmake.")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND _csc_OPTIONS "CONFIG-=shared")
list(APPEND _csc_OPTIONS "CONFIG*=static")
else()
list(APPEND _csc_OPTIONS "CONFIG-=static")
list(APPEND _csc_OPTIONS "CONFIG*=shared")
list(APPEND _csc_OPTIONS_DEBUG "CONFIG*=separate_debug_info")
endif()
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_CRT_LINKAGE STREQUAL "static")
list(APPEND _csc_OPTIONS "CONFIG*=static-runtime")
endif()
# Cleanup build directories
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
if(DEFINED VCPKG_OSX_DEPLOYMENT_TARGET)
set(ENV{QMAKE_MACOSX_DEPLOYMENT_TARGET} ${VCPKG_OSX_DEPLOYMENT_TARGET})
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
configure_file(${CURRENT_INSTALLED_DIR}/tools/qt5/qt_release.conf ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf)
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
if(DEFINED _csc_BUILD_OPTIONS OR DEFINED _csc_BUILD_OPTIONS_RELEASE)
set(BUILD_OPT -- ${_csc_BUILD_OPTIONS} ${_csc_BUILD_OPTIONS_RELEASE})
endif()
vcpkg_execute_required_process(
COMMAND ${QMAKE_COMMAND} CONFIG-=debug CONFIG+=release
${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE} ${_csc_SOURCE_PATH}
-qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf"
${BUILD_OPT}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME config-${TARGET_TRIPLET}-rel
)
message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
configure_file(${CURRENT_INSTALLED_DIR}/tools/qt5/qt_debug.conf ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/qt.conf)
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
if(DEFINED _csc_BUILD_OPTIONS OR DEFINED _csc_BUILD_OPTIONS_DEBUG)
set(BUILD_OPT -- ${_csc_BUILD_OPTIONS} ${_csc_BUILD_OPTIONS_DEBUG})
endif()
vcpkg_execute_required_process(
COMMAND ${QMAKE_COMMAND} CONFIG-=release CONFIG+=debug
${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG} ${_csc_SOURCE_PATH}
-qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/qt.conf"
${BUILD_OPT}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME config-${TARGET_TRIPLET}-dbg
)
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
endif()
endfunction()