Include QRegularExpression in the bootstrap library

This allows us to use regular expressions in bootstrapped tools
such as moc and tracegen.

Change-Id: I4310dd15bf26651aac6ab30c884e025ca06b3099
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Lars Knoll 2020-03-26 13:01:36 +01:00
parent ce1d4d3628
commit 33752a9bd3
8 changed files with 142 additions and 53 deletions

View File

@ -51,11 +51,6 @@ qt_set_symbol_visibility_hidden(BundledPcre2)
## Scopes:
#####################################################################
qt_extend_target(BundledPcre2 CONDITION WIN32
PUBLIC_DEFINES
PCRE2_STATIC
)
qt_extend_target(BundledPcre2 CONDITION QNX OR UIKIT OR WINRT
DEFINES
PCRE2_DISABLE_JIT
@ -70,3 +65,8 @@ qt_extend_target(BundledPcre2 CONDITION (TEST_architecture_arch STREQUAL "arm64"
DEFINES
PCRE2_DISABLE_JIT
)
qt_extend_target(BundledPcre2 CONDITION WIN32
PUBLIC_DEFINES
PCRE2_STATIC
)

41
src/3rdparty/pcre2/pcre2.pri vendored Normal file
View File

@ -0,0 +1,41 @@
MODULE_INCLUDEPATH += $$PWD/src
MODULE_DEFINES += PCRE2_CODE_UNIT_WIDTH=16
win32: MODULE_DEFINES += PCRE2_STATIC
DEFINES += HAVE_CONFIG_H
SOURCES += \
$$PWD/src/pcre2_auto_possess.c \
$$PWD/src/pcre2_chartables.c \
$$PWD/src/pcre2_compile.c \
$$PWD/src/pcre2_config.c \
$$PWD/src/pcre2_context.c \
$$PWD/src/pcre2_dfa_match.c \
$$PWD/src/pcre2_error.c \
$$PWD/src/pcre2_extuni.c \
$$PWD/src/pcre2_find_bracket.c \
$$PWD/src/pcre2_jit_compile.c \
$$PWD/src/pcre2_maketables.c \
$$PWD/src/pcre2_match.c \
$$PWD/src/pcre2_match_data.c \
$$PWD/src/pcre2_newline.c \
$$PWD/src/pcre2_ord2utf.c \
$$PWD/src/pcre2_pattern_info.c \
$$PWD/src/pcre2_script_run.c \
$$PWD/src/pcre2_serialize.c \
$$PWD/src/pcre2_string_utils.c \
$$PWD/src/pcre2_study.c \
$$PWD/src/pcre2_substitute.c \
$$PWD/src/pcre2_substring.c \
$$PWD/src/pcre2_tables.c \
$$PWD/src/pcre2_ucd.c \
$$PWD/src/pcre2_valid_utf.c \
$$PWD/src/pcre2_xclass.c
HEADERS += \
$$PWD/src/config.h \
$$PWD/src/pcre2.h \
$$PWD/src/pcre2_internal.h \
$$PWD/src/pcre2_intmodedep.h \
$$PWD/src/pcre2_ucp.h

View File

@ -5,51 +5,11 @@ CONFIG += \
hide_symbols \
exceptions_off rtti_off warn_off
MODULE_DEFINES += PCRE2_CODE_UNIT_WIDTH=16
win32: MODULE_DEFINES += PCRE2_STATIC
MODULE_INCLUDEPATH += $$PWD/src
load(qt_helper_lib)
DEFINES += HAVE_CONFIG_H
include(pcre2.pri)
# platform/compiler specific definitions
uikit|qnx|winrt: DEFINES += PCRE2_DISABLE_JIT
win32:contains(QT_ARCH, "arm"): DEFINES += PCRE2_DISABLE_JIT
win32:contains(QT_ARCH, "arm64"): DEFINES += PCRE2_DISABLE_JIT
SOURCES += \
$$PWD/src/pcre2_auto_possess.c \
$$PWD/src/pcre2_chartables.c \
$$PWD/src/pcre2_compile.c \
$$PWD/src/pcre2_config.c \
$$PWD/src/pcre2_context.c \
$$PWD/src/pcre2_dfa_match.c \
$$PWD/src/pcre2_error.c \
$$PWD/src/pcre2_extuni.c \
$$PWD/src/pcre2_find_bracket.c \
$$PWD/src/pcre2_jit_compile.c \
$$PWD/src/pcre2_maketables.c \
$$PWD/src/pcre2_match.c \
$$PWD/src/pcre2_match_data.c \
$$PWD/src/pcre2_newline.c \
$$PWD/src/pcre2_ord2utf.c \
$$PWD/src/pcre2_pattern_info.c \
$$PWD/src/pcre2_script_run.c \
$$PWD/src/pcre2_serialize.c \
$$PWD/src/pcre2_string_utils.c \
$$PWD/src/pcre2_study.c \
$$PWD/src/pcre2_substitute.c \
$$PWD/src/pcre2_substring.c \
$$PWD/src/pcre2_tables.c \
$$PWD/src/pcre2_ucd.c \
$$PWD/src/pcre2_valid_utf.c \
$$PWD/src/pcre2_xclass.c
HEADERS += \
$$PWD/src/config.h \
$$PWD/src/pcre2.h \
$$PWD/src/pcre2_internal.h \
$$PWD/src/pcre2_intmodedep.h \
$$PWD/src/pcre2_ucp.h
load(qt_helper_lib)

View File

@ -106,7 +106,11 @@
#define QT_FEATURE_lttng -1
#define QT_NO_QOBJECT
#define QT_FEATURE_process -1
#ifndef QT_BUILD_QMAKE
#define QT_FEATURE_regularexpression 1
#else
#define QT_FEATURE_regularexpression -1
#endif
#ifdef __GLIBC_PREREQ
# define QT_FEATURE_renameat2 (__GLIBC_PREREQ(2, 28) ? 1 : -1)
#else

View File

@ -101,6 +101,11 @@
#include <emscripten/emscripten.h>
#endif
#if QT_CONFIG(slog2)
extern char *__progname;
#endif
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(regularexpression)
# ifdef __UCLIBC__
# if __UCLIBC_HAS_BACKTRACE__
@ -111,11 +116,6 @@
# endif
#endif
#if QT_CONFIG(slog2)
extern char *__progname;
#endif
#ifndef QT_BOOTSTRAPPED
#if defined(Q_OS_LINUX) && (defined(__GLIBC__) || __has_include(<sys/syscall.h>))
# include <sys/syscall.h>

View File

@ -10,6 +10,37 @@ qt_add_module(Bootstrap
NO_SYNC_QT
QMAKE_MODULE_CONFIG gc_binaries
SOURCES
../../3rdparty/pcre2/src/config.h
../../3rdparty/pcre2/src/pcre2.h
../../3rdparty/pcre2/src/pcre2_auto_possess.c
../../3rdparty/pcre2/src/pcre2_chartables.c
../../3rdparty/pcre2/src/pcre2_compile.c
../../3rdparty/pcre2/src/pcre2_config.c
../../3rdparty/pcre2/src/pcre2_context.c
../../3rdparty/pcre2/src/pcre2_dfa_match.c
../../3rdparty/pcre2/src/pcre2_error.c
../../3rdparty/pcre2/src/pcre2_extuni.c
../../3rdparty/pcre2/src/pcre2_find_bracket.c
../../3rdparty/pcre2/src/pcre2_internal.h
../../3rdparty/pcre2/src/pcre2_intmodedep.h
../../3rdparty/pcre2/src/pcre2_jit_compile.c
../../3rdparty/pcre2/src/pcre2_maketables.c
../../3rdparty/pcre2/src/pcre2_match.c
../../3rdparty/pcre2/src/pcre2_match_data.c
../../3rdparty/pcre2/src/pcre2_newline.c
../../3rdparty/pcre2/src/pcre2_ord2utf.c
../../3rdparty/pcre2/src/pcre2_pattern_info.c
../../3rdparty/pcre2/src/pcre2_script_run.c
../../3rdparty/pcre2/src/pcre2_serialize.c
../../3rdparty/pcre2/src/pcre2_string_utils.c
../../3rdparty/pcre2/src/pcre2_study.c
../../3rdparty/pcre2/src/pcre2_substitute.c
../../3rdparty/pcre2/src/pcre2_substring.c
../../3rdparty/pcre2/src/pcre2_tables.c
../../3rdparty/pcre2/src/pcre2_ucd.c
../../3rdparty/pcre2/src/pcre2_ucp.h
../../3rdparty/pcre2/src/pcre2_valid_utf.c
../../3rdparty/pcre2/src/pcre2_xclass.c
../../corelib/codecs/qlatincodec.cpp
../../corelib/codecs/qtextcodec.cpp
../../corelib/codecs/qutfcodec.cpp
@ -73,6 +104,7 @@ qt_add_module(Bootstrap
../../corelib/text/qlocale.cpp
../../corelib/text/qlocale_tools.cpp
../../corelib/text/qregexp.cpp
../../corelib/text/qregularexpression.cpp
../../corelib/text/qstring.cpp
../../corelib/text/qstring_compat.cpp
../../corelib/text/qstringbuilder.cpp
@ -99,6 +131,9 @@ qt_add_module(Bootstrap
../../xml/dom/qdom.cpp
../../xml/sax/qxml.cpp
DEFINES
HAVE_CONFIG_H
PCRE2_CODE_UNIT_WIDTH=16
PCRE2_DISABLE_JIT
QT_BOOTSTRAPPED
QT_NO_CAST_FROM_ASCII
QT_NO_CAST_TO_ASCII
@ -108,6 +143,7 @@ qt_add_module(Bootstrap
QT_VERSION_PATCH=
QT_VERSION_STR=\"\"
PUBLIC_DEFINES
PCRE2_CODE_UNIT_WIDTH=16
QT_BOOTSTRAPPED
QT_NO_CAST_TO_ASCII
QT_VERSION_MAJOR=
@ -117,6 +153,8 @@ qt_add_module(Bootstrap
INCLUDE_DIRECTORIES
..
../../3rdparty/tinycbor/src
PUBLIC_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/pcre2/src>
)
#### Keys ignored in scope 1:.:.:bootstrap.pro:<TRUE>:
@ -155,6 +193,8 @@ qt_extend_target(Bootstrap CONDITION WIN32
../../corelib/kernel/qsystemsemaphore_win.cpp
../../corelib/kernel/qwinregistry.cpp
../../corelib/plugin/qsystemlibrary.cpp
PUBLIC_DEFINES
PCRE2_STATIC
PUBLIC_LIBRARIES
advapi32
netapi32

View File

@ -11,6 +11,37 @@ add_library(Bootstrap STATIC)
# special case end
qt_extend_target(Bootstrap
SOURCES
../../3rdparty/pcre2/src/config.h
../../3rdparty/pcre2/src/pcre2.h
../../3rdparty/pcre2/src/pcre2_auto_possess.c
../../3rdparty/pcre2/src/pcre2_chartables.c
../../3rdparty/pcre2/src/pcre2_compile.c
../../3rdparty/pcre2/src/pcre2_config.c
../../3rdparty/pcre2/src/pcre2_context.c
../../3rdparty/pcre2/src/pcre2_dfa_match.c
../../3rdparty/pcre2/src/pcre2_error.c
../../3rdparty/pcre2/src/pcre2_extuni.c
../../3rdparty/pcre2/src/pcre2_find_bracket.c
../../3rdparty/pcre2/src/pcre2_internal.h
../../3rdparty/pcre2/src/pcre2_intmodedep.h
../../3rdparty/pcre2/src/pcre2_jit_compile.c
../../3rdparty/pcre2/src/pcre2_maketables.c
../../3rdparty/pcre2/src/pcre2_match.c
../../3rdparty/pcre2/src/pcre2_match_data.c
../../3rdparty/pcre2/src/pcre2_newline.c
../../3rdparty/pcre2/src/pcre2_ord2utf.c
../../3rdparty/pcre2/src/pcre2_pattern_info.c
../../3rdparty/pcre2/src/pcre2_script_run.c
../../3rdparty/pcre2/src/pcre2_serialize.c
../../3rdparty/pcre2/src/pcre2_string_utils.c
../../3rdparty/pcre2/src/pcre2_study.c
../../3rdparty/pcre2/src/pcre2_substitute.c
../../3rdparty/pcre2/src/pcre2_substring.c
../../3rdparty/pcre2/src/pcre2_tables.c
../../3rdparty/pcre2/src/pcre2_ucd.c
../../3rdparty/pcre2/src/pcre2_ucp.h
../../3rdparty/pcre2/src/pcre2_valid_utf.c
../../3rdparty/pcre2/src/pcre2_xclass.c
../../corelib/codecs/qlatincodec.cpp
../../corelib/codecs/qtextcodec.cpp
../../corelib/codecs/qutfcodec.cpp
@ -74,6 +105,7 @@ qt_extend_target(Bootstrap
../../corelib/text/qlocale.cpp
../../corelib/text/qlocale_tools.cpp
../../corelib/text/qregexp.cpp
../../corelib/text/qregularexpression.cpp
../../corelib/text/qstring.cpp
../../corelib/text/qstring_compat.cpp
../../corelib/text/qstringbuilder.cpp
@ -99,6 +131,10 @@ qt_extend_target(Bootstrap
../../corelib/tools/qversionnumber.cpp
../../xml/dom/qdom.cpp
../../xml/sax/qxml.cpp
DEFINES
HAVE_CONFIG_H
PCRE2_CODE_UNIT_WIDTH=16
PCRE2_DISABLE_JIT
PUBLIC_DEFINES # special case
QT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} # special case
QT_VERSION_MINOR=${PROJECT_VERSION_MINOR} # special case
@ -113,6 +149,7 @@ qt_extend_target(Bootstrap
..
../../3rdparty/tinycbor/src
PUBLIC_INCLUDE_DIRECTORIES # special case
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/pcre2/src>
$<TARGET_PROPERTY:Core,INCLUDE_DIRECTORIES> # special case
$<TARGET_PROPERTY:Xml,INCLUDE_DIRECTORIES> # special case
PUBLIC_LIBRARIES # special case
@ -155,6 +192,8 @@ qt_extend_target(Bootstrap CONDITION WIN32
../../corelib/kernel/qsystemsemaphore_win.cpp
../../corelib/kernel/qwinregistry.cpp
../../corelib/plugin/qsystemlibrary.cpp
PUBLIC_DEFINES
PCRE2_STATIC
PUBLIC_LIBRARIES
advapi32
netapi32

View File

@ -14,6 +14,9 @@ MODULE_DEFINES = \
QT_NO_CAST_TO_ASCII
MODULE_CONFIG = gc_binaries
DEFINES += PCRE2_DISABLE_JIT
include(../../3rdparty/pcre2/pcre2.pri)
DEFINES += \
$$MODULE_DEFINES \
QT_NO_FOREACH \
@ -21,7 +24,8 @@ DEFINES += \
INCLUDEPATH += \
$$PWD/.. \
$$PWD/../../3rdparty/tinycbor/src
$$PWD/../../3rdparty/tinycbor/src \
$$PWD/../../3rdparty/pcre2/src
SOURCES += \
../../corelib/codecs/qlatincodec.cpp \
@ -87,6 +91,7 @@ SOURCES += \
../../corelib/text/qlocale.cpp \
../../corelib/text/qlocale_tools.cpp \
../../corelib/text/qregexp.cpp \
../../corelib/text/qregularexpression.cpp \
../../corelib/text/qstring.cpp \
../../corelib/text/qstringbuilder.cpp \
../../corelib/text/qstring_compat.cpp \