diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-05-18 16:06:28 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-05-19 11:00:17 +0000 |
commit | c5139fe6e350ccdb315e2b5dabccf31c04b8eed0 (patch) | |
tree | 9d110e55a8cc7e5f16900b976e30abdbb2722b41 /setup.py | |
parent | 8f3fca016b9bdec0975d2f4d17d39782399e3701 (diff) |
setup.py/Windows: Add Clang to PATH
This removes the need for PATH to be added by COIN and
makes provisioning easier. It should be revisited once
Clang is shipped as 3rdparty library for Qt.
Task-number: PYSIDE-431
Change-Id: I6868a2cfda4b519065c8db33e0779e6c48ba9fae
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -38,6 +38,7 @@ ############################################################################# from __future__ import print_function +from distutils.version import LooseVersion """This is a distutils setup-script for the PySide2 project @@ -351,6 +352,22 @@ def prefix(): name += 'd' return name +def detectClang(): + source = 'LLVM_INSTALL_DIR' + clangDir = os.environ.get(source, None) + if not clangDir: + source = 'CLANG_INSTALL_DIR' + clangDir = os.environ.get(source, None) + if not clangDir: + source = 'llvm-config' + try: + output = run_process_output([source, '--prefix']) + if output: + clangDir = output[0] + except: + pass + return [clangDir, source] + # Initialize, pull and checkout submodules def prepareSubModules(): print("Initializing submodules for PySide2 version %s" % __version__) @@ -654,7 +671,20 @@ class pyside_build(_build): sys.exit(1) # Update the PATH environment variable - update_env_path([py_scripts_dir, qt_dir]) + additionalPaths = [py_scripts_dir, qt_dir] + + # Add Clang to path for Windows. Revisit once Clang is bundled with Qt. + if sys.platform == "win32" and LooseVersion(self.qtinfo.version) >= LooseVersion("5.7.0"): + clangDir = detectClang() + if clangDir[0]: + clangBinDir = os.path.join(clangDir[0], 'bin') + if not clangBinDir in os.environ.get('PATH'): + log.info("Adding %s as detected by %s to PATH" % (clangBinDir, clangDir[1])) + additionalPaths.append(clangBinDir) + else: + log.error("Failed to detect Clang by checking LLVM_INSTALL_DIR, CLANG_INSTALL_DIR, llvm-config") + + update_env_path(additionalPaths) build_name = "py%s-qt%s-%s-%s" % \ (py_version, qt_version, platform.architecture()[0], build_type.lower()) |