forked from qt-creator/qt-creator
build.py: Add option to call cpack
Adds --with-cpack option. - macOS: does nothing (we already create a better, signed disk image) - Linux: creates qtcreator.deb in build directory - Windows: Checks for NSIS and WIX installation, creates qtcreator.exe and qtcreator.msi as appropriate Change-Id: Ie7816d04cb2e01e90795481e1519b0a6645f5cd3 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -7,8 +7,8 @@ from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import collections
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import common
|
||||
|
||||
@@ -70,6 +70,8 @@ def get_arguments():
|
||||
action='store_true', default=False)
|
||||
parser.add_argument('--with-pch', help='Enable building with PCH',
|
||||
action='store_true', default=False)
|
||||
parser.add_argument('--with-cpack', help='Create packages with cpack',
|
||||
action='store_true', default=False)
|
||||
parser.add_argument('--add-path', help='Prepends a CMAKE_PREFIX_PATH to the build',
|
||||
action='append', dest='prefix_paths', default=[])
|
||||
parser.add_argument('--add-module-path', help='Prepends a CMAKE_MODULE_PATH to the build',
|
||||
@@ -92,6 +94,23 @@ def get_arguments():
|
||||
|
||||
if not args.qt_path and not args.no_qtcreator:
|
||||
parser.error("argument --qt-path is required if --no-qtcreator is not given")
|
||||
|
||||
if args.with_cpack:
|
||||
if common.is_mac_platform():
|
||||
print('warning: --with-cpack is not supported on macOS, turning off')
|
||||
args.with_cpack = False
|
||||
elif common.is_linux_platform():
|
||||
args.cpack_generators = ['DEB']
|
||||
elif common.is_windows_platform():
|
||||
args.cpack_generators = []
|
||||
if shutil.which('makensis'):
|
||||
args.cpack_generators += ['NSIS64']
|
||||
if shutil.which('candle') and shutil.which('torch'):
|
||||
args.cpack_generators += ['WIX']
|
||||
else:
|
||||
print('warning: could not find NSIS or WIX, turning cpack off')
|
||||
args.with_cpack = False
|
||||
|
||||
return args
|
||||
|
||||
def common_cmake_arguments(args):
|
||||
@@ -149,7 +168,6 @@ def build_qtcreator(args, paths):
|
||||
'-DBUILD_DEVELOPER_DOCS=' + cmake_option(not args.no_docs),
|
||||
'-DBUILD_EXECUTABLE_SDKTOOL=OFF',
|
||||
'-DQTC_FORCE_XCB=ON',
|
||||
'-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install),
|
||||
'-DWITH_TESTS=' + cmake_option(args.with_tests)]
|
||||
cmake_args += common_cmake_arguments(args)
|
||||
|
||||
@@ -168,6 +186,9 @@ def build_qtcreator(args, paths):
|
||||
cmake_args += ['-DWITH_SANITIZE=ON',
|
||||
'-DSANITIZE_FLAGS=' + ",".join(args.sanitize_flags)]
|
||||
|
||||
if args.with_cpack:
|
||||
cmake_args += ['-DCPACK_PACKAGE_FILE_NAME=qtcreator' + args.zip_infix]
|
||||
|
||||
cmake_args += args.config_args
|
||||
|
||||
common.check_print_call(cmake_args + [paths.src], paths.build)
|
||||
@@ -288,6 +309,8 @@ def package_qtcreator(args, paths):
|
||||
paths.src,
|
||||
paths.install],
|
||||
paths.result)
|
||||
if args.with_cpack and args.cpack_generators:
|
||||
common.check_print_call(['cpack', '-G', ';'.join(args.cpack_generators)], paths.build)
|
||||
|
||||
|
||||
def get_paths(args):
|
||||
|
||||
Reference in New Issue
Block a user