diff options
author | Jędrzej Nowacki <jedrzej.nowacki@qt.io> | 2018-05-14 11:12:54 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-05-14 19:06:21 +0000 |
commit | 36e7b1925e2ff2df167280eb3592b99697a1234d (patch) | |
tree | 3e5626e955e8a74ad89624146afbd9646611dfc3 | |
parent | 9894e604dff2bf9fe9961b475a678938316154f1 (diff) | |
download | qttools-36e7b1925e2ff2df167280eb3592b99697a1234d.tar.gz |
Allow to link qdoc dynamically to libclang
For releasing we want to link qdoc statically to libclang and ship
a "fat" binary, which allows us to not distribute separate libclang.
In the same time our users may want to link qdoc to an existing
libclang binary. Both cases make sense, especially that the static
build required some invasive patches in libclang.
Partially reverts fddf7ee536e4fd0061d0ee933707881cebe54223
Task-number: QTBUG-68178
Change-Id: Iaeab59c40b881907f0fd5f3ccefb6700dcd2dded
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | mkspecs/features/qt_find_clang.prf | 399 | ||||
-rw-r--r-- | src/qdoc/qdoc.pro | 14 |
2 files changed, 213 insertions, 200 deletions
diff --git a/mkspecs/features/qt_find_clang.prf b/mkspecs/features/qt_find_clang.prf index edcd72e83..9c8de4589 100644 --- a/mkspecs/features/qt_find_clang.prf +++ b/mkspecs/features/qt_find_clang.prf @@ -39,6 +39,9 @@ defineReplace(findLLVMVersionFromLibDir) { return($$candidateVersion) } +isEmpty(QDOC_USE_STATIC_LIBCLANG): QDOC_USE_STATIC_LIBCLANG = $$(QDOC_USE_STATIC_LIBCLANG) +cache(QDOC_USE_STATIC_LIBCLANG) + for(_, $$list(_)) { # just a way to break easily isEmpty(FORCE_MINGW_QDOC_BUILD): FORCE_MINGW_QDOC_BUILD = $$(FORCE_MINGW_QDOC_BUILD) equals(QMAKE_HOST.os, Windows):gcc:isEmpty(FORCE_MINGW_QDOC_BUILD) { @@ -89,200 +92,208 @@ for(_, $$list(_)) { # just a way to break easily } !contains(QMAKE_DEFAULT_LIBDIRS, $$CLANG_LIBDIR): CLANG_LIBS = -L$${CLANG_LIBDIR} - equals(QMAKE_HOST.os, Windows): \ - CLANG_LIBS += -llibclang_static -ladvapi32 -lshell32 -lMincore - else: { - !equals(QMAKE_HOST.os, Darwin): CLANG_LIBS+=-Wl,--start-group - CLANG_LIBS += -lclangAnalysis \ - -lclangApplyReplacements \ - -lclangARCMigrate \ - -lclangAST \ - -lclangASTMatchers \ - -lclangBasic \ - -lclangChangeNamespace \ - -lclangCodeGen \ - -lclangCrossTU \ - -lclangDaemon \ - -lclangDriver \ - -lclangDynamicASTMatchers \ - -lclangEdit \ - -lclangFormat \ - -lclangFrontend \ - -lclangFrontendTool \ - -lclangHandleCXX \ - -lclangIncludeFixer \ - -lclangIncludeFixerPlugin \ - -lclangIndex \ - -lclangLex \ - -lclangMove \ - -lclangParse \ - -lclangQuery \ - -lclangReorderFields \ - -lclangRewrite \ - -lclangRewriteFrontend \ - -lclangSema \ - -lclangSerialization \ - -lclang_static \ - -lclangStaticAnalyzerCheckers \ - -lclangStaticAnalyzerCore \ - -lclangStaticAnalyzerFrontend \ - -lclangTidy \ - -lclangTidyAndroidModule \ - -lclangTidyBoostModule \ - -lclangTidyBugproneModule \ - -lclangTidyCERTModule \ - -lclangTidyCppCoreGuidelinesModule \ - -lclangTidyFuchsiaModule \ - -lclangTidyGoogleModule \ - -lclangTidyHICPPModule \ - -lclangTidyLLVMModule \ - -lclangTidyMiscModule \ - -lclangTidyModernizeModule \ - -lclangTidyMPIModule \ - -lclangTidyObjCModule \ - -lclangTidyPerformanceModule \ - -lclangTidyPlugin \ - -lclangTidyReadabilityModule \ - -lclangTidyUtils \ - -lclangTooling \ - -lclangToolingASTDiff \ - -lclangToolingCore \ - -lclangToolingRefactor \ - -lfindAllSymbols \ - -lLLVMAArch64AsmParser \ - -lLLVMAArch64AsmPrinter \ - -lLLVMAArch64CodeGen \ - -lLLVMAArch64Desc \ - -lLLVMAArch64Disassembler \ - -lLLVMAArch64Info \ - -lLLVMAArch64Utils \ - -lLLVMAMDGPUAsmParser \ - -lLLVMAMDGPUAsmPrinter \ - -lLLVMAMDGPUCodeGen \ - -lLLVMAMDGPUDesc \ - -lLLVMAMDGPUDisassembler \ - -lLLVMAMDGPUInfo \ - -lLLVMAMDGPUUtils \ - -lLLVMAnalysis \ - -lLLVMARMAsmParser \ - -lLLVMARMAsmPrinter \ - -lLLVMARMCodeGen \ - -lLLVMARMDesc \ - -lLLVMARMDisassembler \ - -lLLVMARMInfo \ - -lLLVMARMUtils \ - -lLLVMAsmParser \ - -lLLVMAsmPrinter \ - -lLLVMBinaryFormat \ - -lLLVMBitReader \ - -lLLVMBitWriter \ - -lLLVMBPFAsmParser \ - -lLLVMBPFAsmPrinter \ - -lLLVMBPFCodeGen \ - -lLLVMBPFDesc \ - -lLLVMBPFDisassembler \ - -lLLVMBPFInfo \ - -lLLVMCodeGen \ - -lLLVMCore \ - -lLLVMCoroutines \ - -lLLVMCoverage \ - -lLLVMDebugInfoCodeView \ - -lLLVMDebugInfoDWARF \ - -lLLVMDebugInfoMSF \ - -lLLVMDebugInfoPDB \ - -lLLVMDemangle \ - -lLLVMDlltoolDriver \ - -lLLVMExecutionEngine \ - -lLLVMFuzzMutate \ - -lLLVMGlobalISel \ - -lLLVMHexagonAsmParser \ - -lLLVMHexagonCodeGen \ - -lLLVMHexagonDesc \ - -lLLVMHexagonDisassembler \ - -lLLVMHexagonInfo \ - -lLLVMInstCombine \ - -lLLVMInstrumentation \ - -lLLVMInterpreter \ - -lLLVMipo \ - -lLLVMIRReader \ - -lLLVMLanaiAsmParser \ - -lLLVMLanaiAsmPrinter \ - -lLLVMLanaiCodeGen \ - -lLLVMLanaiDesc \ - -lLLVMLanaiDisassembler \ - -lLLVMLanaiInfo \ - -lLLVMLibDriver \ - -lLLVMLineEditor \ - -lLLVMLinker \ - -lLLVMLTO \ - -lLLVMMC \ - -lLLVMMCDisassembler \ - -lLLVMMCJIT \ - -lLLVMMCParser \ - -lLLVMMipsAsmParser \ - -lLLVMMipsAsmPrinter \ - -lLLVMMipsCodeGen \ - -lLLVMMipsDesc \ - -lLLVMMipsDisassembler \ - -lLLVMMipsInfo \ - -lLLVMMIRParser \ - -lLLVMMSP430AsmPrinter \ - -lLLVMMSP430CodeGen \ - -lLLVMMSP430Desc \ - -lLLVMMSP430Info \ - -lLLVMNVPTXAsmPrinter \ - -lLLVMNVPTXCodeGen \ - -lLLVMNVPTXDesc \ - -lLLVMNVPTXInfo \ - -lLLVMObjCARCOpts \ - -lLLVMObject \ - -lLLVMObjectYAML \ - -lLLVMOption \ - -lLLVMOrcJIT \ - -lLLVMPasses \ - -lLLVMPowerPCAsmParser \ - -lLLVMPowerPCAsmPrinter \ - -lLLVMPowerPCCodeGen \ - -lLLVMPowerPCDesc \ - -lLLVMPowerPCDisassembler \ - -lLLVMPowerPCInfo \ - -lLLVMProfileData \ - -lLLVMRuntimeDyld \ - -lLLVMScalarOpts \ - -lLLVMSelectionDAG \ - -lLLVMSparcAsmParser \ - -lLLVMSparcAsmPrinter \ - -lLLVMSparcCodeGen \ - -lLLVMSparcDesc \ - -lLLVMSparcDisassembler \ - -lLLVMSparcInfo \ - -lLLVMSupport \ - -lLLVMSymbolize \ - -lLLVMSystemZAsmParser \ - -lLLVMSystemZAsmPrinter \ - -lLLVMSystemZCodeGen \ - -lLLVMSystemZDesc \ - -lLLVMSystemZDisassembler \ - -lLLVMSystemZInfo \ - -lLLVMTableGen \ - -lLLVMTarget \ - -lLLVMTransformUtils \ - -lLLVMVectorize \ - -lLLVMWindowsManifest \ - -lLLVMX86AsmParser \ - -lLLVMX86AsmPrinter \ - -lLLVMX86CodeGen \ - -lLLVMX86Desc \ - -lLLVMX86Disassembler \ - -lLLVMX86Info \ - -lLLVMX86Utils \ - -lLLVMXCoreAsmPrinter \ - -lLLVMXCoreCodeGen \ - -lLLVMXCoreDesc \ - -lLLVMXCoreDisassembler \ - -lLLVMXCoreInfo \ - -lLLVMXRay - !equals(QMAKE_HOST.os, Darwin): CLANG_LIBS+=-Wl,--end-group + + !isEmpty(QDOC_USE_STATIC_LIBCLANG) { + equals(QMAKE_HOST.os, Windows): \ + CLANG_LIBS += -llibclang -ladvapi32 -lshell32 + else: \ + CLANG_LIBS += -lclang + } else { + equals(QMAKE_HOST.os, Windows) { + CLANG_LIBS += -llibclang_static -ladvapi32 -lshell32 -lMincore + } else { + !equals(QMAKE_HOST.os, Darwin): CLANG_LIBS+=-Wl,--start-group + CLANG_LIBS += -lclangAnalysis \ + -lclangApplyReplacements \ + -lclangARCMigrate \ + -lclangAST \ + -lclangASTMatchers \ + -lclangBasic \ + -lclangChangeNamespace \ + -lclangCodeGen \ + -lclangCrossTU \ + -lclangDaemon \ + -lclangDriver \ + -lclangDynamicASTMatchers \ + -lclangEdit \ + -lclangFormat \ + -lclangFrontend \ + -lclangFrontendTool \ + -lclangHandleCXX \ + -lclangIncludeFixer \ + -lclangIncludeFixerPlugin \ + -lclangIndex \ + -lclangLex \ + -lclangMove \ + -lclangParse \ + -lclangQuery \ + -lclangReorderFields \ + -lclangRewrite \ + -lclangRewriteFrontend \ + -lclangSema \ + -lclangSerialization \ + -lclang_static \ + -lclangStaticAnalyzerCheckers \ + -lclangStaticAnalyzerCore \ + -lclangStaticAnalyzerFrontend \ + -lclangTidy \ + -lclangTidyAndroidModule \ + -lclangTidyBoostModule \ + -lclangTidyBugproneModule \ + -lclangTidyCERTModule \ + -lclangTidyCppCoreGuidelinesModule \ + -lclangTidyFuchsiaModule \ + -lclangTidyGoogleModule \ + -lclangTidyHICPPModule \ + -lclangTidyLLVMModule \ + -lclangTidyMiscModule \ + -lclangTidyModernizeModule \ + -lclangTidyMPIModule \ + -lclangTidyObjCModule \ + -lclangTidyPerformanceModule \ + -lclangTidyPlugin \ + -lclangTidyReadabilityModule \ + -lclangTidyUtils \ + -lclangTooling \ + -lclangToolingASTDiff \ + -lclangToolingCore \ + -lclangToolingRefactor \ + -lfindAllSymbols \ + -lLLVMAArch64AsmParser \ + -lLLVMAArch64AsmPrinter \ + -lLLVMAArch64CodeGen \ + -lLLVMAArch64Desc \ + -lLLVMAArch64Disassembler \ + -lLLVMAArch64Info \ + -lLLVMAArch64Utils \ + -lLLVMAMDGPUAsmParser \ + -lLLVMAMDGPUAsmPrinter \ + -lLLVMAMDGPUCodeGen \ + -lLLVMAMDGPUDesc \ + -lLLVMAMDGPUDisassembler \ + -lLLVMAMDGPUInfo \ + -lLLVMAMDGPUUtils \ + -lLLVMAnalysis \ + -lLLVMARMAsmParser \ + -lLLVMARMAsmPrinter \ + -lLLVMARMCodeGen \ + -lLLVMARMDesc \ + -lLLVMARMDisassembler \ + -lLLVMARMInfo \ + -lLLVMARMUtils \ + -lLLVMAsmParser \ + -lLLVMAsmPrinter \ + -lLLVMBinaryFormat \ + -lLLVMBitReader \ + -lLLVMBitWriter \ + -lLLVMBPFAsmParser \ + -lLLVMBPFAsmPrinter \ + -lLLVMBPFCodeGen \ + -lLLVMBPFDesc \ + -lLLVMBPFDisassembler \ + -lLLVMBPFInfo \ + -lLLVMCodeGen \ + -lLLVMCore \ + -lLLVMCoroutines \ + -lLLVMCoverage \ + -lLLVMDebugInfoCodeView \ + -lLLVMDebugInfoDWARF \ + -lLLVMDebugInfoMSF \ + -lLLVMDebugInfoPDB \ + -lLLVMDemangle \ + -lLLVMDlltoolDriver \ + -lLLVMExecutionEngine \ + -lLLVMFuzzMutate \ + -lLLVMGlobalISel \ + -lLLVMHexagonAsmParser \ + -lLLVMHexagonCodeGen \ + -lLLVMHexagonDesc \ + -lLLVMHexagonDisassembler \ + -lLLVMHexagonInfo \ + -lLLVMInstCombine \ + -lLLVMInstrumentation \ + -lLLVMInterpreter \ + -lLLVMipo \ + -lLLVMIRReader \ + -lLLVMLanaiAsmParser \ + -lLLVMLanaiAsmPrinter \ + -lLLVMLanaiCodeGen \ + -lLLVMLanaiDesc \ + -lLLVMLanaiDisassembler \ + -lLLVMLanaiInfo \ + -lLLVMLibDriver \ + -lLLVMLineEditor \ + -lLLVMLinker \ + -lLLVMLTO \ + -lLLVMMC \ + -lLLVMMCDisassembler \ + -lLLVMMCJIT \ + -lLLVMMCParser \ + -lLLVMMipsAsmParser \ + -lLLVMMipsAsmPrinter \ + -lLLVMMipsCodeGen \ + -lLLVMMipsDesc \ + -lLLVMMipsDisassembler \ + -lLLVMMipsInfo \ + -lLLVMMIRParser \ + -lLLVMMSP430AsmPrinter \ + -lLLVMMSP430CodeGen \ + -lLLVMMSP430Desc \ + -lLLVMMSP430Info \ + -lLLVMNVPTXAsmPrinter \ + -lLLVMNVPTXCodeGen \ + -lLLVMNVPTXDesc \ + -lLLVMNVPTXInfo \ + -lLLVMObjCARCOpts \ + -lLLVMObject \ + -lLLVMObjectYAML \ + -lLLVMOption \ + -lLLVMOrcJIT \ + -lLLVMPasses \ + -lLLVMPowerPCAsmParser \ + -lLLVMPowerPCAsmPrinter \ + -lLLVMPowerPCCodeGen \ + -lLLVMPowerPCDesc \ + -lLLVMPowerPCDisassembler \ + -lLLVMPowerPCInfo \ + -lLLVMProfileData \ + -lLLVMRuntimeDyld \ + -lLLVMScalarOpts \ + -lLLVMSelectionDAG \ + -lLLVMSparcAsmParser \ + -lLLVMSparcAsmPrinter \ + -lLLVMSparcCodeGen \ + -lLLVMSparcDesc \ + -lLLVMSparcDisassembler \ + -lLLVMSparcInfo \ + -lLLVMSupport \ + -lLLVMSymbolize \ + -lLLVMSystemZAsmParser \ + -lLLVMSystemZAsmPrinter \ + -lLLVMSystemZCodeGen \ + -lLLVMSystemZDesc \ + -lLLVMSystemZDisassembler \ + -lLLVMSystemZInfo \ + -lLLVMTableGen \ + -lLLVMTarget \ + -lLLVMTransformUtils \ + -lLLVMVectorize \ + -lLLVMWindowsManifest \ + -lLLVMX86AsmParser \ + -lLLVMX86AsmPrinter \ + -lLLVMX86CodeGen \ + -lLLVMX86Desc \ + -lLLVMX86Disassembler \ + -lLLVMX86Info \ + -lLLVMX86Utils \ + -lLLVMXCoreAsmPrinter \ + -lLLVMXCoreCodeGen \ + -lLLVMXCoreDesc \ + -lLLVMXCoreDisassembler \ + -lLLVMXCoreInfo \ + -lLLVMXRay + !equals(QMAKE_HOST.os, Darwin): CLANG_LIBS+=-Wl,--end-group + } } !versionIsAtLeast($$CLANG_VERSION, "3.9.0") { diff --git a/src/qdoc/qdoc.pro b/src/qdoc/qdoc.pro index 1475a441d..b35897c26 100644 --- a/src/qdoc/qdoc.pro +++ b/src/qdoc/qdoc.pro @@ -14,12 +14,14 @@ qtHaveModule(qmldevtools-private) { LIBS += $$CLANG_LIBS !contains(QMAKE_DEFAULT_INCDIRS, $$CLANG_INCLUDEPATH): INCLUDEPATH += $$CLANG_INCLUDEPATH -# Support static libclang linking on different platforms -equals(QMAKE_HOST.os, Windows): { - DEFINES += CINDEX_LINKAGE= -} else { - LIBS += -lz -ldl - equals(QMAKE_HOST.os, Darwin): LIBS += -lcurses -lm -lxml2 +!isEmpty(QDOC_USE_STATIC_LIBCLANG) { + # Support static libclang linking on different platforms + equals(QMAKE_HOST.os, Windows) { + DEFINES += CINDEX_LINKAGE= + } else { + LIBS += -lz -ldl + equals(QMAKE_HOST.os, Darwin): LIBS += -lcurses -lm -lxml2 + } } !contains(QMAKE_DEFAULT_LIBDIRS, $$CLANG_LIBDIR):!disable_external_rpath: QMAKE_RPATHDIR += $$CLANG_LIBDIR |