summaryrefslogtreecommitdiffstats
path: root/src/entrypoint/entrypoint_implementation.pro
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-11-03 17:00:11 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-11-09 18:08:06 +0100
commitff170962d460aafea93373f8c2391716d199adb9 (patch)
tree7e2a1fcb81afcd2af359fec56621c2690999c3b4 /src/entrypoint/entrypoint_implementation.pro
parentc2e1a773e060ae34089f805eaab87394c5903a9e (diff)
Don't rely on the module.pri for the entrypoint linking to the library
Depending on the presence and behavior of HEADER_MODULE/header_module in CMake and qmake land, the module.pri might end up with an empty module line, which means adding the module via QT_PRIVATE += entrypoint will not link to the static library. To avoid this problem we write an explicit module entry (QT.foo.bar) into the same module.pri file as the one generated by qt_module, where the auto-generated one has header_module enabled, and hence no link behavior, while the manually written entry has a module component, and will ensure linkage to the static library. Change-Id: Ib98484f74410fab45c4d109f3610028200fba0c5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/entrypoint/entrypoint_implementation.pro')
-rw-r--r--src/entrypoint/entrypoint_implementation.pro61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/entrypoint/entrypoint_implementation.pro b/src/entrypoint/entrypoint_implementation.pro
new file mode 100644
index 0000000000..900e143336
--- /dev/null
+++ b/src/entrypoint/entrypoint_implementation.pro
@@ -0,0 +1,61 @@
+
+TEMPLATE = lib
+
+TARGET = QtEntryPoint
+
+CONFIG += static no_module_headers internal_module
+QT = core
+
+DEFINES += QT_NO_FOREACH
+
+win32 {
+ SOURCES = qtentrypoint_win.cpp
+ CONFIG -= qt
+
+ QMAKE_USE_PRIVATE += shell32
+
+ msvc {
+ QMAKE_CFLAGS_DEBUG -= -Zi
+ QMAKE_CXXFLAGS_DEBUG -= -Zi
+ QMAKE_CFLAGS_DEBUG *= -Z7
+ QMAKE_CXXFLAGS_DEBUG *= -Z7
+ }
+ mingw {
+ DEFINES += QT_NEEDS_QMAIN
+ MODULE_DEFINES += QT_NEEDS_QMAIN
+
+ # This library needs to come before the entry-point library in the
+ # linker line, so that the static linker will pick up the WinMain
+ # symbol from the entry-point library.
+ MODULE_LDFLAGS += -lmingw32
+ }
+}
+
+# Minimal qt_helper_lib
+
+load(qt_build_paths)
+load(qt_common)
+
+!build_pass {
+ MODULE_PRI_CONTENT = \
+ "QT.entrypoint_implementation.name = QtEntryPointImplementation" \
+ "QT.entrypoint_implementation.module = Qt6EntryPoint" \
+ "QT.entrypoint_implementation.ldflags = $$MODULE_LDFLAGS" \
+ "QT.entrypoint_implementation.libs = \$\$QT_MODULE_LIB_BASE" \
+ "QT.entrypoint_implementation.DEFINES = $$MODULE_DEFINES" \
+ "QT.entrypoint_implementation.module_config = staticlib v2 internal_module"
+
+ module_path = $$MODULE_QMAKE_OUTDIR/mkspecs/modules
+ force_independent|split_incpath: module_path = "$${module_path}-inst"
+ MODULE_PRI = $$module_path/qt_lib_entrypoint_private.pri
+ write_file($$MODULE_PRI, MODULE_PRI_CONTENT, append)|error()
+}
+
+qtConfig(debug_and_release): CONFIG += debug_and_release
+qtConfig(build_all): CONFIG += build_all
+
+DESTDIR = $$MODULE_BASE_OUTDIR/lib
+
+TARGET = $$qt5LibraryTarget($$TARGET)
+
+load(qt_installs)