Fix Windows build

- Fix qmake build
- Fix QtNetwork moc-ing, by including the moc files
  inside the cpp files
- Fix sql odbc plugin by including QT_PLUGIN define
- Fix Boostrap to link against the Platform target, to get the
  correct Unicode and WIN64 defines.
- Fix vulkan headers to be found
- Fix freetype bzip and png unresolved symbols / linker issues
  when building minimal platform plugin (also need to make
  sure to use the vcpkg toolchain instead of CMAKE_PREFIX_PATH
  because then find_package is overridden, which does magic
  to properly propagate static library dependencies).
- Fix qfilesystementry test not to be built without private
  tests feature (it led to undefined symbols issues).
- Make sure to remove QT_NO_CAST_TO_ASCII define when building
  QtCore, so that the qstringbuilder3 test builds
  successfully.

Task-number: QTBUG-74140
Change-Id: I353d08392b604d55f8e62cdd8696d1e19a3c084a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2019-03-11 12:34:52 +01:00
parent 4f1a155909
commit 3f03917b54
12 changed files with 105 additions and 55 deletions

View File

@ -707,6 +707,7 @@ function(add_qt_plugin target)
QT_BUILDING_QT
QT_BUILD_${module_upper}_LIB ### FIXME: use QT_BUILD_ADDON for Add-ons or remove if we don't have add-ons anymore
"${deprecation_define}"
QT_PLUGIN
PUBLIC_DEFINES
QT_${module_upper}_LIB
${arg_PUBLIC_DEFINES}
@ -722,6 +723,10 @@ function(add_qt_plugin target)
MOC_OPTIONS ${arg_MOC_OPTIONS}
)
if(NOT ${QT_BUILD_SHARED_LIBS})
extend_target("${target}" DEFINES QT_STATICPLUGIN)
endif()
install(TARGETS "${target}" EXPORT "${target}Targets"
LIBRARY DESTINATION ${INSTALL_PLUGINSDIR}/${arg_TYPE}
ARCHIVE DESTINATION ${INSTALL_LIBDIR}/${arg_TYPE}

View File

@ -134,6 +134,21 @@ extend_target(qmake CONDITION APPLE_OSX
${FWApplicationServices} ${FWCoreServices} ${FWFoundation}
)
# TODO: Windows support, cf. qmake.pro
extend_target(qmake CONDITION WIN32
SOURCES
${PROJECT_SOURCE_DIR}/src/corelib/io/qfilesystemengine_win.cpp
${PROJECT_SOURCE_DIR}/src/corelib/io/qfilesystemiterator_win.cpp
${PROJECT_SOURCE_DIR}/src/corelib/io/qfsfileengine_win.cpp
${PROJECT_SOURCE_DIR}/src/corelib/tools/qlocale_win.cpp
${PROJECT_SOURCE_DIR}/src/corelib/global/qoperatingsystemversion_win.cpp
${PROJECT_SOURCE_DIR}/src/corelib/io/qsettings_win.cpp
${PROJECT_SOURCE_DIR}/src/corelib/plugin/qsystemlibrary.cpp
generators/win32/registry.cpp
DEFINES
UNICODE _ENABLE_EXTENDED_ALIGNED_STORAGE _CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS
LIBRARIES
ole32 advapi32 kernel32 netapi32
)
set_target_properties(qmake PROPERTIES
AUTOMOC OFF

View File

@ -560,8 +560,6 @@ extend_target(Core CONDITION UNIX
kernel/qpoll_p.h
kernel/qtimerinfo_unix.cpp kernel/qtimerinfo_unix_p.h
thread/qthread_unix.cpp
DEFINES
QT_NO_CAST_TO_ASCII # special case: Add that here instead of removing it in WIN32!
)
extend_target(Core CONDITION QT_FEATURE_thread
@ -1000,6 +998,14 @@ set_source_files_properties(
thread/qmutex_win.cpp
PROPERTIES HEADER_FILE_ONLY ON) # special case: These files are included by qmutex.cpp!
# special case
# Remove QT_NO_CAST_TO_ASCII to ensure that the symbols are included in the library.
if(WIN32)
get_target_property(defines Core COMPILE_DEFINITIONS)
list(REMOVE_ITEM defines QT_NO_CAST_TO_ASCII)
set_target_properties(Core PROPERTIES COMPILE_DEFINITIONS "${defines}")
endif()
qt_internal_add_link_flags_gc_sections(Core PRIVATE) # special case
qt_create_tracepoints(Core ./qtcore.tracepoints)

View File

@ -379,4 +379,10 @@ extend_target(Network CONDITION QT_FEATURE_openssl AND QT_FEATURE_ssl AND WIN32
crypt32
)
# Special case, from mkspecs/common/msvc-desktop.conf
extend_target(Network CONDITION WIN32
LIBRARIES
ws2_32
)
add_qt_docs(./doc/qtnetwork.qdocconf)

View File

@ -866,3 +866,5 @@ QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(qintptr, QOb
QT_END_NAMESPACE
#endif // !QT_NO_NETWORKPROXY
#include "moc_qhttpsocketengine_p.cpp"

View File

@ -1382,3 +1382,5 @@ void QNativeSocketEngine::setExceptionNotificationEnabled(bool enable)
}
QT_END_NAMESPACE
#include "moc_qnativesocketengine_p.cpp"

View File

@ -1937,3 +1937,5 @@ QAbstractSocketEngine *QSocks5SocketEngineHandler::createSocketEngine(qintptr so
}
QT_END_NAMESPACE
#include "moc_qsocks5socketengine_p.cpp"

View File

@ -1,30 +1,26 @@
# Generated from fontdatabases.pro.
#####################################################################
## QtFontDatabaseSupport Module:
## FontDatabaseSupport Module:
#####################################################################
find_package(Freetype)
find_library(FWCoreGraphics CoreGraphics)
find_library(FWCoreFoundation CoreFoundation)
find_library(FWCoreText CoreText)
find_library(FWFoundation Foundation)
find_library(FWAppKit AppKit)
find_package(Freetype) # Special case
add_qt_module(FontDatabaseSupport
STATIC
SOURCES fake.cpp
DEFINES
QT_NO_CAST_FROM_ASCII
LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
# CONFIG = "static" "internal_module"
# MODULE = "fontdatabase_support"
# PRECOMPILED_HEADER = "../../corelib/global/qt_pch.h"
# _LOADED = "qt_module"
)
set_source_files_properties(fake.cpp PROPERTIES
SKIP_AUTOMOC ON
SKIP_AUTOUIC ON
SKIP_AUTORCC ON
)
## Scopes:
#####################################################################
extend_target(FontDatabaseSupport CONDITION APPLE
SOURCES
@ -35,7 +31,9 @@ extend_target(FontDatabaseSupport CONDITION APPLE
${FWCoreGraphics}
${FWCoreText}
${FWFoundation}
${FWAppKit}
${FWAppKit} # Special case
# CONFIG = "watchos_coretext"
)
extend_target(FontDatabaseSupport CONDITION APPLE AND QT_FEATURE_freetype
@ -58,7 +56,7 @@ extend_target(FontDatabaseSupport CONDITION UNIX
genericunix/qgenericunixfontdatabase_p.h
)
extend_target(FontDatabaseSupport CONDITION UNIX AND QT_FEATURE_fontconfig
extend_target(FontDatabaseSupport CONDITION QT_FEATURE_fontconfig AND UNIX
SOURCES
fontconfig/qfontconfigdatabase.cpp fontconfig/qfontconfigdatabase_p.h
fontconfig/qfontenginemultifontconfig.cpp fontconfig/qfontenginemultifontconfig_p.h
@ -66,46 +64,51 @@ extend_target(FontDatabaseSupport CONDITION UNIX AND QT_FEATURE_fontconfig
fontconfig
)
#extend_target(FontDatabaseSupport CONDITION WIN32
#)
extend_target(FontDatabaseSupport CONDITION WIN32 AND NOT WINRT
SOURCES
windows/qwindowsfontdatabase.cpp windows/qwindowsfontdatabase_p.h
windows/qwindowsfontengine.cpp windows/qwindowsfontengine_p.h
windows/qwindowsnativeimage.cpp windows/qwindowsnativeimage_p.h
LIBRARIES
Qt::GuiPrivate
ole32
gdi32
user32
advapi32
)
#extend_target(FontDatabaseSupport CONDITION (WIN32) AND (NOT WINRT)
# SOURCES
# qwindowsfontdatabase.cpp qwindowsfontdatabase_p.h
# qwindowsfontengine.cpp qwindowsfontengine_p.h
# qwindowsnativeimage.cpp qwindowsnativeimage_p.h
# LIBRARIES
# Qt::GuiPrivate
#)
extend_target(FontDatabaseSupport CONDITION QT_FEATURE_freetype AND WIN32 AND NOT WINRT
SOURCES
windows/qwindowsfontdatabase_ft.cpp windows/qwindowsfontdatabase_ft_p.h
)
#extend_target(FontDatabaseSupport CONDITION ((WIN32) AND (NOT WINRT)) AND (QT_FEATURE_freetype)
# SOURCES
# qwindowsfontdatabase_ft.cpp qwindowsfontdatabase_ft_p.h
#)
extend_target(FontDatabaseSupport CONDITION QT_FEATURE_directwrite AND WIN32 AND NOT WINRT
SOURCES
windows/qwindowsfontenginedirectwrite.cpp windows/qwindowsfontenginedirectwrite_p.h
)
#extend_target(FontDatabaseSupport CONDITION ((WIN32) AND (NOT WINRT)) AND (QT_FEATURE_directwrite)
# SOURCES
# qwindowsfontenginedirectwrite.cpp qwindowsfontenginedirectwrite_p.h
#)
extend_target(FontDatabaseSupport CONDITION QT_FEATURE_directwrite AND QT_FEATURE_directwrite2 AND WIN32 AND NOT WINRT
DEFINES
QT_USE_DIRECTWRITE2
)
#extend_target(FontDatabaseSupport CONDITION (((WIN32) AND (NOT WINRT)) AND (QT_FEATURE_directwrite)) AND (QT_FEATURE_directwrite2)
# DEFINES
# QT_USE_DIRECTWRITE2
#)
extend_target(FontDatabaseSupport CONDITION WIN32 AND NOT QT_FEATURE_directwrite AND NOT WINRT
DEFINES
QT_NO_DIRECTWRITE
)
#extend_target(FontDatabaseSupport CONDITION ((WIN32) AND (NOT WINRT)) AND (NOT QT_FEATURE_directwrite)
# DEFINES
# QT_NO_DIRECTWRITE
#)
##
##extend_target(FontDatabaseSupport CONDITION ((WIN32) AND (NOT WINRT)) AND (mingw)
##)
extend_target(FontDatabaseSupport CONDITION WIN32 AND mingw AND NOT WINRT
LIBRARIES
uuid
)
#extend_target(FontDatabaseSupport CONDITION WINRT
# SOURCES
# qwinrtfontdatabase.cpp qwinrtfontdatabase_p.h
# DEFINES
# __WRL_NO_DEFAULT_LIB__
# LIBRARIES
# Qt::GuiPrivate
#)
extend_target(FontDatabaseSupport CONDITION WINRT
SOURCES
winrt/qwinrtfontdatabase.cpp winrt/qwinrtfontdatabase_p.h
DEFINES
__WRL_NO_DEFAULT_LIB__
LIBRARIES
Qt::GuiPrivate
ws2_32
dwrite
)

View File

@ -4,6 +4,9 @@
## VulkanSupport Module:
#####################################################################
# Special case.
find_package(Vulkan)
add_qt_module(VulkanSupport
STATIC
SOURCES
@ -13,4 +16,5 @@ add_qt_module(VulkanSupport
LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
Vulkan::Vulkan
)

View File

@ -2649,3 +2649,5 @@ bool QODBCDriver::isIdentifierEscaped(const QString &identifier, IdentifierType)
}
QT_END_NAMESPACE
#include "moc_qsql_odbc_p.cpp"

View File

@ -97,6 +97,7 @@ extend_target(Bootstrap
$<TARGET_PROPERTY:XmlPrivate,INTERFACE_INCLUDE_DIRECTORIES>
PUBLIC_LIBRARIES # special case
ZLIB::ZLIB
Qt::Platform
# CONFIG = "minimal_syncqt" "internal_module" "force_bootstrap" "gc_binaries"
# INSTALLS = "lib"
# MODULE_CONFIG = "gc_binaries"

View File

@ -1,7 +1,9 @@
add_subdirectory(largefile)
add_subdirectory(qbuffer)
add_subdirectory(qdataurl)
if(QT_FEATURE_private_tests)
add_subdirectory(qfilesystementry)
endif()
add_subdirectory(qfilesystemwatcher)
add_subdirectory(qipaddress)
# add_subdirectory(qloggingcategory)