Skip to content

Commit

Permalink
Use Core library for qmake instead of the Bootstrap library
Browse files Browse the repository at this point in the history
Move the qmake-specific logic of the QLibraryInfo class to
qmake internals. 'qconfig.cpp.in' now stores information about
the library info entries to keep them consistent between qmake
and the Core library. qmake requires specific features enabled
in the Core library, so building qmake will be skipped if the
features are not enabled.

All flags directly related to the qmake have been removed from
Core lib.

Remove all bootstrap related sections from qmake CMakeLists.txt

Task-number: QTBUG-89369
Change-Id: I26de157d3bfd4a5526699296e9d46e1c180b89ae
Reviewed-by: Edward Welbourne <[email protected]>
Reviewed-by: Kai Koehne <[email protected]>
  • Loading branch information
semlanik committed Feb 25, 2021
1 parent 5a3bbb5 commit 43c28aa
Show file tree
Hide file tree
Showing 25 changed files with 550 additions and 565 deletions.
1 change: 0 additions & 1 deletion cmake/QtBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ set(__qt_add_plugin_multi_args
set(__qt_internal_add_executable_optional_args
GUI
BOOTSTRAP
NO_QT
NO_INSTALL
EXCEPTIONS
DELAY_RC
Expand Down
2 changes: 1 addition & 1 deletion cmake/QtExecutableHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function(qt_internal_add_executable name)
qt_skip_warnings_are_errors_when_repo_unclean("${name}")

set(extra_libraries "")
if(NOT arg_BOOTSTRAP AND NOT arg_NO_QT)
if(NOT arg_BOOTSTRAP)
set(extra_libraries "Qt::Core")
endif()

Expand Down
4 changes: 2 additions & 2 deletions cmake/QtQmakeHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ macro(qt_add_string_to_qconfig_cpp str)
math(EXPR QT_CONFIG_STR_OFFSET "${QT_CONFIG_STR_OFFSET}+${length}+1")
endmacro()

function(qt_generate_qconfig_cpp)
function(qt_generate_qconfig_cpp in_file out_file)
set(QT_CONFIG_STR_OFFSET "0")
set(QT_CONFIG_STR_OFFSETS "")
set(QT_CONFIG_STRS "")
Expand Down Expand Up @@ -92,7 +92,7 @@ function(qt_generate_qconfig_cpp)
set(QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH "${from_bin_dir_to_prefix}")
set(QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH "${from_bin_dir_to_prefix}")

configure_file(global/qconfig.cpp.in global/qconfig.cpp @ONLY)
configure_file(${in_file} ${out_file} @ONLY)
endfunction()

# In the cross-compiling case, creates a wrapper around the host Qt's
Expand Down
26 changes: 6 additions & 20 deletions cmake/QtToolHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function(qt_internal_add_tool target_name)
qt_tool_target_to_name(name ${target_name})
set(one_value_keywords TOOLS_TARGET EXTRA_CMAKE_FILES INSTALL_DIR
${__default_target_info_args})
qt_parse_all_arguments(arg "qt_add_tool" "BOOTSTRAP;NO_QT;NO_INSTALL"
qt_parse_all_arguments(arg "qt_add_tool" "BOOTSTRAP;NO_INSTALL"
"${one_value_keywords}"
"${__default_private_args}" ${ARGN})

Expand Down Expand Up @@ -109,39 +109,25 @@ function(qt_internal_add_tool target_name)
endif()

set(disable_autogen_tools "${arg_DISABLE_AUTOGEN_TOOLS}")
if (arg_NO_QT)
# FIXME: Remove NO_QT again once qmake can use a "normal" Qt!
if (arg_BOOTSTRAP)
message(FATAL_ERROR "Tool can not be NO_QT and BOOTSTRAP at the same time!")
endif()
set(corelib "")
if (arg_BOOTSTRAP)
set(corelib ${QT_CMAKE_EXPORT_NAMESPACE}::Bootstrap)
list(APPEND disable_autogen_tools "uic" "moc" "rcc")
else()
if (arg_BOOTSTRAP)
set(corelib ${QT_CMAKE_EXPORT_NAMESPACE}::Bootstrap)
list(APPEND disable_autogen_tools "uic" "moc" "rcc")
else()
set(corelib ${QT_CMAKE_EXPORT_NAMESPACE}::Core)
endif()
set(corelib ${QT_CMAKE_EXPORT_NAMESPACE}::Core)
endif()

set(bootstrap "")
if(arg_BOOTSTRAP)
set(bootstrap BOOTSTRAP)
endif()

set(no_qt "")
if(arg_NO_QT)
set(no_qt NO_QT)
endif()

set(install_dir "${INSTALL_BINDIR}")
if(arg_INSTALL_DIR)
set(install_dir "${arg_INSTALL_DIR}")
endif()

qt_internal_add_executable("${target_name}" OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${install_dir}"
${bootstrap}
${no_qt}
NO_INSTALL
SOURCES ${arg_SOURCES}
INCLUDE_DIRECTORIES
Expand Down Expand Up @@ -178,7 +164,7 @@ function(qt_internal_add_tool target_name)

if(TARGET host_tools)
add_dependencies(host_tools "${target_name}")
if(bootstrap OR no_qt)
if(bootstrap)
add_dependencies(bootstrap_tools "${target_name}")
endif()
endif()
Expand Down
215 changes: 25 additions & 190 deletions qmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,131 +4,27 @@
## qmake Tool:
#####################################################################

# TODO: Probably it's time to introduce QT_FEATURE_qmake?
if(NOT (QT_FEATURE_settings AND QT_FEATURE_alloca AND (QT_FEATURE_alloca_malloc_h OR NOT WIN32) AND
QT_FEATURE_cborstreamwriter AND QT_FEATURE_datestring AND QT_FEATURE_regularexpression AND
QT_FEATURE_temporaryfile))
message(WARNING "Skip building qmake in specified configuration.\
Required features:
QT_FEATURE_settings ${QT_FEATURE_settings}
QT_FEATURE_alloca ${QT_FEATURE_alloca}
QT_FEATURE_cborstreamwriter ${QT_FEATURE_cborstreamwriter}
QT_FEATURE_datestring ${QT_FEATURE_datestring}
QT_FEATURE_getauxval ${QT_FEATURE_getauxval}
QT_FEATURE_regularexpression ${QT_FEATURE_regularexpression}
QT_FEATURE_temporaryfile ${QT_FEATURE_temporaryfile}
")
return()
endif()

qt_get_tool_target_name(target_name qmake)
qt_internal_add_tool(${target_name}
NO_QT # special case
TOOLS_TARGET Core # special case
# GUI # special case: remove this
SOURCES
../src/3rdparty/pcre2/src/config.h
../src/3rdparty/pcre2/src/pcre2.h
../src/3rdparty/pcre2/src/pcre2_auto_possess.c
../src/3rdparty/pcre2/src/pcre2_chartables.c
../src/3rdparty/pcre2/src/pcre2_compile.c
../src/3rdparty/pcre2/src/pcre2_config.c
../src/3rdparty/pcre2/src/pcre2_context.c
../src/3rdparty/pcre2/src/pcre2_dfa_match.c
../src/3rdparty/pcre2/src/pcre2_error.c
../src/3rdparty/pcre2/src/pcre2_extuni.c
../src/3rdparty/pcre2/src/pcre2_find_bracket.c
../src/3rdparty/pcre2/src/pcre2_internal.h
../src/3rdparty/pcre2/src/pcre2_intmodedep.h
../src/3rdparty/pcre2/src/pcre2_jit_compile.c
../src/3rdparty/pcre2/src/pcre2_maketables.c
../src/3rdparty/pcre2/src/pcre2_match.c
../src/3rdparty/pcre2/src/pcre2_match_data.c
../src/3rdparty/pcre2/src/pcre2_newline.c
../src/3rdparty/pcre2/src/pcre2_ord2utf.c
../src/3rdparty/pcre2/src/pcre2_pattern_info.c
../src/3rdparty/pcre2/src/pcre2_script_run.c
../src/3rdparty/pcre2/src/pcre2_serialize.c
../src/3rdparty/pcre2/src/pcre2_string_utils.c
../src/3rdparty/pcre2/src/pcre2_study.c
../src/3rdparty/pcre2/src/pcre2_substitute.c
../src/3rdparty/pcre2/src/pcre2_substring.c
../src/3rdparty/pcre2/src/pcre2_tables.c
../src/3rdparty/pcre2/src/pcre2_ucd.c
../src/3rdparty/pcre2/src/pcre2_ucp.h
../src/3rdparty/pcre2/src/pcre2_valid_utf.c
../src/3rdparty/pcre2/src/pcre2_xclass.c
../src/corelib/global/qcontainerinfo.h
../src/corelib/global/qendian.cpp # special case
../src/corelib/global/qglobal.cpp ../src/corelib/global/qglobal.h
../src/corelib/global/qlibraryinfo.cpp
../src/corelib/global/qlogging.cpp
../src/corelib/global/qmalloc.cpp
../src/corelib/global/qnumeric.cpp ../src/corelib/global/qnumeric.h
../src/corelib/global/qoperatingsystemversion.cpp # special case
../src/corelib/global/qrandom.cpp # special case
../src/corelib/io/qabstractfileengine.cpp ../src/corelib/io/qabstractfileengine_p.h
../src/corelib/io/qbuffer.cpp ../src/corelib/io/qbuffer.h
../src/corelib/io/qdebug.cpp # special case
../src/corelib/io/qdir.cpp ../src/corelib/io/qdir.h ../src/corelib/io/qdir_p.h
../src/corelib/io/qdiriterator.cpp ../src/corelib/io/qdiriterator.h
../src/corelib/io/qfile.cpp ../src/corelib/io/qfile.h
../src/corelib/io/qfiledevice.cpp
../src/corelib/io/qfileinfo.cpp ../src/corelib/io/qfileinfo.h
../src/corelib/io/qfilesystemengine.cpp
../src/corelib/io/qfilesystementry.cpp
../src/corelib/io/qfsfileengine.cpp
../src/corelib/io/qfsfileengine_iterator.cpp
../src/corelib/io/qiodevicebase.h
../src/corelib/io/qiodevice.cpp ../src/corelib/io/qiodevice.h
../src/corelib/io/qsettings.cpp
../src/corelib/io/qtemporaryfile.cpp ../src/corelib/io/qtemporaryfile.h
../src/corelib/kernel/qiterable.cpp ../src/corelib/kernel/qiterable.h
../src/corelib/kernel/qmetacontainer.cpp ../src/corelib/kernel/qmetacontainer.h
../src/corelib/kernel/qmetatype.cpp ../src/corelib/kernel/qmetatype.h
../src/corelib/kernel/qsystemerror.cpp ../src/corelib/kernel/qsystemerror_p.h
../src/corelib/kernel/qvariant.cpp
../src/corelib/plugin/quuid.cpp ../src/corelib/plugin/quuid.h
../src/corelib/serialization/qcborstreamwriter.cpp ../src/corelib/serialization/qcborstreamwriter.h
../src/corelib/serialization/qcborvalue.cpp ../src/corelib/serialization/qcborvalue.h ../src/corelib/serialization/qcborvalue_p.h
../src/corelib/serialization/qdatastream.cpp ../src/corelib/serialization/qdatastream.h
../src/corelib/serialization/qjson_p.h
../src/corelib/serialization/qjsonarray.cpp ../src/corelib/serialization/qjsonarray.h
../src/corelib/serialization/qjsoncbor.cpp
../src/corelib/serialization/qjsondocument.cpp ../src/corelib/serialization/qjsondocument.h
../src/corelib/serialization/qjsonobject.cpp ../src/corelib/serialization/qjsonobject.h
../src/corelib/serialization/qjsonparser.cpp ../src/corelib/serialization/qjsonparser_p.h
../src/corelib/serialization/qjsonvalue.cpp ../src/corelib/serialization/qjsonvalue.h
../src/corelib/serialization/qjsonwriter_p.h
../src/corelib/serialization/qtextstream.cpp ../src/corelib/serialization/qtextstream.h
../src/corelib/text/qbytearray.cpp ../src/corelib/text/qbytearray.h
../src/corelib/text/qbytearraylist.cpp ../src/corelib/text/qbytearraylist.h # special case
../src/corelib/text/qbytearraymatcher.cpp ../src/corelib/text/qbytearraymatcher.h
../src/corelib/text/qchar.h
../src/corelib/text/qlocale.cpp ../src/corelib/text/qlocale.h
../src/corelib/text/qlocale_tools.cpp ../src/corelib/text/qlocale_tools_p.h
../src/corelib/text/qregularexpression.cpp ../src/corelib/text/qregularexpression.h
../src/corelib/text/qstring.cpp ../src/corelib/text/qstring.h
../src/corelib/text/qstringbuilder.cpp ../src/corelib/text/qstringbuilder.h
../src/corelib/text/qstringconverter.cpp ../src/corelib/text/qstringconverter.h ../src/corelib/text/qstringconverter_p.h
../src/corelib/text/qstringlist.cpp ../src/corelib/text/qstringlist.h
../src/corelib/text/qstringmatcher.h
../src/corelib/text/qvsnprintf.cpp
../src/corelib/time/qcalendar.cpp ../src/corelib/time/qcalendar.h
../src/corelib/time/qcalendarbackend_p.h
../src/corelib/time/qcalendarmath_p.h
../src/corelib/time/qdatetime.cpp ../src/corelib/time/qdatetime.h ../src/corelib/time/qdatetime_p.h
../src/corelib/time/qgregoriancalendar.cpp ../src/corelib/time/qgregoriancalendar_p.h
../src/corelib/time/qromancalendar.cpp ../src/corelib/time/qromancalendar_p.h
../src/corelib/tools/qarraydata.cpp ../src/corelib/tools/qarraydata.h
../src/corelib/tools/qarraydataops.h
../src/corelib/tools/qarraydatapointer.h
../src/corelib/tools/qbitarray.cpp ../src/corelib/tools/qbitarray.h
../src/corelib/tools/qcryptographichash.cpp ../src/corelib/tools/qcryptographichash.h
../src/corelib/time/qcalendar.cpp ../src/corelib/time/qcalendar.h # special case
../src/corelib/time/qcalendarbackend_p.h ../src/corelib/time/qcalendarmath_p.h # special case
../src/corelib/time/qgregoriancalendar.cpp ../src/corelib/time/qgregoriancalendar_p.h # special case
../src/corelib/time/qromancalendar.cpp ../src/corelib/time/qromancalendar_p.h # special case
../src/corelib/time/qdatetime.cpp ../src/corelib/time/qdatetime.h ../src/corelib/time/qdatetime_p.h # special case
../src/corelib/tools/qduplicatetracker_p.h
../src/corelib/tools/qhash.cpp ../src/corelib/tools/qhash.h
../src/corelib/tools/qlist.h
../src/corelib/tools/qmap.h
../src/corelib/text/qlocale.cpp ../src/corelib/text/qlocale.h
../src/corelib/text/qlocale_tools.cpp ../src/corelib/text/qlocale_tools_p.h
../src/corelib/text/qregularexpression.cpp ../src/corelib/text/qregularexpression.h
../src/corelib/tools/qringbuffer.cpp # special case
../src/corelib/text/qstring.cpp ../src/corelib/text/qstring.h
../src/corelib/text/qstringbuilder.cpp ../src/corelib/text/qstringbuilder.h
../src/corelib/text/qstringconverter.cpp ../src/corelib/text/qstringconverter.h ../src/corelib/text/qstringconverter_p.h
../src/corelib/text/qstringlist.cpp ../src/corelib/text/qstringlist.h
../src/corelib/text/qstringmatcher.h
../src/corelib/tools/qvector.h
../src/corelib/tools/qversionnumber.cpp ../src/corelib/tools/qversionnumber.h
../src/corelib/text/qvsnprintf.cpp
cachekeys.h
generators/mac/pbuilder_pbx.cpp generators/mac/pbuilder_pbx.h
generators/makefile.cpp generators/makefile.h
Expand All @@ -153,112 +49,54 @@ qt_internal_add_tool(${target_name}
library/qmakeglobals.cpp library/qmakeglobals.h
library/qmakeparser.cpp library/qmakeparser.h
library/qmakevfs.cpp library/qmakevfs.h
qmakelibraryinfo.cpp qmakelibraryinfo.h
main.cpp
meta.cpp meta.h
option.cpp option.h
project.cpp project.h
property.cpp property.h
DEFINES
HAVE_CONFIG_H
PCRE2_DISABLE_JIT
PROEVALUATOR_FULL
QT_BOOTSTRAPPED
QT_BUILD_QMAKE
QT_USE_QSTRINGBUILDER
QT_NO_FOREACH
QT_VERSION_STR="${PROJECT_VERSION}" # special case
QT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} # special case
QT_VERSION_MINOR=${PROJECT_VERSION_MINOR} # special case
QT_VERSION_PATCH=${PROJECT_VERSION_PATCH} # special case
PCRE2_CODE_UNIT_WIDTH=16
PCRE2_DISABLE_JIT
HAVE_CONFIG_H
INCLUDE_DIRECTORIES
# . # special case remove
generators
generators/mac
generators/unix
generators/win32
library
$<TARGET_PROPERTY:Qt::Core,INCLUDE_DIRECTORIES> # special case
"${PROJECT_BINARY_DIR}/src/corelib/global" # special case: for qconfig.cpp
"${CMAKE_CURRENT_BINARY_DIR}/library" # for qmakeconfig.cpp
PRECOMPILED_HEADER
"qmake_pch.h"
LIBRARIES
Qt::CorePrivate
)

qt_generate_qconfig_cpp(../src/corelib/global/qconfig.cpp.in library/qmakeconfig.cpp)

#### Keys ignored in scope 1:.:.:qmake.pro:<TRUE>:
# _OPTION = "host_build"

## Scopes:
#####################################################################

qt_internal_extend_target(${target_name} CONDITION WIN32
SOURCES
../src/corelib/global/qoperatingsystemversion_win.cpp
../src/corelib/io/qfilesystemengine_win.cpp
../src/corelib/io/qfilesystemiterator_win.cpp
../src/corelib/io/qfsfileengine_win.cpp
../src/corelib/io/qsettings_win.cpp
../src/corelib/plugin/qsystemlibrary.cpp
../src/corelib/text/qlocale_win.cpp
library/registry.cpp
DEFINES
UNICODE
_CRT_SECURE_NO_WARNINGS
_ENABLE_EXTENDED_ALIGNED_STORAGE
_SCL_SECURE_NO_WARNINGS
PUBLIC_DEFINES
PCRE2_STATIC
PUBLIC_LIBRARIES
advapi32
kernel32
netapi32
ole32
)

qt_internal_extend_target(${target_name} CONDITION UNIX
SOURCES
../src/corelib/io/qfilesystemengine_unix.cpp
../src/corelib/io/qfilesystemiterator_unix.cpp
../src/corelib/io/qfsfileengine_unix.cpp
../src/corelib/kernel/qcore_unix.cpp
../src/corelib/text/qlocale_unix.cpp
)

qt_internal_extend_target(${target_name} CONDITION MACOS
SOURCES
../src/corelib/kernel/qcore_foundation.mm # special case
../src/corelib/kernel/qcore_mac.mm # special case
../src/corelib/global/qoperatingsystemversion_darwin.mm # special case
../src/corelib/io/qsettings_mac.cpp # special case
PUBLIC_LIBRARIES
${FWApplicationServices}
${FWCoreServices}
${FWFoundation}
COMPILE_OPTIONS
"-fconstant-cfstrings"
)

# special case big
qt_internal_extend_target(qmake CONDITION WIN32
qt_internal_extend_target(${target_name} CONDITION WIN32
SOURCES
../src/corelib/io/qfilesystemengine_win.cpp
../src/corelib/io/qfilesystemiterator_win.cpp
../src/corelib/io/qfsfileengine_win.cpp
../src/corelib/text/qlocale_win.cpp
../src/corelib/io/qsettings_win.cpp
# ../src/corelib/global/qoperatingsystemversion.cpp special case: remove this
../src/corelib/plugin/qsystemlibrary.cpp
library/registry.cpp
DEFINES
UNICODE _ENABLE_EXTENDED_ALIGNED_STORAGE _CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS
LIBRARIES
ole32 advapi32 kernel32 netapi32
)

qt_internal_extend_target(${target_name} CONDITION MINGW AND WIN32
PUBLIC_LIBRARIES
uuid
_SCL_SECURE_NO_WARNINGS
)

qt_internal_extend_target(${target_name} CONDITION CLANG AND WIN32
Expand All @@ -275,10 +113,7 @@ set_target_properties(${target_name} PROPERTIES
)

qt_internal_apply_gc_binaries(${target_name} PRIVATE) # special case

qt_set_msvc_cplusplus_options(${target_name} PUBLIC) # special case
qt_skip_warnings_are_errors(${target_name}) # special case
qt_internal_apply_intel_cet(Bootstrap PUBLIC) # special case

# special case begin
qt_internal_add_docs(${target_name}
Expand Down
Loading

0 comments on commit 43c28aa

Please sign in to comment.