summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2019-01-24 14:12:26 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2019-02-21 12:40:18 +0000
commitaa8c4914b748321c085b128735d8455220896313 (patch)
tree0e11fdaf1aa3df522443d70bec9d2a79ad92ab14
parent6c8d836335a0eb57c76aee78b700893ca014fc90 (diff)
downloadqttools-aa8c4914b748321c085b128735d8455220896313.tar.gz
QDoc: Further improvements to libclang detection
In cases where llvm-config was installed without libclang-dev, the llvm-config candidate detection happily proceeded with the first version it found. This change improves on this by checking if the candidate also has clang-c/Index.h (our dependency). This change also adds llvm-config-8 as candidate for locating libclang, and tidies up some of the log messages from configure. Change-Id: I2746c5f427279ab38db4b20a123b695ecaebd1e9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> (cherry picked from commit 6ef3752a7a13b29a20b20c98cf6845f02f24c9c6) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/qdoc/configure.json5
-rw-r--r--src/qdoc/configure.pri15
2 files changed, 15 insertions, 5 deletions
diff --git a/src/qdoc/configure.json b/src/qdoc/configure.json
index 6b757737c..f7190fcb3 100644
--- a/src/qdoc/configure.json
+++ b/src/qdoc/configure.json
@@ -28,8 +28,9 @@
"message": "QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.
Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation.
-On Linux systems you may be able to install libclang from a package. On macOS you could use Homebrew's llvm package.
-On Windows you need to set LLVM_INSTALL_DIR to the installation path."
+On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
+On macOS, you can use Homebrew's llvm package.
+On Windows, you must set LLVM_INSTALL_DIR to the installation path."
}
],
"summary": [
diff --git a/src/qdoc/configure.pri b/src/qdoc/configure.pri
index 8fd43401a..c69ed4edb 100644
--- a/src/qdoc/configure.pri
+++ b/src/qdoc/configure.pri
@@ -57,6 +57,7 @@ defineTest(qtConfTest_libclang) {
# Assume libclang is installed on the target system
isEmpty(LLVM_INSTALL_DIR) {
llvmConfigCandidates = \
+ llvm-config-8 \
llvm-config-7 \
llvm-config-6.0 \
llvm-config-5.0 \
@@ -67,9 +68,17 @@ defineTest(qtConfTest_libclang) {
for (candidate, llvmConfigCandidates) {
LLVM_INSTALL_DIR = $$system("$$candidate --prefix 2>$$QMAKE_SYSTEM_NULL_DEVICE")
!isEmpty(LLVM_INSTALL_DIR) {
- qtLog("Using Clang installation found in $${LLVM_INSTALL_DIR}." \
- "Set the LLVM_INSTALL_DIR environment variable to override.")
- break()
+ CLANG_INCLUDEPATH = $$system("$$candidate --includedir 2>/dev/null")
+ LIBCLANG_MAIN_HEADER = $$CLANG_INCLUDEPATH/clang-c/Index.h
+ !exists($$LIBCLANG_MAIN_HEADER) {
+ !isEmpty(LLVM_INSTALL_DIR): \
+ qtLog("Cannot find libclang's main header file, candidate: $${LIBCLANG_MAIN_HEADER}.")
+ continue
+ } else {
+ qtLog("Using Clang installation found in $${LLVM_INSTALL_DIR}." \
+ "Set the LLVM_INSTALL_DIR environment variable to override.")
+ break()
+ }
}
}
}