Skip to content

Commit

Permalink
Merge pull request #357 from ucam-department-of-psychiatry/build-thir…
Browse files Browse the repository at this point in the history
…d-party-dependencies-separately

Options to build components separately in the build_qt.py script
  • Loading branch information
martinburchell authored Jun 13, 2024
2 parents 7d36d16 + 11f959c commit 390bc1f
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 21 deletions.
25 changes: 19 additions & 6 deletions docs/source/developer/_build_qt_help.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
usage: build_qt.py [-h] [--show_config_only] [--root_dir ROOT_DIR]
[--no_build_qt] [--no_fetch] [--nparallel NPARALLEL]
[--force] [--force_ffmpeg] [--force_openssl] [--force_qt]
[--force_sqlcipher] [--tee TEE] [--verbose {0,1,2}]
[--inherit_os_env] [--no_inherit_os_env] [--build_all]
[--configure_qt_only] [--fetch] [--no_fetch]
[--nparallel NPARALLEL] [--build_ffmpeg]
[--no_build_ffmpeg] [--build_openssl] [--no_build_openssl]
[--build_qt] [--no_build_qt] [--build_sqlcipher]
[--no_build_sqlcipher] [--force] [--force_ffmpeg]
[--force_openssl] [--force_qt] [--force_sqlcipher]
[--tee TEE] [--verbose {0,1,2}] [--inherit_os_env]
[--no_inherit_os_env] [--build_all]
[--build_android_x86_32] [--build_android_x86_64]
[--build_android_arm_v7_32] [--build_android_arm_v8_64]
[--build_linux_x86_64] [--build_macos_x86_64]
Expand Down Expand Up @@ -32,10 +36,19 @@ General:
--root_dir ROOT_DIR Root directory for source and builds (default taken
from environment variable CAMCOPS_QT6_BASE_DIR if
present) (default: /path/to/user/dev/qt_local_build)
--no_build_qt Only run Qt configure, don't build Qt (default: True)
--no_fetch Skip fetching source code (default: True)
--configure_qt_only Only run Qt configure, don't build Qt (default: False)
--fetch Fetch source code (default: True)
--no_fetch Skip fetching source code (default: False)
--nparallel NPARALLEL
Number of parallel processes to run (default: 8)
--build_ffmpeg Build FFmpeg (default: True)
--no_build_ffmpeg Skip building FFmpeg (default: False)
--build_openssl Build OpenSSL (default: True)
--no_build_openssl Skip building OpenSSL (default: False)
--build_qt Build Qt (default: True)
--no_build_qt Skip building Qt (default: False)
--build_sqlcipher Build SQLCipher (default: True)
--no_build_sqlcipher Skip building SQLCipher (default: False)
--force Force rebuild of everything (default: False)
--force_ffmpeg Force rebuild of FFmpeg (default: False)
--force_openssl Force rebuild of OpenSSL (default: False)
Expand Down
108 changes: 93 additions & 15 deletions tablet_qt/tools/build_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1582,10 +1582,14 @@ def __init__(self, args: argparse.Namespace) -> None:

# General
self.show_config_only = args.show_config_only # type: bool
self.build_qt = args.build_qt
self.configure_qt_only = args.configure_qt_only
self.fetch = args.fetch
self.root_dir = args.root_dir # type: str
self.nparallel = args.nparallel # type: int
self.build_ffmpeg = args.build_ffmpeg
self.build_openssl = args.build_openssl
self.build_qt = args.build_qt
self.build_sqlcipher = args.build_sqlcipher
self.force_ffmpeg = args.force or args.force_ffmpeg # type: bool
self.force_openssl = args.force or args.force_openssl # type: bool
self.force_qt = args.force or args.force_qt # type: bool
Expand Down Expand Up @@ -4292,13 +4296,17 @@ def master_builder(args) -> None:
# Fetch
# =========================================================================
if cfg.fetch:
download_qt(cfg)
checkout_qt(cfg)
patch_qt(cfg)
fetch_openssl(cfg)
fetch_sqlcipher(cfg)
if cfg.build_qt:
download_qt(cfg)
checkout_qt(cfg)
patch_qt(cfg)
if cfg.build_openssl:
fetch_openssl(cfg)
if cfg.build_sqlcipher:
fetch_sqlcipher(cfg)
fetch_eigen(cfg)
fetch_ffmpeg(cfg)
if cfg.build_ffmpeg:
fetch_ffmpeg(cfg)

