build.py: Build wininterrupt and qtcreatorcdbext separately

The build of wininterrupt and qtcreatorcdbext was using the fully
configured & built Qt Creator as a base. Now that we have separate CMake
projects for these tools, build them really separately.

This will be needed for building them on Windows 32bit for the Qt 6
build, since that doesn't provide Qt builds on that platform anymore.

Change-Id: I50a662c6366814cbb6f4ce62adca2c1c3e9d546f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2021-02-22 15:35:25 +01:00
parent 28a8516394
commit cc0d70dd99

View File

@@ -107,29 +107,10 @@ def get_arguments():
args.with_debug_info = args.build_type == 'RelWithDebInfo' args.with_debug_info = args.build_type == 'RelWithDebInfo'
return args return args
def build_qtcreator(args, paths): def common_cmake_arguments(args):
if not os.path.exists(paths.build):
os.makedirs(paths.build)
prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt]
if paths.llvm:
prefix_paths += [paths.llvm]
if paths.elfutils:
prefix_paths += [paths.elfutils]
prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths]
with_docs_str = 'OFF' if args.no_docs else 'ON'
build_date_option = 'OFF' if args.no_build_date else 'ON'
test_option = 'ON' if args.with_tests else 'OFF'
separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF' separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF'
cmake_args = ['cmake', cmake_args = ['-DCMAKE_BUILD_TYPE=' + args.build_type,
'-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
'-DCMAKE_BUILD_TYPE=' + args.build_type,
'-DQTC_SEPARATE_DEBUG_INFO=' + separate_debug_info_option, '-DQTC_SEPARATE_DEBUG_INFO=' + separate_debug_info_option,
'-DSHOW_BUILD_DATE=' + build_date_option,
'-DWITH_DOCS=' + with_docs_str,
'-DBUILD_DEVELOPER_DOCS=' + with_docs_str,
'-DBUILD_EXECUTABLE_SDKTOOL=OFF',
'-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install),
'-DWITH_TESTS=' + test_option,
'-G', 'Ninja'] '-G', 'Ninja']
if args.python3: if args.python3:
@@ -147,14 +128,39 @@ def build_qtcreator(args, paths):
if not os.environ.get('CC') and not os.environ.get('CXX'): if not os.environ.get('CC') and not os.environ.get('CXX'):
cmake_args += ['-DCMAKE_C_COMPILER=cl', cmake_args += ['-DCMAKE_C_COMPILER=cl',
'-DCMAKE_CXX_COMPILER=cl'] '-DCMAKE_CXX_COMPILER=cl']
cmake_args += ['-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF',
'-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF',
'-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF']
if args.python_path: if args.python_path:
python_library = glob.glob(os.path.join(args.python_path, 'libs', 'python??.lib')) python_library = glob.glob(os.path.join(args.python_path, 'libs', 'python??.lib'))
if python_library: if python_library:
cmake_args += ['-DPYTHON_LIBRARY=' + python_library[0], cmake_args += ['-DPYTHON_LIBRARY=' + python_library[0],
'-DPYTHON_INCLUDE_DIR=' + os.path.join(args.python_path, 'include')] '-DPYTHON_INCLUDE_DIR=' + os.path.join(args.python_path, 'include')]
return cmake_args
def build_qtcreator(args, paths):
if not os.path.exists(paths.build):
os.makedirs(paths.build)
prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt]
if paths.llvm:
prefix_paths += [paths.llvm]
if paths.elfutils:
prefix_paths += [paths.elfutils]
prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths]
with_docs_str = 'OFF' if args.no_docs else 'ON'
build_date_option = 'OFF' if args.no_build_date else 'ON'
test_option = 'ON' if args.with_tests else 'OFF'
cmake_args = ['cmake',
'-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
'-DSHOW_BUILD_DATE=' + build_date_option,
'-DWITH_DOCS=' + with_docs_str,
'-DBUILD_DEVELOPER_DOCS=' + with_docs_str,
'-DBUILD_EXECUTABLE_SDKTOOL=OFF',
'-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install),
'-DWITH_TESTS=' + test_option]
cmake_args += common_cmake_arguments(args)
if common.is_windows_platform():
cmake_args += ['-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF',
'-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF',
'-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF']
# TODO this works around a CMake bug https://gitlab.kitware.com/cmake/cmake/issues/20119 # TODO this works around a CMake bug https://gitlab.kitware.com/cmake/cmake/issues/20119
cmake_args += ['-DBUILD_WITH_PCH=OFF'] cmake_args += ['-DBUILD_WITH_PCH=OFF']
@@ -198,28 +204,34 @@ def build_qtcreator(args, paths):
def build_wininterrupt(args, paths): def build_wininterrupt(args, paths):
if not common.is_windows_platform(): if not common.is_windows_platform():
return return
# assumes existing Qt Creator build if not os.path.exists(paths.wininterrupt_build):
cmake_args = ['-DBUILD_EXECUTABLE_WIN32INTERRUPT=ON', os.makedirs(paths.wininterrupt_build)
'-DBUILD_EXECUTABLE_WIN64INTERRUPT=ON', prefix_paths = [common.to_posix_path(os.path.abspath(fp)) for fp in args.prefix_paths]
'-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF'] cmake_args = ['-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
common.check_print_call(['cmake'] + cmake_args + [paths.src], paths.build) '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.wininterrupt_install)]
common.check_print_call(['cmake', '--build', '.'], paths.build) cmake_args += common_cmake_arguments(args)
common.check_print_call(['cmake'] + cmake_args + [os.path.join(paths.src, 'src', 'tools', 'wininterrupt')],
paths.wininterrupt_build)
common.check_print_call(['cmake', '--build', '.'], paths.wininterrupt_build)
common.check_print_call(['cmake', '--install', '.', '--prefix', paths.wininterrupt_install, common.check_print_call(['cmake', '--install', '.', '--prefix', paths.wininterrupt_install,
'--component', 'wininterrupt'], '--component', 'wininterrupt'],
paths.build) paths.wininterrupt_build)
def build_qtcreatorcdbext(args, paths): def build_qtcreatorcdbext(args, paths):
if args.no_cdb: if args.no_cdb:
return return
# assumes existing Qt Creator build if not os.path.exists(paths.qtcreatorcdbext_build):
cmake_args = ['-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF', os.makedirs(paths.qtcreatorcdbext_build)
'-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF', prefix_paths = [common.to_posix_path(os.path.abspath(fp)) for fp in args.prefix_paths]
'-DBUILD_LIBRARY_QTCREATORCDBEXT=ON'] cmake_args = ['-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
common.check_print_call(['cmake'] + cmake_args + [paths.src], paths.build) '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.qtcreatorcdbext_install)]
common.check_print_call(['cmake', '--build', '.'], paths.build) cmake_args += common_cmake_arguments(args)
common.check_print_call(['cmake'] + cmake_args + [os.path.join(paths.src, 'src', 'libs', 'qtcreatorcdbext')],
paths.qtcreatorcdbext_build)
common.check_print_call(['cmake', '--build', '.'], paths.qtcreatorcdbext_build)
common.check_print_call(['cmake', '--install', '.', '--prefix', paths.qtcreatorcdbext_install, common.check_print_call(['cmake', '--install', '.', '--prefix', paths.qtcreatorcdbext_install,
'--component', 'qtcreatorcdbext'], '--component', 'qtcreatorcdbext'],
paths.build) paths.qtcreatorcdbext_build)
def package_qtcreator(args, paths): def package_qtcreator(args, paths):
if not args.no_zip: if not args.no_zip:
@@ -261,7 +273,7 @@ def package_qtcreator(args, paths):
def get_paths(args): def get_paths(args):
Paths = collections.namedtuple('Paths', Paths = collections.namedtuple('Paths',
['qt', 'src', 'build', ['qt', 'src', 'build', 'wininterrupt_build', 'qtcreatorcdbext_build',
'install', 'dev_install', 'debug_install', 'install', 'dev_install', 'debug_install',
'wininterrupt_install', 'qtcreatorcdbext_install', 'result', 'wininterrupt_install', 'qtcreatorcdbext_install', 'result',
'elfutils', 'llvm']) 'elfutils', 'llvm'])
@@ -270,6 +282,8 @@ def get_paths(args):
return Paths(qt=os.path.abspath(args.qt_path), return Paths(qt=os.path.abspath(args.qt_path),
src=os.path.abspath(args.src), src=os.path.abspath(args.src),
build=os.path.join(build_path, 'build'), build=os.path.join(build_path, 'build'),
wininterrupt_build=os.path.join(build_path, 'build-wininterrupt'),
qtcreatorcdbext_build=os.path.join(build_path, 'build-qtcreatorcdbext'),
install=os.path.join(install_path, 'qt-creator'), install=os.path.join(install_path, 'qt-creator'),
dev_install=os.path.join(install_path, 'qt-creator-dev'), dev_install=os.path.join(install_path, 'qt-creator-dev'),
debug_install=os.path.join(install_path, 'qt-creator-debug'), debug_install=os.path.join(install_path, 'qt-creator-debug'),