diff options
author | Eike Ziller <eike.ziller@qt.io> | 2020-11-10 09:32:45 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2020-11-10 09:50:23 +0000 |
commit | 88498101a0e32ea89654c27ee5a1822606351d83 (patch) | |
tree | efadb305f7d30a32083b5417efc34e210ed33cf6 /scripts | |
parent | ad48f2639c80ece9b8a271a8809d44561177995a (diff) |
Build scripts: Fix path format for cmake calls
Make sure to pass posix style paths to CMAKE_PREFIX_PATH,
CMAKE_MODULE_PATH and CMAKE_INSTALL_PREFIX. Otherwise this can lead to
funny "Unknown control sequence \U" kind of errors.
Follow-up of fceaff1a6fba4a99d07a45ec07142898d7a0fca3
Change-Id: I1c8445f9c298a17115bca6b42f099a99e33d6de2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.py | 5 | ||||
-rwxr-xr-x | scripts/build_plugin.py | 3 | ||||
-rw-r--r-- | scripts/common.py | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/scripts/build.py b/scripts/build.py index 7e4df20d6a..1fcc7fb66d 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -112,6 +112,7 @@ def build_qtcreator(args, paths): prefix_paths += [paths.llvm] if paths.elfutils: prefix_paths += [paths.elfutils] + prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths] build_type = 'Debug' if args.debug else 'Release' with_docs_str = 'OFF' if args.no_docs else 'ON' build_date_option = 'OFF' if args.no_build_date else 'ON' @@ -123,7 +124,7 @@ def build_qtcreator(args, paths): '-DWITH_DOCS=' + with_docs_str, '-DBUILD_DEVELOPER_DOCS=' + with_docs_str, '-DBUILD_EXECUTABLE_SDKTOOL=OFF', - '-DCMAKE_INSTALL_PREFIX=' + paths.install, + '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install), '-DWITH_TESTS=' + test_option, '-G', 'Ninja'] @@ -131,7 +132,7 @@ def build_qtcreator(args, paths): cmake_args += ['-DPYTHON_EXECUTABLE=' + args.python3] if args.module_paths: - module_paths = [os.path.abspath(fp).replace('\\', '/') for fp in args.module_paths] + module_paths = [common.to_posix_path(os.path.abspath(fp)) for fp in args.module_paths] cmake_args += ['-DCMAKE_MODULE_PATH=' + ';'.join(module_paths)] # force MSVC on Windows, because it looks for GCC in the PATH first, diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py index 811713a969..43b8056c0f 100755 --- a/scripts/build_plugin.py +++ b/scripts/build_plugin.py @@ -66,11 +66,12 @@ def build(args, paths): if not os.path.exists(paths.result): os.makedirs(paths.result) prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt_creator, paths.qt] + prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths] build_type = 'Debug' if args.debug else 'Release' cmake_args = ['cmake', '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), '-DCMAKE_BUILD_TYPE=' + build_type, - '-DCMAKE_INSTALL_PREFIX=' + paths.install, + '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install), '-G', 'Ninja'] # force MSVC on Windows, because it looks for GCC in the PATH first, diff --git a/scripts/common.py b/scripts/common.py index a828faca2d..df025cf839 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -40,6 +40,12 @@ def is_linux_platform(): def is_mac_platform(): return sys.platform.startswith('darwin') +def to_posix_path(path): + if is_windows_platform(): + # should switch to pathlib from python3 + return path.replace('\\', '/') + return path + def check_print_call(command, workdir, env=None): print('------------------------------------------') print('COMMAND:') |