Add support for using an inline namespaces for -qtnamespace
Inline namespaces serve the purpose for which the original -qtnamespace option was added and allow for macro simplification (no need for any using directives). This makes it possible to use namespaced builds of Qt also for Qt for Python and similar use cases which have issues with the additional namespace. [ChangeLog][QtCore] It is now possible to use an inline namespace for -qtnamespace (option -qtinlinenamespace). Task-number: PYSIDE-2590 Change-Id: Ia0cecf041321933a2e02d1fd8ae0e9cda699cd1e Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
e23ea6a5d3
commit
fdac1e2205
@ -910,6 +910,7 @@ translate_boolean_input(ccache QT_USE_CCACHE)
|
||||
translate_boolean_input(vcpkg QT_USE_VCPKG)
|
||||
translate_boolean_input(shared BUILD_SHARED_LIBS)
|
||||
translate_boolean_input(warnings_are_errors WARNINGS_ARE_ERRORS)
|
||||
translate_boolean_input(qtinlinenamespace QT_INLINE_NAMESPACE)
|
||||
translate_string_input(qt_namespace QT_NAMESPACE)
|
||||
translate_string_input(qt_libinfix QT_LIBINFIX)
|
||||
translate_string_input(qreal QT_COORD_TYPE)
|
||||
|
@ -45,6 +45,7 @@ The following table describes the mapping of configure options to CMake argument
|
||||
| -device-option <key=value> | -DQT_QMAKE_DEVICE_OPTIONS=key1=value1;key2=value2 | Only used for generation qmake-compatibility files. |
|
||||
| | | The device options are written into mkspecs/qdevice.pri. |
|
||||
| -appstore-compliant | -DFEATURE_appstore_compliant=ON | |
|
||||
| -qtinlinenamespace | -DQT_INLINE_NAMESPACE=ON | Make the namespace specified by -qtnamespace an inline one. |
|
||||
| -qtnamespace <name> | -DQT_NAMESPACE=<name> | |
|
||||
| -qtlibinfix <infix> | -DQT_LIBINFIX=<infix> | |
|
||||
| -coverage <tool> | -DINPUT_coverage=<tool> | Enables code coverage using the specified tool. |
|
||||
|
@ -101,6 +101,7 @@ Build options:
|
||||
|
||||
-qt-host-path <path> . Specify path to a Qt host build for cross-compiling.
|
||||
-qtnamespace <name> .. Wrap all Qt library code in 'namespace <name> {...}'.
|
||||
-qtinlinenamespace ... Make -qtnamespace an inline namespace
|
||||
-qtlibinfix <infix> .. Rename all libQt6*.so to libQt6*<infix>.so.
|
||||
|
||||
-coverage <tool> ..... Instrument with the code coverage tool.
|
||||
|
@ -101,6 +101,7 @@ qt_commandline_option(platform TYPE string)
|
||||
qt_commandline_option(plugin-manifests TYPE boolean)
|
||||
qt_commandline_option(profile TYPE boolean)
|
||||
qt_commandline_option(qreal TYPE string)
|
||||
qt_commandline_option(qtinlinenamespace TYPE boolean)
|
||||
qt_commandline_option(qtlibinfix TYPE string NAME qt_libinfix)
|
||||
qt_commandline_option(qtnamespace TYPE string NAME qt_namespace)
|
||||
qt_commandline_option(reduce-exports TYPE boolean NAME reduce_exports)
|
||||
|
@ -350,7 +350,11 @@ _qt_internal_setup_deploy_support()
|
||||
add_dependencies(Core qmodule_pri)
|
||||
|
||||
if (NOT QT_NAMESPACE STREQUAL "")
|
||||
target_compile_definitions(Core PUBLIC "QT_NAMESPACE=${QT_NAMESPACE}")
|
||||
set(core_namespace_defs "QT_NAMESPACE=${QT_NAMESPACE}")
|
||||
if(QT_INLINE_NAMESPACE)
|
||||
list(APPEND core_namespace_defs QT_INLINE_NAMESPACE)
|
||||
endif()
|
||||
target_compile_definitions(Core PUBLIC ${core_namespace_defs})
|
||||
set_target_properties(Core PROPERTIES _qt_namespace "${QT_NAMESPACE}")
|
||||
set_property(TARGET Core APPEND PROPERTY EXPORT_PROPERTIES _qt_namespace)
|
||||
endif()
|
||||
|
@ -105,6 +105,22 @@
|
||||
# define QT_FORWARD_DECLARE_CLASS(name) class name;
|
||||
# define QT_FORWARD_DECLARE_STRUCT(name) struct name;
|
||||
|
||||
#elif defined(QT_INLINE_NAMESPACE) /* user inline namespace FIXME in Qt 7: Default */
|
||||
|
||||
# define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
|
||||
# define QT_USE_NAMESPACE
|
||||
# define QT_BEGIN_NAMESPACE inline namespace QT_NAMESPACE {
|
||||
# define QT_END_NAMESPACE }
|
||||
# define QT_BEGIN_INCLUDE_NAMESPACE }
|
||||
# define QT_END_INCLUDE_NAMESPACE inline namespace QT_NAMESPACE {
|
||||
# define QT_FORWARD_DECLARE_CLASS(name) \
|
||||
QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE
|
||||
|
||||
# define QT_FORWARD_DECLARE_STRUCT(name) \
|
||||
QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE
|
||||
|
||||
inline namespace QT_NAMESPACE {}
|
||||
|
||||
#else /* user namespace */
|
||||
|
||||
# define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
|
||||
|
@ -1382,7 +1382,9 @@ bool RCCResourceLibrary::writeInitializer()
|
||||
"# define QT_RCC_MANGLE_NAMESPACE(name) name\n"
|
||||
"#endif\n\n");
|
||||
|
||||
writeString("#ifdef QT_NAMESPACE\n"
|
||||
writeString("#if defined(QT_INLINE_NAMESPACE)\n"
|
||||
"inline namespace QT_NAMESPACE {\n"
|
||||
"#elif defined(QT_NAMESPACE)\n"
|
||||
"namespace QT_NAMESPACE {\n"
|
||||
"#endif\n\n");
|
||||
}
|
||||
|
@ -115,7 +115,9 @@ TIMESTAMP:images/subdir/triangle.png
|
||||
# define QT_RCC_MANGLE_NAMESPACE(name) name
|
||||
#endif
|
||||
|
||||
#ifdef QT_NAMESPACE
|
||||
#if defined(QT_INLINE_NAMESPACE)
|
||||
inline namespace QT_NAMESPACE {
|
||||
#elif defined(QT_NAMESPACE)
|
||||
namespace QT_NAMESPACE {
|
||||
#endif
|
||||
|
||||
|
@ -115,7 +115,9 @@ TIMESTAMP:images/subdir/triangle.png
|
||||
# define QT_RCC_MANGLE_NAMESPACE(name) name
|
||||
#endif
|
||||
|
||||
#ifdef QT_NAMESPACE
|
||||
#if defined(QT_INLINE_NAMESPACE)
|
||||
inline namespace QT_NAMESPACE {
|
||||
#elif defined(QT_NAMESPACE)
|
||||
namespace QT_NAMESPACE {
|
||||
#endif
|
||||
|
||||
|
@ -57,7 +57,9 @@ TIMESTAMP:data/data-0.txt
|
||||
# define QT_RCC_MANGLE_NAMESPACE(name) name
|
||||
#endif
|
||||
|
||||
#ifdef QT_NAMESPACE
|
||||
#if defined(QT_INLINE_NAMESPACE)
|
||||
inline namespace QT_NAMESPACE {
|
||||
#elif defined(QT_NAMESPACE)
|
||||
namespace QT_NAMESPACE {
|
||||
#endif
|
||||
|
||||
|
@ -58,7 +58,9 @@ TIMESTAMP:data/data-1.txt
|
||||
# define QT_RCC_MANGLE_NAMESPACE(name) name
|
||||
#endif
|
||||
|
||||
#ifdef QT_NAMESPACE
|
||||
#if defined(QT_INLINE_NAMESPACE)
|
||||
inline namespace QT_NAMESPACE {
|
||||
#elif defined(QT_NAMESPACE)
|
||||
namespace QT_NAMESPACE {
|
||||
#endif
|
||||
|
||||
|
@ -95,7 +95,9 @@ TIMESTAMP:data/data-1.txt
|
||||
# define QT_RCC_MANGLE_NAMESPACE(name) name
|
||||
#endif
|
||||
|
||||
#ifdef QT_NAMESPACE
|
||||
#if defined(QT_INLINE_NAMESPACE)
|
||||
inline namespace QT_NAMESPACE {
|
||||
#elif defined(QT_NAMESPACE)
|
||||
namespace QT_NAMESPACE {
|
||||
#endif
|
||||
|
||||
|
@ -95,7 +95,9 @@ TIMESTAMP:data/data-1.txt
|
||||
# define QT_RCC_MANGLE_NAMESPACE(name) name
|
||||
#endif
|
||||
|
||||
#ifdef QT_NAMESPACE
|
||||
#if defined(QT_INLINE_NAMESPACE)
|
||||
inline namespace QT_NAMESPACE {
|
||||
#elif defined(QT_NAMESPACE)
|
||||
namespace QT_NAMESPACE {
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user