diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-07-21 17:55:10 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-07-24 07:51:07 +0000 |
commit | 2f67e07e7a89cb814c9a764ef99a1cda1df5874c (patch) | |
tree | 691787b61cf6f9f68b6a917d058d93dbf1094e57 /sources/shiboken2/CMakeLists.txt | |
parent | fb7b201893ccc8333a9e1b8ed536faa5e3446276 (diff) |
Fix building on openSuSE and Ubuntu 16.04 CI machines
Previously all the GCC header paths were explicitly passed to
libclang, which caused redefinition errors of builtin functions or
intrisics (like __rdtsc). Instead of passing the include paths
explicitly, we rely on libclang itself recognizing that there are
GCC paths in the default search locations.
Also we need to pass the libclang builtin headers location, because
it is not able to find them by itself. Usually the search location
for these headers is to get the executable path location (aka
the clang++ binary) and navigate to ../lib/clang/VERSION/include
relative to that binary. But because the shared library is used
instead of the binary, we need to explicitly pass that header
location via the -isystem flag.
Task-number: PYSIDE-513
Change-Id: I7c1127d85c0cea4c063c5c2a3548a1eef5eadaf3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken2/CMakeLists.txt')
-rw-r--r-- | sources/shiboken2/CMakeLists.txt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt index 0ca3c2f8f..0d58bcd64 100644 --- a/sources/shiboken2/CMakeLists.txt +++ b/sources/shiboken2/CMakeLists.txt @@ -65,6 +65,27 @@ endif() message(STATUS "CLANG: ${CLANG_DIR}, ${CLANG_LIBRARY} detected by ${CLANG_DIR_SOURCE}") +# Find highest version clang builtin includes folder to pass along to shiboken. +set(CLANG_BUILTIN_INCLUDES_DIR_PREFIX ${CLANG_DIR}/lib/clang) +file(GLOB CLANG_BUILTIN_INCLUDES_DIR_VERSIONS "${CLANG_BUILTIN_INCLUDES_DIR_PREFIX}/*") + +# Sort in alphabetical order the list of version folders. +list(SORT CLANG_BUILTIN_INCLUDES_DIR_VERSIONS) + +# Reverse it so the first element is the highest version. +list(REVERSE CLANG_BUILTIN_INCLUDES_DIR_VERSIONS) + +message(STATUS "Found the following CLANG builtins includes directories: ${CLANG_BUILTIN_INCLUDES_DIR_VERSIONS}") +if(CLANG_BUILTIN_INCLUDES_DIR_VERSIONS) + # Get highest version. + list(GET CLANG_BUILTIN_INCLUDES_DIR_VERSIONS 0 CLANG_BUILTIN_INCLUDES_DIR_HIGHEST_VERSION) + if (CLANG_BUILTIN_INCLUDES_DIR_HIGHEST_VERSION) + # Set the final variable to the full include path to pass along to shiboken. + set(CLANG_BUILTIN_INCLUDES_DIR "${CLANG_BUILTIN_INCLUDES_DIR_HIGHEST_VERSION}/include") + endif() +endif() +message(STATUS "CLANG builtins includes directory chosen: ${CLANG_BUILTIN_INCLUDES_DIR}") + set(CLANG_EXTRA_INCLUDES ${CLANG_DIR}/include) set(CLANG_EXTRA_LIBRARIES ${CLANG_LIBRARY}) |