# =========================================================================
# Build
Expand All @@ -4315,14 +4323,16 @@ def build_for(os: str, cpu: str) -> None:
f"Building (1) OpenSSL, (2) SQLite/SQLCipher, (3) Qt "
f"for {target_platform}"
)
build_openssl(cfg, target_platform)
build_sqlcipher(cfg, target_platform)
if cfg.use_ffmpeg(target_platform):
if cfg.build_openssl:
build_openssl(cfg, target_platform)
if cfg.build_sqlcipher:
build_sqlcipher(cfg, target_platform)
if cfg.build_ffmpeg and cfg.use_ffmpeg(target_platform):
build_ffmpeg(cfg, target_platform)

if qt_needs_building(cfg, target_platform):
if cfg.build_qt and qt_needs_building(cfg, target_platform):
configure_qt(cfg, target_platform)
if cfg.build_qt:
if not cfg.configure_qt_only:
installdirs.append(build_qt(cfg, target_platform))
if target_platform.android and ADD_SO_VERSION_OF_LIBQTFORANDROID:
make_missing_libqtforandroid_so(cfg, target_platform)
Expand Down Expand Up @@ -4374,6 +4384,10 @@ def build_for(os: str, cpu: str) -> None:
build_for(Os.IOS, Cpu.X86_64)

if not cfg.build_qt:
log.info("Not building Qt.")
sys.exit(EXIT_SUCCESS)

if cfg.configure_qt_only:
log.info("Configuration only. Not building Qt.")
sys.exit(EXIT_SUCCESS)

Expand Down Expand Up @@ -4432,15 +4446,23 @@ def main() -> None:
),
)
general.add_argument(
"--no_build_qt",
dest="build_qt",
action="store_false",
"--configure_qt_only",
dest="configure_qt_only",
action="store_true",
help="Only run Qt configure, don't build Qt",
)
general.add_argument(
"--fetch",
dest="fetch",
action="store_true",
default=True,
help="Fetch source code",
)
general.add_argument(
"--no_fetch",
dest="fetch",
action="store_false",
default=False,
help="Skip fetching source code",
)
general.add_argument(
Expand All @@ -4449,6 +4471,62 @@ def main() -> None:
default=CPU_COUNT,
help="Number of parallel processes to run",
)
general.add_argument(
"--build_ffmpeg",
dest="build_ffmpeg",
action="store_true",
default=True,
help="Build FFmpeg",
)
general.add_argument(
"--no_build_ffmpeg",
dest="build_ffmpeg",
action="store_false",
default=False,
help="Skip building FFmpeg",
)
general.add_argument(
"--build_openssl",
dest="build_openssl",
action="store_true",
default=True,
help="Build OpenSSL",
)
general.add_argument(
"--no_build_openssl",
dest="build_openssl",
action="store_false",
default=False,
help="Skip building OpenSSL",
)
general.add_argument(
"--build_qt",
dest="build_qt",
action="store_true",
default=True,
help="Build Qt",
)
general.add_argument(
"--no_build_qt",
dest="build_qt",
action="store_false",
default=False,
help="Skip building Qt",
)
general.add_argument(
"--build_sqlcipher",
dest="build_sqlcipher",
action="store_true",
default=True,
help="Build SQLCipher",
)
general.add_argument(
"--no_build_sqlcipher",
dest="build_sqlcipher",
action="store_false",
default=False,
help="Skip building SQLCipher",
)
general.add_argument(
"--force", action="store_true", help="Force rebuild of everything"
)
Expand Down

0 comments on commit 390bc1f

Please sign in to comment.