diff options
author | Eike Ziller <eike.ziller@qt.io> | 2021-02-22 15:35:25 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2021-02-23 13:56:46 +0000 |
commit | cc0d70dd993618e7915de0c005cb539e620d11f1 (patch) | |
tree | e33afd062a2e47691dcdc99a2b65a0cd5ab226b1 /scripts | |
parent | 28a8516394bbb78361fcfadbcd599d6159904102 (diff) |
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>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.py | 92 |
1 files changed, 53 insertions, 39 deletions
diff --git a/scripts/build.py b/scripts/build.py index afc289fd32..2ccb1a98f4 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -107,29 +107,10 @@ def get_arguments(): args.with_debug_info = args.build_type == 'RelWithDebInfo' return 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' +def common_cmake_arguments(args): separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF' - cmake_args = ['cmake', - '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), - '-DCMAKE_BUILD_TYPE=' + args.build_type, + cmake_args = ['-DCMAKE_BUILD_TYPE=' + args.build_type, '-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'] if args.python3: @@ -147,14 +128,39 @@ def build_qtcreator(args, paths): if not os.environ.get('CC') and not os.environ.get('CXX'): cmake_args += ['-DCMAKE_C_COMPILER=cl', '-DCMAKE_CXX_COMPILER=cl'] - cmake_args += ['-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF', - '-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF', - '-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF'] if args.python_path: python_library = glob.glob(os.path.join(args.python_path, 'libs', 'python??.lib')) if python_library: cmake_args += ['-DPYTHON_LIBRARY=' + python_library[0], '-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 cmake_args += ['-DBUILD_WITH_PCH=OFF'] @@ -198,28 +204,34 @@ def build_qtcreator(args, paths): def build_wininterrupt(args, paths): if not common.is_windows_platform(): return - # assumes existing Qt Creator build - cmake_args = ['-DBUILD_EXECUTABLE_WIN32INTERRUPT=ON', - '-DBUILD_EXECUTABLE_WIN64INTERRUPT=ON', - '-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF'] - common.check_print_call(['cmake'] + cmake_args + [paths.src], paths.build) - common.check_print_call(['cmake', '--build', '.'], paths.build) + if not os.path.exists(paths.wininterrupt_build): + os.makedirs(paths.wininterrupt_build) + prefix_paths = [common.to_posix_path(os.path.abspath(fp)) for fp in args.prefix_paths] + cmake_args = ['-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), + '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.wininterrupt_install)] + 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, '--component', 'wininterrupt'], - paths.build) + paths.wininterrupt_build) def build_qtcreatorcdbext(args, paths): if args.no_cdb: return - # assumes existing Qt Creator build - cmake_args = ['-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF', - '-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF', - '-DBUILD_LIBRARY_QTCREATORCDBEXT=ON'] - common.check_print_call(['cmake'] + cmake_args + [paths.src], paths.build) - common.check_print_call(['cmake', '--build', '.'], paths.build) + if not os.path.exists(paths.qtcreatorcdbext_build): + os.makedirs(paths.qtcreatorcdbext_build) + prefix_paths = [common.to_posix_path(os.path.abspath(fp)) for fp in args.prefix_paths] + cmake_args = ['-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), + '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.qtcreatorcdbext_install)] + 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, '--component', 'qtcreatorcdbext'], - paths.build) + paths.qtcreatorcdbext_build) def package_qtcreator(args, paths): if not args.no_zip: @@ -261,7 +273,7 @@ def package_qtcreator(args, paths): def get_paths(args): Paths = collections.namedtuple('Paths', - ['qt', 'src', 'build', + ['qt', 'src', 'build', 'wininterrupt_build', 'qtcreatorcdbext_build', 'install', 'dev_install', 'debug_install', 'wininterrupt_install', 'qtcreatorcdbext_install', 'result', 'elfutils', 'llvm']) @@ -270,6 +282,8 @@ def get_paths(args): return Paths(qt=os.path.abspath(args.qt_path), src=os.path.abspath(args.src), 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'), dev_install=os.path.join(install_path, 'qt-creator-dev'), debug_install=os.path.join(install_path, 'qt-creator-debug'), |