Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package() which can take an extra option called PROVIDED_TARGETS, which associates targets with the package that defines those targets. This is done by setting the INTERFACE_QT_PACKAGE_NAME and INTERFACE_QT_PACKAGE_VERSION properties on the imported targets. This information allows us to generate appropriate find_dependency() calls in a module's Config file for third party libraries. For example when an application links against QtCore, it should also link against zlib and atomic libraries. In order to do that, the library locations first have to be found by CMake. This is achieved by embedding find_dependency(ZLIB) and find_dependency(Atomic) in Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake. The latter is picked up when an application project contains find_package(Qt5Core), and thus all linking dependencies are resolved. The information 'which package provides which targets' is contained in the python json2cmake conversion script. The generated output of the script contains qt_find_package() calls that represent that information. The Qt5CoreDependencies.cmake file and which which dependencies it contains is generated at the QtPostProcess stop. Note that for non-static Qt builds, we only need to propagate public 3rd party libraries. For static builds, we need all third party libraries. In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any scope, the targets on which the property is set, have to be GLOBAL. Also for applications and other modules to find all required third party libraries, we have to install all our custom Find modules, and make sure they define INTERFACE IMPORTED libraries, and not just IMPORTED libraries. Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
parent
42d3b21c92
commit
9b0b464e82
@ -5,7 +5,7 @@ find_path(PCRE2_INCLUDE_DIRS pcre2.h)
|
||||
if (PCRE2_LIBRARIES STREQUAL "PCRE2_LIBRARIES-NOTFOUND" OR PCRE2_INCLUDE_DIRS STREQUAL "PCRE2_INCLUDE_DIRS-NOTFOUND")
|
||||
set(PCRE2_FOUND 0)
|
||||
else()
|
||||
add_library(PCRE2 INTERFACE)
|
||||
add_library(PCRE2 INTERFACE IMPORTED)
|
||||
target_link_libraries(PCRE2 INTERFACE ${PCRE2_LIBRARIES})
|
||||
target_include_directories(PCRE2 INTERFACE ${PCRE2_INCLUDE_DIRS})
|
||||
set(PCRE2_FOUND 1)
|
||||
|
@ -11,7 +11,7 @@ find_package_handle_standard_args(PPS DEFAULT_MSG PPS_INCLUDE_DIR PPS_LIBRARY)
|
||||
mark_as_advanced(PPS_INCLUDE_DIR PPS_LIBRARY)
|
||||
|
||||
if(PPS_FOUND)
|
||||
add_library(__PPS IMPORTED)
|
||||
add_library(__PPS INTERFACE IMPORTED)
|
||||
target_link_libraries(__PPS INTERFACE ${PPS_LIBRARY})
|
||||
target_include_directories(__PPS INTERFACE ${PPS_INCLUDE_DIR})
|
||||
|
||||
|
@ -11,7 +11,7 @@ find_package_handle_standard_args(Slog2 DEFAULT_MSG Slog2_INCLUDE_DIR Slog2_LIBR
|
||||
mark_as_advanced(Slog2_INCLUDE_DIR Slog2_LIBRARY)
|
||||
|
||||
if(Slog2_FOUND)
|
||||
add_library(__Slog2 IMPORTED)
|
||||
add_library(__Slog2 INTERFACE IMPORTED)
|
||||
target_link_libraries(__Slog2 INTERFACE ${Slog2_LIBRARY})
|
||||
target_include_directories(__Slog2 INTERFACE ${Slog2_INCLUDE_DIR})
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
add_library(WrapDoubleConversion INTERFACE)
|
||||
add_library(WrapDoubleConversion INTERFACE IMPORTED)
|
||||
|
||||
find_package(double-conversion)
|
||||
if (double-conversion_FOUND)
|
||||
include(FeatureSummary)
|
||||
set_package_properties(double-conversion PROPERTIES TYPE REQUIRED)
|
||||
target_link_libraries(WrapDoubleConversion INTERFACE double-conversion::double-conversion)
|
||||
set(WrapDoubleConversion_FOUND 1)
|
||||
|
@ -6,7 +6,7 @@ if(TARGET WrapOpenGL)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(WrapOpenGL INTERFACE)
|
||||
add_library(WrapOpenGL INTERFACE IMPORTED)
|
||||
|
||||
if(QT_FEATURE_opengles2)
|
||||
find_package(GLESv2)
|
||||
@ -16,3 +16,5 @@ else()
|
||||
target_link_libraries(WrapOpenGL INTERFACE OpenGL::GL)
|
||||
endif()
|
||||
set(WrapOpenGL_FOUND ON)
|
||||
|
||||
set_property(TARGET WrapOpenGL PROPERTY IMPORTED_GLOBAL TRUE)
|
||||
|
@ -18,7 +18,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
cmake_pop_check_state()
|
||||
|
||||
add_library(WrapRt INTERFACE)
|
||||
add_library(WrapRt INTERFACE IMPORTED)
|
||||
if (LIBRT_FOUND)
|
||||
target_link_libraries(WrapRt INTERFACE "${LIBRT}")
|
||||
endif()
|
||||
|
@ -43,6 +43,7 @@ endif()
|
||||
|
||||
mark_as_advanced(ZSTD_INCLUDE_DIRS ZSTD_LIBRARIES)
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(ZSTD PROPERTIES
|
||||
URL "https://github.com/facebook/zstd"
|
||||
DESCRIPTION "ZSTD compression library")
|
||||
|
@ -95,3 +95,12 @@ install(FILES
|
||||
install(DIRECTORY cmake/3rdparty
|
||||
DESTINATION "${config_install_dir}"
|
||||
)
|
||||
|
||||
# Install our custom Find modules, which will be used by the find_dependency() calls
|
||||
# inside the generated ModuleDependencies cmake files.
|
||||
install(DIRECTORY cmake/
|
||||
DESTINATION "${config_install_dir}"
|
||||
FILES_MATCHING PATTERN "Find*.cmake"
|
||||
PATTERN "tests" EXCLUDE
|
||||
PATTERN "3rdparty" EXCLUDE
|
||||
)
|
||||
|
@ -1365,3 +1365,59 @@ endfunction()
|
||||
function(add_qt_docs qdocFile)
|
||||
# TODO
|
||||
endfunction()
|
||||
|
||||
macro(qt_find_package)
|
||||
# Get the target names we expect to be provided by the package.
|
||||
cmake_parse_arguments(arg "" "" "PROVIDED_TARGETS;COMPONENTS" ${ARGN})
|
||||
|
||||
# Get the version if specified.
|
||||
set(package_version "")
|
||||
if(${ARGC} GREATER_EQUAL 2)
|
||||
if(${ARGV1} MATCHES "^[0-9\.]+$")
|
||||
set(package_version "${ARGV1}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(arg_COMPONENTS)
|
||||
# Re-append components to forward them.
|
||||
list(APPEND arg_UNPARSED_ARGUMENTS "COMPONENTS;${arg_COMPONENTS}")
|
||||
endif()
|
||||
|
||||
# Call original function without our custom arguments.
|
||||
find_package(${arg_UNPARSED_ARGUMENTS})
|
||||
|
||||
if(${ARGV0}_FOUND AND arg_PROVIDED_TARGETS)
|
||||
# If package was found, associate each target with its package name. This will be used
|
||||
# later when creating Config files for Qt libraries, to generate correct find_dependency()
|
||||
# calls. Also make the provided targets global, so that the properties can be read in
|
||||
# all scopes.
|
||||
foreach(qt_find_package_target_name ${arg_PROVIDED_TARGETS})
|
||||
if(TARGET ${qt_find_package_target_name})
|
||||
set_target_properties(${qt_find_package_target_name}
|
||||
PROPERTIES INTERFACE_QT_PACKAGE_NAME ${ARGV0})
|
||||
if(package_version)
|
||||
set_target_properties(${qt_find_package_target_name}
|
||||
PROPERTIES INTERFACE_QT_PACKAGE_VERSION ${ARGV1})
|
||||
endif()
|
||||
|
||||
if(arg_COMPONENTS)
|
||||
set_target_properties(${qt_find_package_target_name}
|
||||
PROPERTIES
|
||||
INTERFACE_QT_PACKAGE_COMPONENTS ${arg_COMPONENTS})
|
||||
endif()
|
||||
|
||||
get_property(is_global TARGET ${qt_find_package_target_name} PROPERTY
|
||||
IMPORTED_GLOBAL)
|
||||
if(NOT is_global)
|
||||
set_property(TARGET ${qt_find_package_target_name} PROPERTY
|
||||
IMPORTED_GLOBAL TRUE)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"Error while trying to mark target '${qt_find_package_target_name}' as part"
|
||||
" of the ${ARGV0} package. Provided target name does not exist.")
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
|
@ -5,6 +5,11 @@ include(CMakeFindDependencyMacro)
|
||||
get_filename_component(_import_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(_import_prefix "${_import_prefix}" REALPATH)
|
||||
|
||||
# Find required dependencies, if any.
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")
|
||||
endif()
|
||||
|
||||
# note: target_deps example: "Qt5Core\;5.12.0;Qt5Gui\;5.12.0"
|
||||
set(_target_deps "@target_deps@")
|
||||
foreach(_target_dep ${_target_deps})
|
||||
|
34
cmake/QtModuleDependencies.cmake.in
Normal file
34
cmake/QtModuleDependencies.cmake.in
Normal file
@ -0,0 +1,34 @@
|
||||
# Save old module path, and append a new path that points to the copied over Find modules
|
||||
# so that find_dependency() can find the third party packages.
|
||||
set(old_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}")
|
||||
list(APPEND CMAKE_MODULE_PATH "${_import_prefix}/../@INSTALL_CMAKE_NAMESPACE@")
|
||||
list(APPEND CMAKE_MODULE_PATH "${_import_prefix}/../@INSTALL_CMAKE_NAMESPACE@/3rdparty/extra-cmake-modules/find-modules")
|
||||
|
||||
# note: _third_party_deps example: "ICU\\;1.0\\;i18n uc data;ZLIB\\;\\;"
|
||||
set(_third_party_deps "@third_party_deps@")
|
||||
|
||||
foreach(_target_dep ${_third_party_deps})
|
||||
list(GET _target_dep 0 pkg)
|
||||
list(GET _target_dep 1 version)
|
||||
list(GET _target_dep 2 components)
|
||||
set(find_package_args "${pkg}")
|
||||
if(version)
|
||||
list(APPEND find_package_args "${version}")
|
||||
endif()
|
||||
|
||||
if(components)
|
||||
list(APPEND find_package_args "COMPONENTS" ${components})
|
||||
endif()
|
||||
|
||||
if (NOT ${pkg}_FOUND)
|
||||
find_dependency(${find_package_args})
|
||||
endif()
|
||||
|
||||
if (NOT ${pkg}_FOUND)
|
||||
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Restore old module path.
|
||||
set(CMAKE_MODULE_PATH "${old_CMAKE_MODULE_PATH}")
|
@ -16,7 +16,10 @@ function(qt_internal_create_depends_files)
|
||||
message("Generating depends files for ${QT_KNOWN_MODULES}...")
|
||||
foreach (target ${QT_KNOWN_MODULES})
|
||||
get_target_property(depends "${target}" LINK_LIBRARIES)
|
||||
get_target_property(public_depends "${target}" INTERFACE_LINK_LIBRARIES)
|
||||
set(qtdeps "")
|
||||
set(third_party_deps "")
|
||||
set(third_party_deps_seen "")
|
||||
foreach (dep ${depends})
|
||||
# Normalize module by stripping leading "Qt::" and trailing "Private"
|
||||
if (dep MATCHES "Qt::(.*)")
|
||||
@ -32,6 +35,37 @@ function(qt_internal_create_depends_files)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# If we are doing a non-static Qt build, we only want to propagate public dependencies.
|
||||
# If we are doing a static Qt build, we need to propagate all dependencies.
|
||||
set(depends_var "public_depends")
|
||||
if(NOT QT_BUILD_SHARED_LIBS)
|
||||
set(depends_var "depends")
|
||||
endif()
|
||||
|
||||
foreach(dep ${${depends_var}})
|
||||
# Gather third party packages that should be found when using the Qt module.
|
||||
if(TARGET ${dep})
|
||||
list(FIND third_party_deps_seen ${dep} dep_seen)
|
||||
|
||||
get_target_property(package_name ${dep} INTERFACE_QT_PACKAGE_NAME)
|
||||
if(dep_seen EQUAL -1 AND package_name)
|
||||
list(APPEND third_party_deps_seen ${dep})
|
||||
get_target_property(package_version ${dep} INTERFACE_QT_PACKAGE_VERSION)
|
||||
if(NOT package_version)
|
||||
set(package_version "")
|
||||
endif()
|
||||
|
||||
get_target_property(package_components ${dep} INTERFACE_QT_PACKAGE_COMPONENTS)
|
||||
if(NOT package_components)
|
||||
set(package_components "")
|
||||
endif()
|
||||
|
||||
list(APPEND third_party_deps
|
||||
"${package_name}\;${package_version}\;${package_components}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (DEFINED qtdeps)
|
||||
list(REMOVE_DUPLICATES qtdeps)
|
||||
endif()
|
||||
@ -40,7 +74,26 @@ function(qt_internal_create_depends_files)
|
||||
if (${hasModuleHeaders})
|
||||
qt_internal_write_depends_file("${target}" ${qtdeps})
|
||||
endif()
|
||||
|
||||
if(third_party_deps)
|
||||
# Configure and install dependencies file.
|
||||
configure_file(
|
||||
"${QT_CMAKE_DIR}/QtModuleDependencies.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}Dependencies.cmake"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
set(config_install_dir "${INSTALL_LIBDIR}/cmake/${INSTALL_CMAKE_NAMESPACE}${target}")
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}Dependencies.cmake"
|
||||
DESTINATION "${config_install_dir}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
||||
endfunction()
|
||||
|
||||
qt_internal_create_depends_files()
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
#### Libraries
|
||||
|
||||
find_package(ZLIB)
|
||||
qt_find_package(ZLIB PROVIDED_TARGETS ZLIB::ZLIB)
|
||||
set_package_properties(ZLIB PROPERTIES TYPE OPTIONAL)
|
||||
find_package(ZSTD)
|
||||
qt_find_package(ZSTD PROVIDED_TARGETS ZSTD::ZSTD)
|
||||
set_package_properties(ZSTD PROPERTIES TYPE OPTIONAL)
|
||||
find_package(Libudev)
|
||||
qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev)
|
||||
set_package_properties(Libudev PROPERTIES TYPE OPTIONAL)
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
# Generated from boxes.pro.
|
||||
|
||||
find_package(WrapOpenGL)
|
||||
|
||||
qt_find_package(WrapOpenGL PROVIDED_TARGETS WrapOpenGL) # special case
|
||||
#####################################################################
|
||||
## boxes Binary:
|
||||
#####################################################################
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Generated from corelib.pro.
|
||||
|
||||
# special case:
|
||||
find_package(Threads)
|
||||
find_package(WrapDoubleConversion REQUIRED)
|
||||
qt_find_package(Threads PROVIDED_TARGETS Threads::Threads)
|
||||
qt_find_package(WrapDoubleConversion REQUIRED PROVIDED_TARGETS WrapDoubleConversion)
|
||||
|
||||
if (NOT WrapDoubleConversion_FOUND)
|
||||
message(FATAL_ERROR "Your C library does not provide \
|
||||
|
@ -10,23 +10,23 @@ set_property(CACHE INPUT_iconv PROPERTY STRINGS undefined no yes posix sun gnu)
|
||||
|
||||
#### Libraries
|
||||
|
||||
find_package(GLIB2)
|
||||
qt_find_package(GLIB2 PROVIDED_TARGETS GLIB2::GLIB2)
|
||||
set_package_properties(GLIB2 PROPERTIES TYPE OPTIONAL)
|
||||
find_package(ICU COMPONENTS i18n uc data)
|
||||
qt_find_package(ICU COMPONENTS i18n uc data PROVIDED_TARGETS ICU::i18n ICU::uc ICU::data)
|
||||
set_package_properties(ICU PROPERTIES TYPE OPTIONAL)
|
||||
find_package(Libsystemd)
|
||||
qt_find_package(Libsystemd)
|
||||
set_package_properties(Libsystemd PROPERTIES TYPE OPTIONAL)
|
||||
find_package(Atomic)
|
||||
qt_find_package(Atomic PROVIDED_TARGETS Atomic)
|
||||
set_package_properties(Atomic PROPERTIES TYPE OPTIONAL)
|
||||
find_package(WrapRt)
|
||||
qt_find_package(WrapRt PROVIDED_TARGETS WrapRt)
|
||||
set_package_properties(WrapRt PROPERTIES TYPE OPTIONAL)
|
||||
find_package(LTTngUST)
|
||||
qt_find_package(LTTngUST)
|
||||
set_package_properties(LTTngUST PROPERTIES TYPE OPTIONAL)
|
||||
find_package(PCRE2)
|
||||
qt_find_package(PCRE2 PROVIDED_TARGETS PCRE2)
|
||||
set_package_properties(PCRE2 PROPERTIES TYPE REQUIRED)
|
||||
find_package(PPS)
|
||||
qt_find_package(PPS)
|
||||
set_package_properties(PPS PROPERTIES TYPE OPTIONAL)
|
||||
find_package(Slog2)
|
||||
qt_find_package(Slog2)
|
||||
set_package_properties(Slog2 PROPERTIES TYPE OPTIONAL)
|
||||
|
||||
|
||||
|
@ -427,7 +427,7 @@ extend_target(Gui CONDITION QT_FEATURE_draganddrop
|
||||
# here (where the feature is available).
|
||||
# DO NOT MOVE THIS TO THE BEGINNING OF THE FILE, the feature variables are not
|
||||
# available until the add_qt_module call.
|
||||
find_package(WrapOpenGL) # special case
|
||||
qt_find_package(WrapOpenGL PROVIDED_TARGETS WrapOpenGL) # special case
|
||||
|
||||
extend_target(Gui CONDITION QT_FEATURE_opengl
|
||||
SOURCES
|
||||
|
@ -22,45 +22,45 @@ set_property(CACHE INPUT_xcb PROPERTY STRINGS undefined no yes qt system)
|
||||
|
||||
#### Libraries
|
||||
|
||||
find_package(ATSPI2)
|
||||
qt_find_package(ATSPI2 PROVIDED_TARGETS PkgConfig::ATSPI2)
|
||||
set_package_properties(ATSPI2 PROPERTIES TYPE OPTIONAL)
|
||||
find_package(Libdrm)
|
||||
qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm)
|
||||
set_package_properties(Libdrm PROPERTIES TYPE OPTIONAL)
|
||||
find_package(EGL)
|
||||
qt_find_package(EGL)
|
||||
set_package_properties(EGL PROPERTIES TYPE OPTIONAL)
|
||||
find_package(Freetype)
|
||||
qt_find_package(Freetype PROVIDED_TARGETS Freetype::Freetype)
|
||||
set_package_properties(Freetype PROPERTIES TYPE REQUIRED)
|
||||
find_package(Fontconfig)
|
||||
qt_find_package(Fontconfig PROVIDED_TARGETS Fontconfig::Fontconfig)
|
||||
set_package_properties(Fontconfig PROPERTIES TYPE OPTIONAL)
|
||||
find_package(gbm)
|
||||
qt_find_package(gbm PROVIDED_TARGETS gbm::gbm)
|
||||
set_package_properties(gbm PROPERTIES TYPE OPTIONAL)
|
||||
find_package(harfbuzz)
|
||||
qt_find_package(harfbuzz PROVIDED_TARGETS harfbuzz::harfbuzz)
|
||||
set_package_properties(harfbuzz PROPERTIES TYPE OPTIONAL)
|
||||
find_package(Libinput)
|
||||
qt_find_package(Libinput PROVIDED_TARGETS Libinput::Libinput)
|
||||
set_package_properties(Libinput PROPERTIES TYPE OPTIONAL)
|
||||
find_package(JPEG)
|
||||
qt_find_package(JPEG)
|
||||
set_package_properties(JPEG PROPERTIES TYPE OPTIONAL)
|
||||
find_package(PNG)
|
||||
qt_find_package(PNG PROVIDED_TARGETS PNG::PNG)
|
||||
set_package_properties(PNG PROPERTIES TYPE OPTIONAL)
|
||||
find_package(Mtdev)
|
||||
qt_find_package(Mtdev PROVIDED_TARGETS PkgConfig::Mtdev)
|
||||
set_package_properties(Mtdev PROPERTIES TYPE OPTIONAL)
|
||||
find_package(OpenGL)
|
||||
qt_find_package(OpenGL)
|
||||
set_package_properties(OpenGL PROPERTIES TYPE OPTIONAL)
|
||||
find_package(GLESv2)
|
||||
qt_find_package(GLESv2)
|
||||
set_package_properties(GLESv2 PROPERTIES TYPE OPTIONAL)
|
||||
find_package(Tslib)
|
||||
qt_find_package(Tslib PROVIDED_TARGETS PkgConfig::Tslib)
|
||||
set_package_properties(Tslib PROPERTIES TYPE OPTIONAL)
|
||||
find_package(Vulkan)
|
||||
qt_find_package(Vulkan)
|
||||
set_package_properties(Vulkan PROPERTIES TYPE OPTIONAL)
|
||||
find_package(Wayland)
|
||||
qt_find_package(Wayland)
|
||||
set_package_properties(Wayland PROPERTIES TYPE OPTIONAL)
|
||||
find_package(X11)
|
||||
qt_find_package(X11)
|
||||
set_package_properties(X11 PROPERTIES TYPE OPTIONAL)
|
||||
find_package(XCB 1.9)
|
||||
qt_find_package(XCB 1.9 PROVIDED_TARGETS XCB::XCB)
|
||||
set_package_properties(XCB PROPERTIES TYPE OPTIONAL)
|
||||
find_package(X11_XCB)
|
||||
qt_find_package(X11_XCB PROVIDED_TARGETS X11::XCB)
|
||||
set_package_properties(X11_XCB PROPERTIES TYPE OPTIONAL)
|
||||
find_package(XKB 0.4.1)
|
||||
qt_find_package(XKB 0.4.1 PROVIDED_TARGETS XKB::XKB)
|
||||
set_package_properties(XKB PROPERTIES TYPE OPTIONAL)
|
||||
|
||||
|
||||
|
@ -227,7 +227,7 @@ extend_target(Network CONDITION QT_FEATURE_libproxy AND NOT APPLE_OSX AND (UNIX
|
||||
kernel/qnetworkproxy_libproxy.cpp
|
||||
LIBRARIES
|
||||
${CMAKE_DL_LIBS}
|
||||
LibProxy::LibProxy
|
||||
PkgConfig::Libproxy
|
||||
)
|
||||
|
||||
extend_target(Network CONDITION NOT APPLE_OSX AND NOT QT_FEATURE_libproxy AND (UNIX OR WINRT)
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
#### Libraries
|
||||
|
||||
find_package(Libproxy)
|
||||
qt_find_package(Libproxy PROVIDED_TARGETS PkgConfig::Libproxy)
|
||||
set_package_properties(Libproxy PROPERTIES TYPE OPTIONAL)
|
||||
find_package(OpenSSL)
|
||||
qt_find_package(OpenSSL)
|
||||
set_package_properties(OpenSSL PROPERTIES TYPE OPTIONAL)
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
find_package(EGL) # special case
|
||||
qt_find_package(EGL) # special case
|
||||
|
||||
#####################################################################
|
||||
## EglSupport Module:
|
||||
|
@ -1,4 +1,4 @@
|
||||
find_package(GLIB2) # special case
|
||||
qt_find_package(GLIB2) # special case
|
||||
set_package_properties(GLib PROPERTIES TYPE OPTIONAL) # special case
|
||||
|
||||
#####################################################################
|
||||
|
@ -1,5 +1,5 @@
|
||||
find_package(Freetype) # special case
|
||||
find_package(Fontconfig) # special case
|
||||
qt_find_package(Freetype) # special case
|
||||
qt_find_package(Fontconfig) # special case
|
||||
|
||||
#####################################################################
|
||||
## FontDatabaseSupport Module:
|
||||
|
@ -1,5 +1,5 @@
|
||||
find_package(X11) # special case
|
||||
find_package(OpenGL) # special case
|
||||
qt_find_package(X11) # special case
|
||||
qt_find_package(OpenGL) # special case
|
||||
|
||||
#####################################################################
|
||||
## GlxSupport Module:
|
||||
|
@ -1,9 +1,9 @@
|
||||
# Generated from input.pro.
|
||||
|
||||
find_package(Libinput) # special case
|
||||
find_package(XKB) # special case
|
||||
find_package(Tslib) # special case
|
||||
find_package(Mtdev) # special case
|
||||
qt_find_package(Libinput) # special case
|
||||
qt_find_package(XKB) # special case
|
||||
qt_find_package(Tslib) # special case
|
||||
qt_find_package(Mtdev) # special case
|
||||
|
||||
#####################################################################
|
||||
## InputSupport Module:
|
||||
|
@ -1,4 +1,4 @@
|
||||
find_package(Libdrm) # special case
|
||||
qt_find_package(Libdrm) # special case
|
||||
|
||||
#####################################################################
|
||||
## KmsSupport Module:
|
||||
|
@ -1,4 +1,4 @@
|
||||
find_package(ATSPI2 REQUIRED) # special case
|
||||
qt_find_package(ATSPI2 REQUIRED) # special case
|
||||
|
||||
#####################################################################
|
||||
## LinuxAccessibilitySupport Module:
|
||||
|
@ -1,4 +1,4 @@
|
||||
find_package(Vulkan) # special case
|
||||
qt_find_package(Vulkan) # special case
|
||||
|
||||
#####################################################################
|
||||
## VulkanSupport Module:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Generated from tslib.pro.
|
||||
|
||||
find_package(Tslib) # special case
|
||||
qt_find_package(Tslib) # special case
|
||||
|
||||
#####################################################################
|
||||
## qtslibplugin Plugin:
|
||||
|
@ -4,7 +4,7 @@
|
||||
## qjpeg Plugin:
|
||||
#####################################################################
|
||||
|
||||
find_package(JPEG)
|
||||
qt_find_package(JPEG) # special case
|
||||
|
||||
add_qt_plugin(qjpeg
|
||||
TYPE imageformats
|
||||
|
@ -4,7 +4,7 @@
|
||||
## composeplatforminputcontextplugin Plugin:
|
||||
#####################################################################
|
||||
|
||||
find_package(XKB) # special case
|
||||
qt_find_package(XKB) # special case
|
||||
|
||||
pkg_get_variable(PKG_X11_PREFIX x11 prefix) # special case
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Generated from cocoa.pro.
|
||||
|
||||
# special case:
|
||||
find_package(Cups)
|
||||
find_package(WrapOpenGL)
|
||||
qt_find_package(Cups PROVIDED_TARGETS Cups::Cups)
|
||||
qt_find_package(WrapOpenGL PROVIDED_TARGETS WrapOpenGL)
|
||||
|
||||
#####################################################################
|
||||
## qcocoa Plugin:
|
||||
|
@ -1,5 +1,5 @@
|
||||
find_package(EGL)
|
||||
find_package(WrapOpenGL)
|
||||
qt_find_package(EGL) # special case
|
||||
qt_find_package(WrapOpenGL PROVIDED_TARGETS WrapOpenGL) # special case
|
||||
|
||||
#####################################################################
|
||||
## EglFSDeviceIntegration Module:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Generated from eglfs_kms.pro.
|
||||
|
||||
find_package(gbm)
|
||||
find_package(Libdrm)
|
||||
qt_find_package(gbm)
|
||||
qt_find_package(Libdrm)
|
||||
|
||||
#####################################################################
|
||||
## qeglfs-kms-integration Plugin:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Generated from eglfs_kms_egldevice.pro.
|
||||
|
||||
find_package(Libdrm)
|
||||
qt_find_package(Libdrm)
|
||||
|
||||
#####################################################################
|
||||
## qeglfs-kms-egldevice-integration Plugin:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Generated from eglfs_kms_support.pro.
|
||||
|
||||
find_package(Libdrm)
|
||||
qt_find_package(Libdrm)
|
||||
|
||||
#####################################################################
|
||||
## EglFsKmsSupport Module:
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Generated from eglfs_x11.pro.
|
||||
|
||||
find_package(XCB)
|
||||
find_package(X11)
|
||||
find_package(X11_XCB)
|
||||
qt_find_package(XCB)
|
||||
qt_find_package(X11)
|
||||
qt_find_package(X11_XCB)
|
||||
|
||||
#####################################################################
|
||||
## qeglfs-x11-integration Plugin:
|
||||
|
@ -1,4 +1,4 @@
|
||||
find_package(Freetype) # special case
|
||||
qt_find_package(Freetype) # special case
|
||||
|
||||
#####################################################################
|
||||
## qminimal Plugin:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Generated from minimalegl.pro.
|
||||
|
||||
find_package(WrapOpenGL)
|
||||
qt_find_package(WrapOpenGL PROVIDED_TARGETS WrapOpenGL) # special case
|
||||
|
||||
#####################################################################
|
||||
## qminimalegl Plugin:
|
||||
|
@ -1,13 +1,13 @@
|
||||
# Generated from xcb_qpa_lib.pro.
|
||||
|
||||
# special case:
|
||||
find_package(X11_XCB)
|
||||
find_package(X11)
|
||||
find_package(XCB)
|
||||
find_package(XKB)
|
||||
find_package(PkgConfig)
|
||||
find_package(Freetype)
|
||||
find_package(GLIB2)
|
||||
qt_find_package(X11_XCB)
|
||||
qt_find_package(X11)
|
||||
qt_find_package(XCB)
|
||||
qt_find_package(XKB)
|
||||
qt_find_package(PkgConfig)
|
||||
qt_find_package(Freetype)
|
||||
qt_find_package(GLIB2)
|
||||
|
||||
pkg_check_modules(XKB_COMMON_X11 xkbcommon-x11>=0.4.1 IMPORTED_TARGET) # special case
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Generated from gtk3.pro.
|
||||
|
||||
find_package(GTK3)
|
||||
find_package(X11)
|
||||
qt_find_package(GTK3)
|
||||
qt_find_package(X11)
|
||||
|
||||
#####################################################################
|
||||
## qgtk3 Plugin:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Generated from cups.pro.
|
||||
|
||||
find_package(Cups)
|
||||
qt_find_package(Cups PROVIDED_TARGETS Cups::Cups) # special case
|
||||
|
||||
#####################################################################
|
||||
## cupsprintersupport Plugin:
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
#### Libraries
|
||||
|
||||
find_package(PostgreSQL)
|
||||
qt_find_package(PostgreSQL PROVIDED_TARGETS PostgreSQL::PostgreSQL)
|
||||
set_package_properties(PostgreSQL PROPERTIES TYPE OPTIONAL)
|
||||
find_package(ODBC)
|
||||
qt_find_package(ODBC PROVIDED_TARGETS ODBC::ODBC)
|
||||
set_package_properties(ODBC PROPERTIES TYPE OPTIONAL)
|
||||
find_package(SQLite3)
|
||||
qt_find_package(SQLite3)
|
||||
set_package_properties(SQLite3 PROPERTIES TYPE OPTIONAL)
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
find_package(ODBC) # special case
|
||||
qt_find_package(ODBC) # special case
|
||||
|
||||
#####################################################################
|
||||
## qsqlodbc Plugin:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# FIXME cmake FindPostgreSQL is more exhaustive than the check we have for libpq-fe.h
|
||||
# it also checks for catalog/pg_type.h which is a more internal include, we should
|
||||
# add a way to tell cmake FindPostgreSQL to optionally only look for the libpq-fe.h one
|
||||
find_package(PostgreSQL) # special case
|
||||
qt_find_package(PostgreSQL) # special case
|
||||
|
||||
#####################################################################
|
||||
## qsqlpsql Plugin:
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#### Libraries
|
||||
|
||||
find_package(Cups)
|
||||
qt_find_package(Cups PROVIDED_TARGETS Cups::Cups)
|
||||
set_package_properties(Cups PROPERTIES TYPE OPTIONAL)
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#### Libraries
|
||||
|
||||
find_package(GTK3)
|
||||
qt_find_package(GTK3)
|
||||
set_package_properties(GTK3 PROPERTIES TYPE OPTIONAL)
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ import re
|
||||
import sys
|
||||
from typing import Set, Union, List, Dict
|
||||
|
||||
from helper import map_qt_library, featureName, substitute_platform
|
||||
from helper import map_qt_library, featureName, substitute_platform, qmake_library_to_cmake_target_mapping
|
||||
|
||||
knownTests = set() # type: Set[str]
|
||||
|
||||
@ -68,7 +68,6 @@ def map_library(lib: str) -> Union[str, LibraryMapping, List[str]]:
|
||||
'libinput': 'Libinput',
|
||||
'libjpeg': 'JPEG',
|
||||
'libpng': 'PNG',
|
||||
'libpng': 'PNG',
|
||||
'libproxy': 'Libproxy',
|
||||
'librt': 'WrapRt',
|
||||
'libudev': 'Libudev',
|
||||
@ -260,10 +259,16 @@ def parseLib(ctx, lib, data, cm_fh, cmake_find_packages_set):
|
||||
isRequired = True
|
||||
extra.remove("REQUIRED")
|
||||
|
||||
# If we have a mapping from a qmake library to a CMake target name,
|
||||
# encode that in the qt_find_package call().
|
||||
cmake_target_name = qmake_library_to_cmake_target_mapping.get(lib, None)
|
||||
if cmake_target_name:
|
||||
extra += ['PROVIDED_TARGETS', cmake_target_name]
|
||||
|
||||
if extra:
|
||||
cm_fh.write('find_package({} {})\n'.format(newlib, ' '.join(extra)))
|
||||
cm_fh.write('qt_find_package({} {})\n'.format(newlib, ' '.join(extra)))
|
||||
else:
|
||||
cm_fh.write('find_package({})\n'.format(newlib))
|
||||
cm_fh.write('qt_find_package({})\n'.format(newlib))
|
||||
|
||||
cm_fh.write('set_package_properties({} PROPERTIES TYPE {})\n'
|
||||
.format(newlib, 'REQUIRED' if isRequired else 'OPTIONAL')
|
||||
|
@ -211,7 +211,7 @@ def substitute_platform(platform: str) -> str:
|
||||
return platform_mapping.get(platform, platform)
|
||||
|
||||
|
||||
libray_mapping = {
|
||||
qmake_library_to_cmake_target_mapping = {
|
||||
'atspi': 'PkgConfig::ATSPI2',
|
||||
'cups': 'Cups::Cups',
|
||||
'drm': 'Libdrm::Libdrm',
|
||||
@ -228,7 +228,7 @@ libray_mapping = {
|
||||
'libdl': '${CMAKE_DL_LIBS}',
|
||||
'libinput': 'Libinput::Libinput',
|
||||
'libpng' : 'PNG::PNG',
|
||||
'libproxy': 'LibProxy::LibProxy',
|
||||
'libproxy': 'PkgConfig::Libproxy',
|
||||
'librt': 'WrapRt',
|
||||
'libudev': 'PkgConfig::Libudev',
|
||||
'mtdev': 'PkgConfig::Mtdev',
|
||||
@ -269,4 +269,4 @@ def substitute_libs(lib: str) -> str:
|
||||
if lib.endswith('/nolink'):
|
||||
lib = lib[:-7]
|
||||
libpostfix = '_nolink'
|
||||
return libray_mapping.get(lib, lib) + libpostfix
|
||||
return qmake_library_to_cmake_target_mapping.get(lib, lib) + libpostfix
|
||||
|
Loading…
Reference in New Issue
Block a user