summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-09-23 17:13:24 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2019-10-10 07:40:49 +0000
commit73ed687cf11cb2d4e7f263ef5754039b96b69aaa (patch)
treec01dcb59c5c6b32d8c4f5ce0bd667b39a5cf323f /src
parentc84f4c258ef91c76e19198d7eeb64291d0171938 (diff)
downloadqbs-73ed687cf11cb2d4e7f263ef5754039b96b69aaa.tar.gz
Fix static build
Make sure we link in the generator plugins. Fixes: QBS-1491 Change-Id: I8c48a73f972c4089cfc8c097a67e2945837e9ed4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/app/qbs/qbs.pro15
-rw-r--r--src/app/qbs/qbs.qbs4
-rw-r--r--src/lib/corelib/corelib.pro9
-rw-r--r--src/lib/corelib/corelib.qbs1
-rw-r--r--src/lib/corelib/tools/qbspluginmanager.h2
-rw-r--r--src/plugins/generator/clangcompilationdb/clangcompilationdb.pri1
-rw-r--r--src/plugins/generator/clangcompilationdb/clangcompilationdb.pro3
-rw-r--r--src/plugins/generator/clangcompilationdb/clangcompilationdbgeneratorplugin.cpp2
-rw-r--r--src/plugins/generator/iarew/iarew.pri1
-rw-r--r--src/plugins/generator/iarew/iarew.pro3
-rw-r--r--src/plugins/generator/iarew/iarewgeneratorplugin.cpp2
-rw-r--r--src/plugins/generator/keiluv/keiluv.pri1
-rw-r--r--src/plugins/generator/keiluv/keiluv.pro3
-rw-r--r--src/plugins/generator/keiluv/keiluvgeneratorplugin.cpp2
-rw-r--r--src/plugins/generator/makefilegenerator/makefilegenerator.pri1
-rw-r--r--src/plugins/generator/makefilegenerator/makefilegenerator.pro3
-rw-r--r--src/plugins/generator/makefilegenerator/makefilegeneratorplugin.cpp2
-rw-r--r--src/plugins/generator/visualstudio/visualstudio.pri1
-rw-r--r--src/plugins/generator/visualstudio/visualstudio.pro3
-rw-r--r--src/plugins/generator/visualstudio/visualstudiogeneratorplugin.cpp2
-rw-r--r--src/plugins/plugins.pri13
-rw-r--r--src/plugins/qbs_plugin_common.pri9
-rw-r--r--src/plugins/qbsplugin.qbs16
-rw-r--r--src/plugins/scanner/cpp/cpp.pri1
-rw-r--r--src/plugins/scanner/cpp/cpp.pro3
-rw-r--r--src/plugins/scanner/cpp/cppscanner.cpp2
-rw-r--r--src/plugins/scanner/qt/qt.pri1
-rw-r--r--src/plugins/scanner/qt/qt.pro3
-rw-r--r--src/plugins/scanner/qt/qtscanner.cpp2
-rw-r--r--src/plugins/use_plugin.pri10
30 files changed, 80 insertions, 41 deletions
diff --git a/src/app/qbs/qbs.pro b/src/app/qbs/qbs.pro
index e9f0061c6..6ce449aad 100644
--- a/src/app/qbs/qbs.pro
+++ b/src/app/qbs/qbs.pro
@@ -37,3 +37,18 @@ isEmpty(QBS_RELATIVE_SEARCH_PATH):QBS_RELATIVE_SEARCH_PATH=..
DEFINES += QBS_RELATIVE_LIBEXEC_PATH=\\\"$${QBS_RELATIVE_LIBEXEC_PATH}\\\"
DEFINES += QBS_RELATIVE_PLUGINS_PATH=\\\"$${QBS_RELATIVE_PLUGINS_PATH}\\\"
DEFINES += QBS_RELATIVE_SEARCH_PATH=\\\"$${QBS_RELATIVE_SEARCH_PATH}\\\"
+
+CONFIG(static, static|shared) {
+ include(../../plugins/qbs_plugin_common.pri)
+ LIBS += -L$$qbsPluginDestDir
+ scannerPlugins = cpp qt
+ for (scannerPlugin, scannerPlugins) {
+ include(../../plugins/scanner/$$scannerPlugin/$${scannerPlugin}.pri) \
+ include(../../plugins/use_plugin.pri)
+ }
+ generatorPlugins = clangcompilationdb iarew keiluv makefilegenerator visualstudio
+ for (generatorPlugin, generatorPlugins) {
+ include(../../plugins/generator/$$generatorPlugin/$${generatorPlugin}.pri) \
+ include(../../plugins/use_plugin.pri)
+ }
+}
diff --git a/src/app/qbs/qbs.qbs b/src/app/qbs/qbs.qbs
index 91357445e..530036f3a 100644
--- a/src/app/qbs/qbs.qbs
+++ b/src/app/qbs/qbs.qbs
@@ -5,6 +5,10 @@ QbsApp {
name: "qbs_app"
Depends { name: "qbs resources" }
targetName: "qbs"
+ Depends {
+ condition: Qt.core.staticBuild || qbsbuildconfig.staticBuild
+ productTypes: ["qbsplugin"]
+ }
cpp.defines: base.concat([
"QBS_VERSION=" + Utilities.cStringQuote(qbsversion.version),
"QBS_RELATIVE_LIBEXEC_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativeLibexecPath),
diff --git a/src/lib/corelib/corelib.pro b/src/lib/corelib/corelib.pro
index 9299ab953..002e36683 100644
--- a/src/lib/corelib/corelib.pro
+++ b/src/lib/corelib/corelib.pro
@@ -28,15 +28,6 @@ include(logging/logging.pri)
include(parser/parser.pri)
include(tools/tools.pri)
-CONFIG(static, static|shared) {
- !isEmpty(QBS_PLUGINS_BUILD_DIR) {
- destdirPrefix = $${QBS_PLUGINS_BUILD_DIR}
- } else {
- destdirPrefix = $$shadowed($$PWD)/../../../$${QBS_LIBRARY_DIRNAME}
- }
- LIBS += -L$${destdirPrefix}/qbs/plugins -lqbs_cpp_scanner -lqbs_qt_scanner
-}
-
win32:LIBS += -lpsapi -lshell32
HEADERS += \
diff --git a/src/lib/corelib/corelib.qbs b/src/lib/corelib/corelib.qbs
index 2f0ced926..019d9aa51 100644
--- a/src/lib/corelib/corelib.qbs
+++ b/src/lib/corelib/corelib.qbs
@@ -15,7 +15,6 @@ QbsLibrary {
condition: qbsbuildconfig.useBundledQtScript || !Qt.script.present
}
Depends { condition: qbsbuildconfig.enableProjectFileUpdates; name: "Qt.gui" }
- Depends { condition: staticBuild; productTypes: ["qbsplugin"] }
name: "qbscore"
property stringList bundledQtScriptIncludes: qbsbuildconfig.useBundledQtScript
|| !Qt.script.present ? qbsscriptengine.includePaths : []
diff --git a/src/lib/corelib/tools/qbspluginmanager.h b/src/lib/corelib/tools/qbspluginmanager.h
index 9c9dcc9f8..1113c413d 100644
--- a/src/lib/corelib/tools/qbspluginmanager.h
+++ b/src/lib/corelib/tools/qbspluginmanager.h
@@ -77,7 +77,7 @@ private:
#ifdef QBS_STATIC_LIB
#define QBS_REGISTER_STATIC_PLUGIN(exportmacro, name, load, unload) \
- static auto qbs_static_plugin_register##name = [] { \
+ extern "C" bool qbs_static_plugin_register_##name = [] { \
qbs::Internal::QbsPluginManager::instance()->registerStaticPlugin(load, unload); \
return true; \
}();
diff --git a/src/plugins/generator/clangcompilationdb/clangcompilationdb.pri b/src/plugins/generator/clangcompilationdb/clangcompilationdb.pri
new file mode 100644
index 000000000..7c9a71129
--- /dev/null
+++ b/src/plugins/generator/clangcompilationdb/clangcompilationdb.pri
@@ -0,0 +1 @@
+qbsPluginTarget = clangcompilationdbgenerator
diff --git a/src/plugins/generator/clangcompilationdb/clangcompilationdb.pro b/src/plugins/generator/clangcompilationdb/clangcompilationdb.pro
index 030051271..1b5342598 100644
--- a/src/plugins/generator/clangcompilationdb/clangcompilationdb.pro
+++ b/src/plugins/generator/clangcompilationdb/clangcompilationdb.pro
@@ -1,7 +1,6 @@
+include(clangcompilationdb.pri)
include(../../plugins.pri)
-TARGET = clangcompilationdbgenerator
-
QT = core
HEADERS += \
diff --git a/src/plugins/generator/clangcompilationdb/clangcompilationdbgeneratorplugin.cpp b/src/plugins/generator/clangcompilationdb/clangcompilationdbgeneratorplugin.cpp
index ab0e713aa..c6dec555f 100644
--- a/src/plugins/generator/clangcompilationdb/clangcompilationdbgeneratorplugin.cpp
+++ b/src/plugins/generator/clangcompilationdb/clangcompilationdbgeneratorplugin.cpp
@@ -60,5 +60,5 @@ static void QbsClangDbGeneratorPluginUnload()
#endif
#endif
-QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, QbsClangDbGeneratorPlugin,
+QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, clangcompilationdbgenerator,
QbsClangDbGeneratorPluginLoad, QbsClangDbGeneratorPluginUnload)
diff --git a/src/plugins/generator/iarew/iarew.pri b/src/plugins/generator/iarew/iarew.pri
new file mode 100644
index 000000000..68a3593fa
--- /dev/null
+++ b/src/plugins/generator/iarew/iarew.pri
@@ -0,0 +1 @@
+qbsPluginTarget = iarewgenerator
diff --git a/src/plugins/generator/iarew/iarew.pro b/src/plugins/generator/iarew/iarew.pro
index 7de474a45..074635047 100644
--- a/src/plugins/generator/iarew/iarew.pro
+++ b/src/plugins/generator/iarew/iarew.pro
@@ -1,8 +1,7 @@
+include(iarew.pri)
include(../../plugins.pri)
include(../../../shared/json/json.pri)
-TARGET = iarewgenerator
-
QT = core
# Plugin file.
diff --git a/src/plugins/generator/iarew/iarewgeneratorplugin.cpp b/src/plugins/generator/iarew/iarewgeneratorplugin.cpp
index 9f0798573..bd75c7ad5 100644
--- a/src/plugins/generator/iarew/iarewgeneratorplugin.cpp
+++ b/src/plugins/generator/iarew/iarewgeneratorplugin.cpp
@@ -63,5 +63,5 @@ static void QbsIarewGeneratorPluginUnload()
#endif
#endif
-QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, QbsIarewGeneratorPlugin,
+QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, iarewgenerator,
QbsIarewGeneratorPluginLoad, QbsIarewGeneratorPluginUnload)
diff --git a/src/plugins/generator/keiluv/keiluv.pri b/src/plugins/generator/keiluv/keiluv.pri
new file mode 100644
index 000000000..6995fb059
--- /dev/null
+++ b/src/plugins/generator/keiluv/keiluv.pri
@@ -0,0 +1 @@
+qbsPluginTarget = keiluvgenerator
diff --git a/src/plugins/generator/keiluv/keiluv.pro b/src/plugins/generator/keiluv/keiluv.pro
index ba3e4d27b..52d7c0ed4 100644
--- a/src/plugins/generator/keiluv/keiluv.pro
+++ b/src/plugins/generator/keiluv/keiluv.pro
@@ -1,8 +1,7 @@
+include(keiluv.pri)
include(../../plugins.pri)
include(../../../shared/json/json.pri)
-TARGET = keiluvgenerator
-
QT = core
# Plugin file.
diff --git a/src/plugins/generator/keiluv/keiluvgeneratorplugin.cpp b/src/plugins/generator/keiluv/keiluvgeneratorplugin.cpp
index 33e552936..91b73ef71 100644
--- a/src/plugins/generator/keiluv/keiluvgeneratorplugin.cpp
+++ b/src/plugins/generator/keiluv/keiluvgeneratorplugin.cpp
@@ -63,5 +63,5 @@ static void QbsKeiluvGeneratorPluginUnload()
#endif
#endif
-QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, QbsKeiluvGeneratorPlugin,
+QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, keiluvgenerator,
QbsKeiluvGeneratorPluginLoad, QbsKeiluvGeneratorPluginUnload)
diff --git a/src/plugins/generator/makefilegenerator/makefilegenerator.pri b/src/plugins/generator/makefilegenerator/makefilegenerator.pri
new file mode 100644
index 000000000..971e63d24
--- /dev/null
+++ b/src/plugins/generator/makefilegenerator/makefilegenerator.pri
@@ -0,0 +1 @@
+qbsPluginTarget = makefilegenerator
diff --git a/src/plugins/generator/makefilegenerator/makefilegenerator.pro b/src/plugins/generator/makefilegenerator/makefilegenerator.pro
index fae962fbb..c03191c39 100644
--- a/src/plugins/generator/makefilegenerator/makefilegenerator.pro
+++ b/src/plugins/generator/makefilegenerator/makefilegenerator.pro
@@ -1,7 +1,6 @@
+include(makefilegenerator.pri)
include(../../plugins.pri)
-TARGET = makefilegenerator
-
QT = core
HEADERS += \
diff --git a/src/plugins/generator/makefilegenerator/makefilegeneratorplugin.cpp b/src/plugins/generator/makefilegenerator/makefilegeneratorplugin.cpp
index 01b843a06..5789414bf 100644
--- a/src/plugins/generator/makefilegenerator/makefilegeneratorplugin.cpp
+++ b/src/plugins/generator/makefilegenerator/makefilegeneratorplugin.cpp
@@ -60,5 +60,5 @@ static void MakefileGeneratorPluginUnload()
#endif
#endif
-QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, MakefileGeneratorPlugin,
+QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, makefilegenerator,
MakefileGeneratorPluginLoad, MakefileGeneratorPluginUnload)
diff --git a/src/plugins/generator/visualstudio/visualstudio.pri b/src/plugins/generator/visualstudio/visualstudio.pri
new file mode 100644
index 000000000..13a48e85d
--- /dev/null
+++ b/src/plugins/generator/visualstudio/visualstudio.pri
@@ -0,0 +1 @@
+qbsPluginTarget = visualstudiogenerator
diff --git a/src/plugins/generator/visualstudio/visualstudio.pro b/src/plugins/generator/visualstudio/visualstudio.pro
index 196709bad..7d2398c8d 100644
--- a/src/plugins/generator/visualstudio/visualstudio.pro
+++ b/src/plugins/generator/visualstudio/visualstudio.pro
@@ -1,8 +1,7 @@
+include(visualstudio.pri)
include(../../plugins.pri)
include(../../../shared/json/json.pri)
-TARGET = visualstudiogenerator
-
QT = core
HEADERS += \
diff --git a/src/plugins/generator/visualstudio/visualstudiogeneratorplugin.cpp b/src/plugins/generator/visualstudio/visualstudiogeneratorplugin.cpp
index 9907c27f7..ef4e39fcb 100644
--- a/src/plugins/generator/visualstudio/visualstudiogeneratorplugin.cpp
+++ b/src/plugins/generator/visualstudio/visualstudiogeneratorplugin.cpp
@@ -63,5 +63,5 @@ static void QbsVisualStudioGeneratorPluginUnload()
#endif
#endif
-QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, QbsVisualStudioGeneratorPlugin,
+QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, visualstudiogenerator,
QbsVisualStudioGeneratorPluginLoad, QbsVisualStudioGeneratorPluginUnload)
diff --git a/src/plugins/plugins.pri b/src/plugins/plugins.pri
index 393f1d24d..43d7dcfac 100644
--- a/src/plugins/plugins.pri
+++ b/src/plugins/plugins.pri
@@ -1,12 +1,7 @@
-include(../library_dirname.pri)
-include(../install_prefix.pri)
+include(qbs_plugin_common.pri)
-!isEmpty(QBS_PLUGINS_BUILD_DIR) {
- destdirPrefix = $${QBS_PLUGINS_BUILD_DIR}
-} else {
- destdirPrefix = $$shadowed($$PWD)/../../$${QBS_LIBRARY_DIRNAME}
-}
-DESTDIR = $${destdirPrefix}/qbs/plugins
+TARGET = $$qbsPluginTarget
+DESTDIR = $$qbsPluginDestDir
isEmpty(QBSLIBDIR): QBSLIBDIR = $$OUT_PWD/../../../../$${QBS_LIBRARY_DIRNAME}
isEmpty(QBS_RPATH): QBS_RPATH = ../..
@@ -15,7 +10,7 @@ include($${PWD}/../lib/corelib/use_corelib.pri)
TEMPLATE = lib
CONFIG += c++14
-CONFIG += create_prl
+CONFIG(static, static|shared): CONFIG += create_prl
unix: CONFIG += plugin
!isEmpty(QBS_PLUGINS_INSTALL_DIR): \
diff --git a/src/plugins/qbs_plugin_common.pri b/src/plugins/qbs_plugin_common.pri
new file mode 100644
index 000000000..45ade4989
--- /dev/null
+++ b/src/plugins/qbs_plugin_common.pri
@@ -0,0 +1,9 @@
+include(../library_dirname.pri)
+include(../install_prefix.pri)
+
+!isEmpty(QBS_PLUGINS_BUILD_DIR) {
+ destdirPrefix = $${QBS_PLUGINS_BUILD_DIR}
+} else {
+ destdirPrefix = $$shadowed($$PWD)/../../$${QBS_LIBRARY_DIRNAME}
+}
+qbsPluginDestDir = $${destdirPrefix}/qbs/plugins
diff --git a/src/plugins/qbsplugin.qbs b/src/plugins/qbsplugin.qbs
index 0f31a8a78..b37fffe81 100644
--- a/src/plugins/qbsplugin.qbs
+++ b/src/plugins/qbsplugin.qbs
@@ -30,4 +30,20 @@ QbsProduct {
condition: isForDarwin
bundle.isBundle: false
}
+
+ Export {
+ Depends { name: "cpp" }
+ Properties {
+ condition: qbs.targetOS.contains("darwin")
+ cpp.linkerFlags: ["-u", "_qbs_static_plugin_register_" + name]
+ }
+ Properties {
+ condition: qbs.toolchain.contains("gcc")
+ cpp.linkerFlags: "--require-defined=qbs_static_plugin_register_" + name
+ }
+ Properties {
+ condition: qbs.toolchain.contains("msvc")
+ cpp.linkerFlags: "/INCLUDE:qbs_static_plugin_register_" + name
+ }
+ }
}
diff --git a/src/plugins/scanner/cpp/cpp.pri b/src/plugins/scanner/cpp/cpp.pri
new file mode 100644
index 000000000..515e65635
--- /dev/null
+++ b/src/plugins/scanner/cpp/cpp.pri
@@ -0,0 +1 @@
+qbsPluginTarget = qbs_cpp_scanner
diff --git a/src/plugins/scanner/cpp/cpp.pro b/src/plugins/scanner/cpp/cpp.pro
index cf8e6c347..12a6d7b6c 100644
--- a/src/plugins/scanner/cpp/cpp.pro
+++ b/src/plugins/scanner/cpp/cpp.pro
@@ -1,8 +1,7 @@
+include(cpp.pri)
include(../../plugins.pri)
DEFINES += CPLUSPLUS_NO_PARSER
-TARGET = qbs_cpp_scanner
-
QT = core
HEADERS += CPlusPlusForwardDeclarations.h Lexer.h Token.h ../scanner.h \
diff --git a/src/plugins/scanner/cpp/cppscanner.cpp b/src/plugins/scanner/cpp/cppscanner.cpp
index cbab8a012..1cebc52eb 100644
--- a/src/plugins/scanner/cpp/cppscanner.cpp
+++ b/src/plugins/scanner/cpp/cppscanner.cpp
@@ -330,6 +330,6 @@ static void QbsCppScannerPluginUnload()
{
}
-QBS_REGISTER_STATIC_PLUGIN(extern "C" CPPSCANNER_EXPORT, QbsCppScannerPlugin,
+QBS_REGISTER_STATIC_PLUGIN(extern "C" CPPSCANNER_EXPORT, qbs_cpp_scanner,
QbsCppScannerPluginLoad, QbsCppScannerPluginUnload)
diff --git a/src/plugins/scanner/qt/qt.pri b/src/plugins/scanner/qt/qt.pri
new file mode 100644
index 000000000..71e3a8a45
--- /dev/null
+++ b/src/plugins/scanner/qt/qt.pri
@@ -0,0 +1 @@
+qbsPluginTarget = qbs_qt_scanner
diff --git a/src/plugins/scanner/qt/qt.pro b/src/plugins/scanner/qt/qt.pro
index d90f61b2a..f231ea9e2 100644
--- a/src/plugins/scanner/qt/qt.pro
+++ b/src/plugins/scanner/qt/qt.pro
@@ -1,7 +1,6 @@
+include(qt.pri)
include(../../plugins.pri)
-TARGET = qbs_qt_scanner
-
QT = core
HEADERS += ../scanner.h
diff --git a/src/plugins/scanner/qt/qtscanner.cpp b/src/plugins/scanner/qt/qtscanner.cpp
index 40d062e1f..22fdcb79d 100644
--- a/src/plugins/scanner/qt/qtscanner.cpp
+++ b/src/plugins/scanner/qt/qtscanner.cpp
@@ -191,5 +191,5 @@ static void QbsQtScannerPluginUnload()
{
}
-QBS_REGISTER_STATIC_PLUGIN(extern "C" SCANNER_EXPORT, QbsQtScannerPlugin,
+QBS_REGISTER_STATIC_PLUGIN(extern "C" SCANNER_EXPORT, qbs_qt_scanner,
QbsQtScannerPluginLoad, QbsQtScannerPluginUnload)
diff --git a/src/plugins/use_plugin.pri b/src/plugins/use_plugin.pri
new file mode 100644
index 000000000..53be9f4db
--- /dev/null
+++ b/src/plugins/use_plugin.pri
@@ -0,0 +1,10 @@
+include(qbs_plugin_common.pri)
+
+qbsPluginLibName = $$qbsPluginTarget
+win32:CONFIG(debug, debug|release):CONFIG(static, static|shared): \
+ qbsPluginLibName = $${qbsPluginLibName}d
+LIBS += -l$$qbsPluginLibName
+
+macos: QMAKE_LFLAGS += -Wl,-u,_qbs_static_plugin_register_$$qbsPluginTarget
+!macos:gcc: QMAKE_LFLAGS += -Wl,--require-defined=qbs_static_plugin_register_$$qbsPluginTarget
+msvc: QMAKE_LFLAGS += /INCLUDE:qbs_static_plugin_register_$$qbsPluginTarget