Add support for private module .pri files
Generate a pri file for public and private interfaces, but map CONFIG += internal_module to a cmake option and skip the former if set. Task-number: QTBUG-75666 Change-Id: I3f4baf1277094f4c22149a9e8769734baf9a235f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
2fb7cca6ba
commit
a6c11d3e09
@ -294,20 +294,28 @@ function(qt_set_up_developer_build)
|
||||
endfunction()
|
||||
|
||||
# Generates module .pri files for consumption by qmake
|
||||
function(qt_generate_module_pri_file target target_path pri_file_name_var)
|
||||
set(flags)
|
||||
function(qt_generate_module_pri_file target target_path pri_files_var)
|
||||
set(flags INTERNAL_MODULE)
|
||||
set(options)
|
||||
set(multiopts QMAKE_MODULE_CONFIG)
|
||||
cmake_parse_arguments(arg "${flags}" "${options}" "${multiopts}" ${ARGN})
|
||||
|
||||
qt_internal_module_info(module "${target}")
|
||||
qt_path_join(pri_file_name "${target_path}" "qt_lib_${module_lower}.pri")
|
||||
set("${pri_file_name_var}" "${pri_file_name}" PARENT_SCOPE)
|
||||
set(pri_files "${pri_file_name}")
|
||||
|
||||
get_target_property(enabled_features "${target}" QT_ENABLED_PUBLIC_FEATURES)
|
||||
get_target_property(disabled_features "${target}" QT_DISABLED_PUBLIC_FEATURES)
|
||||
string (REPLACE ";" " " enabled_features "${enabled_features}")
|
||||
string (REPLACE ";" " " disabled_features "${disabled_features}")
|
||||
get_target_property(enabled_private_features "${target}" QT_ENABLED_PRIVATE_FEATURES)
|
||||
get_target_property(disabled_private_features "${target}" QT_DISABLED_PRIVATE_FEATURES)
|
||||
|
||||
foreach(var enabled_features disabled_features enabled_private_features disabled_private_features)
|
||||
if(${var} STREQUAL "${var}-NOTFOUND")
|
||||
set(${var} "")
|
||||
else()
|
||||
string (REPLACE ";" " " ${var} "${${var}}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(arg_QMAKE_MODULE_CONFIG)
|
||||
string(REPLACE ";" " " module_config "${arg_QMAKE_MODULE_CONFIG}")
|
||||
@ -316,9 +324,10 @@ function(qt_generate_module_pri_file target target_path pri_file_name_var)
|
||||
set(module_config "")
|
||||
endif()
|
||||
|
||||
file(GENERATE
|
||||
OUTPUT "${pri_file_name}"
|
||||
CONTENT
|
||||
if (NOT ${arg_INTERNAL_MODULE})
|
||||
file(GENERATE
|
||||
OUTPUT "${pri_file_name}"
|
||||
CONTENT
|
||||
"QT.${module_lower}.VERSION = ${PROJECT_VERSION}
|
||||
QT.${module_lower}.name = ${module}
|
||||
QT.${module_lower}.module = ${module_versioned}
|
||||
@ -333,8 +342,31 @@ QT.${module_lower}.DEFINES = QT_${module_define}_LIB
|
||||
QT.${module_lower}.enabled_features = ${enabled_features}
|
||||
QT.${module_lower}.disabled_features = ${disabled_features}${module_config}
|
||||
QT_MODULES += ${module_lower}
|
||||
"
|
||||
)
|
||||
endif()
|
||||
|
||||
qt_path_join(private_pri_file "${target_path}" "qt_lib_${module_lower}_private.pri")
|
||||
list(APPEND pri_files "${private_pri_file}")
|
||||
|
||||
file(GENERATE
|
||||
OUTPUT "${private_pri_file}"
|
||||
CONTENT
|
||||
"QT.${module_lower}_private.VERSION = ${PROJECT_VERSION}
|
||||
QT.${module_lower}_private.name = ${module}
|
||||
QT.${module_lower}_private.module =
|
||||
QT.${module_lower}_private.libs = $$QT_MODULE_LIB_BASE
|
||||
QT.${module_lower}_private.includes = $$QT_MODULE_INCLUDE_BASE/${module}/${PROJECT_VERSION} $$QT_MODULE_INCLUDE_BASE/${module}/${PROJECT_VERSION}/${module}
|
||||
QT.${module_lower}_private.frameworks =
|
||||
QT.${module_lower}_private.depends = ${module_lower}
|
||||
QT.${module_lower}_private.uses =
|
||||
QT.${module_lower}_private.module_config = v2
|
||||
QT.${module_lower}_private.enabled_features = ${enabled_private_features}
|
||||
QT.${module_lower}_private.disabled_features = ${disabled_private_features}
|
||||
"
|
||||
)
|
||||
|
||||
set("${pri_files_var}" "${pri_files}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(qt_generate_global_config_pri_file)
|
||||
@ -1071,7 +1103,7 @@ function(add_qt_module target)
|
||||
|
||||
# Process arguments:
|
||||
qt_parse_all_arguments(arg "add_qt_module"
|
||||
"NO_MODULE_HEADERS;STATIC;DISABLE_TOOLS_EXPORT;EXCEPTIONS"
|
||||
"NO_MODULE_HEADERS;STATIC;DISABLE_TOOLS_EXPORT;EXCEPTIONS;INTERNAL_MODULE"
|
||||
"CONFIG_MODULE_NAME"
|
||||
"${__default_private_args};${__default_public_args};QMAKE_MODULE_CONFIG" ${ARGN})
|
||||
|
||||
@ -1311,12 +1343,19 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
|
||||
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
|
||||
CONFIG_INSTALL_DIR "${config_install_dir}")
|
||||
|
||||
if (${arg_INTERNAL_MODULE})
|
||||
set(arg_INTERNAL_MODULE "INTERNAL_MODULE")
|
||||
else()
|
||||
unset(arg_INTERNAL_MODULE)
|
||||
endif()
|
||||
|
||||
qt_path_join(pri_target_path ${PROJECT_BINARY_DIR} mkspecs/modules)
|
||||
qt_generate_module_pri_file("${target}" "${pri_target_path}" module_pri_file_name
|
||||
qt_generate_module_pri_file("${target}" "${pri_target_path}" module_pri_files
|
||||
${arg_INTERNAL_MODULE}
|
||||
QMAKE_MODULE_CONFIG
|
||||
${arg_QMAKE_MODULE_CONFIG}
|
||||
)
|
||||
qt_install(FILES "${module_pri_file_name}" DESTINATION mkspecs/modules)
|
||||
qt_install(FILES "${module_pri_files}" DESTINATION mkspecs/modules)
|
||||
|
||||
### fixme: cmake is missing a built-in variable for this. We want to apply it only to modules and plugins
|
||||
# that belong to Qt.
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(AccessibilitySupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qaccessiblebridgeutils.cpp qaccessiblebridgeutils_p.h
|
||||
DEFINES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(ClipboardSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qmacmime.mm qmacmime_p.h
|
||||
DEFINES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(DeviceDiscoverySupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qdevicediscovery_p.h
|
||||
DEFINES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(EdidSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qedidparser.cpp qedidparser_p.h
|
||||
DEFINES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(EglSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qeglconvenience.cpp qeglconvenience_p.h
|
||||
qeglstreamconvenience.cpp qeglstreamconvenience_p.h
|
||||
|
@ -6,6 +6,7 @@ qt_find_package(EGL) # special case
|
||||
|
||||
add_qt_module(EglSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qeglconvenience.cpp qeglconvenience_p.h
|
||||
qeglstreamconvenience.cpp qeglstreamconvenience_p.h
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(EventDispatcherSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
DEFINES
|
||||
QT_NO_CAST_FROM_ASCII
|
||||
LIBRARIES
|
||||
|
@ -8,6 +8,7 @@ qt_find_package(GLIB2) # special case
|
||||
|
||||
add_qt_module(EventDispatcherSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
DEFINES
|
||||
QT_NO_CAST_FROM_ASCII
|
||||
LIBRARIES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(FbSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qfbbackingstore.cpp qfbbackingstore_p.h
|
||||
qfbcursor.cpp qfbcursor_p.h
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(FontDatabaseSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
DEFINES
|
||||
QT_NO_CAST_FROM_ASCII
|
||||
LIBRARIES
|
||||
|
@ -9,6 +9,7 @@ qt_find_package(Fontconfig) # special case
|
||||
|
||||
add_qt_module(FontDatabaseSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
DEFINES
|
||||
QT_NO_CAST_FROM_ASCII
|
||||
LIBRARIES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(GlxSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qglxconvenience.cpp qglxconvenience_p.h
|
||||
DEFINES
|
||||
|
@ -8,6 +8,7 @@ qt_find_package(X11) # special case
|
||||
|
||||
add_qt_module(GlxSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qglxconvenience.cpp qglxconvenience_p.h
|
||||
DEFINES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(GraphicsSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qrasterbackingstore.cpp qrasterbackingstore_p.h
|
||||
DEFINES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(InputSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
DEFINES
|
||||
QT_NO_CAST_FROM_ASCII
|
||||
LIBRARIES
|
||||
|
@ -11,6 +11,7 @@ qt_find_package(Mtdev) # special case
|
||||
|
||||
add_qt_module(InputSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
DEFINES
|
||||
QT_NO_CAST_FROM_ASCII
|
||||
LIBRARIES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(XkbCommonSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qxkbcommon.cpp qxkbcommon_p.h
|
||||
qxkbcommon_3rdparty.cpp
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(KmsSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qkmsdevice.cpp qkmsdevice_p.h
|
||||
DEFINES
|
||||
|
@ -8,6 +8,7 @@ qt_find_package(Libdrm) # special case
|
||||
|
||||
add_qt_module(KmsSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qkmsdevice.cpp qkmsdevice_p.h
|
||||
DEFINES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(LinuxAccessibilitySupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
application.cpp application_p.h
|
||||
atspiadaptor.cpp atspiadaptor_p.h
|
||||
|
@ -8,6 +8,7 @@ qt_find_package(ATSPI2) # special case
|
||||
|
||||
add_qt_module(LinuxAccessibilitySupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
application.cpp application_p.h
|
||||
atspiadaptor.cpp atspiadaptor_p.h
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(PlatformCompositorSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qopenglcompositor.cpp qopenglcompositor_p.h
|
||||
qopenglcompositorbackingstore.cpp qopenglcompositorbackingstore_p.h
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(ServiceSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
genericunix/qgenericunixservices.cpp genericunix/qgenericunixservices_p.h
|
||||
DEFINES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(ThemeSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qabstractfileiconengine.cpp qabstractfileiconengine_p.h
|
||||
DEFINES
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(VulkanSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qbasicvulkanplatforminstance.cpp qbasicvulkanplatforminstance_p.h
|
||||
qvkconvenience.cpp qvkconvenience_p.h
|
||||
|
@ -8,6 +8,7 @@ qt_find_package(Vulkan) # special case
|
||||
|
||||
add_qt_module(VulkanSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qbasicvulkanplatforminstance.cpp qbasicvulkanplatforminstance_p.h
|
||||
qvkconvenience.cpp qvkconvenience_p.h
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
add_qt_module(WindowsUIAutomationSupport
|
||||
STATIC
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
qwindowsuiawrapper.cpp qwindowsuiawrapper_p.h
|
||||
uiaattributeids_p.h
|
||||
|
@ -5,6 +5,7 @@
|
||||
#####################################################################
|
||||
|
||||
add_qt_module(EglFSDeviceIntegration
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
api/qeglfsdeviceintegration.cpp api/qeglfsdeviceintegration_p.h
|
||||
api/qeglfsglobal_p.h
|
||||
|
@ -6,6 +6,7 @@ qt_find_package(EGL) # special case
|
||||
#####################################################################
|
||||
|
||||
add_qt_module(EglFSDeviceIntegration
|
||||
INTERNAL_MODULE
|
||||
SOURCES
|
||||
api/qeglfsdeviceintegration.cpp api/qeglfsdeviceintegration_p.h
|
||||
api/qeglfsglobal_p.h
|
||||
|
@ -5,6 +5,7 @@
|
||||
#####################################################################
|
||||
|
||||
add_qt_module(EglFsKmsSupport
|
||||
INTERNAL_MODULE
|
||||
NO_MODULE_HEADERS
|
||||
SOURCES
|
||||
qeglfskmsdevice.cpp qeglfskmsdevice.h
|
||||
|
@ -5,6 +5,7 @@
|
||||
#####################################################################
|
||||
|
||||
add_qt_module(XcbQpa
|
||||
INTERNAL_MODULE
|
||||
NO_MODULE_HEADERS
|
||||
SOURCES
|
||||
gl_integrations/qxcbglintegration.cpp gl_integrations/qxcbglintegration.h
|
||||
|
@ -27,6 +27,7 @@ qt_find_package(XKB_COMMON_X11 PROVIDED_TARGETS PkgConfig::XKB_COMMON_X11)
|
||||
#####################################################################
|
||||
|
||||
add_qt_module(XcbQpa
|
||||
INTERNAL_MODULE
|
||||
NO_MODULE_HEADERS
|
||||
SOURCES
|
||||
gl_integrations/qxcbglintegration.cpp gl_integrations/qxcbglintegration.h
|
||||
|
@ -1605,6 +1605,8 @@ def write_module(cm_fh: typing.IO[str], scope: Scope, *,
|
||||
extra = []
|
||||
if 'static' in scope.get('CONFIG'):
|
||||
extra.append('STATIC')
|
||||
if 'internal_module' in scope.get('CONFIG'):
|
||||
extra.append('INTERNAL_MODULE')
|
||||
if 'no_module_headers' in scope.get('CONFIG'):
|
||||
extra.append('NO_MODULE_HEADERS')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user