aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-09-20 12:57:25 +0200
committerChristian Tismer <tismer@stackless.com>2017-09-22 09:19:45 +0000
commitc3fc507d3b2a502273bd92472e1e7aa459c2d13e (patch)
treec0ecb865ea9624802ce042fd848abd8aa1f81996
parent10a50822e460c577e0cb6c0fd6d62970107d37a1 (diff)
Replace _ARCH_ by 64/32bit in LLVM_INSTALL_DIR
Task-number: PYSIDE-431 Change-Id: I6d4ea037ab0c524f305ed72f95745deb410b8971 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken2/CMakeLists.txt17
-rw-r--r--utils.py3
2 files changed, 20 insertions, 0 deletions
diff --git a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt
index bd715bb9..06b95176 100644
--- a/sources/shiboken2/CMakeLists.txt
+++ b/sources/shiboken2/CMakeLists.txt
@@ -27,14 +27,31 @@ else()
find_package(PythonLibs 2.6)
endif()
+macro(get_python_arch)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "if True:
+ import sys
+ print('64' if sys.maxsize > 2**31-1 else '32')
+ "
+ OUTPUT_VARIABLE PYTHON_ARCH
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ message("PYTHON_ARCH: " ${PYTHON_ARCH})
+endmacro()
+
+if (NOT PYTHON_ARCH)
+ get_python_arch()
+endif()
+
set(CLANG_DIR "")
set(CLANG_DIR_SOURCE "")
if (DEFINED ENV{LLVM_INSTALL_DIR})
set(CLANG_DIR $ENV{LLVM_INSTALL_DIR})
+ string(REPLACE "_ARCH_" "${PYTHON_ARCH}" CLANG_DIR "${CLANG_DIR}")
set(CLANG_DIR_SOURCE "LLVM_INSTALL_DIR")
elseif (DEFINED ENV{CLANG_INSTALL_DIR})
set(CLANG_DIR $ENV{CLANG_INSTALL_DIR})
+ string(REPLACE "_ARCH_" "${PYTHON_ARCH}" CLANG_DIR "${CLANG_DIR}")
set(CLANG_DIR_SOURCE "CLANG_INSTALL_DIR")
else ()
EXEC_PROGRAM("llvm-config" ARGS "--prefix" OUTPUT_VARIABLE CLANG_DIR)
diff --git a/utils.py b/utils.py
index 088d6666..cbd19c20 100644
--- a/utils.py
+++ b/utils.py
@@ -676,4 +676,7 @@ def detectClang():
clangDir = output[0]
except OSError:
pass
+ if clangDir:
+ arch = '64' if sys.maxsize > 2**31-1 else '32'
+ clangDir = clangDir.replace('_ARCH_', arch)
return (clangDir, source)