forked from qt-creator/qt-creator
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 fceaff1a6f
Change-Id: I1c8445f9c298a17115bca6b42f099a99e33d6de2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
+3
-2
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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:')
|
||||
|
||||
Reference in New Issue
Block a user