Bug 1770302 - Consolidate how the clang targets are configured. r=firefox-build-system-reviewers,andi

Differential Revision: https://phabricator.services.mozilla.com/D146874
This commit is contained in:
Mike Hommey 2022-05-20 08:33:15 +00:00
Родитель 9bd4f1813b
Коммит 6b10bc399b
8 изменённых файлов: 11 добавлений и 18 удалений

Просмотреть файл

@ -1,3 +1,4 @@
{ {
"stages": "1" "stages": "1",
"targets": "X86;ARM;AArch64;WebAssembly"
} }

Просмотреть файл

@ -1,4 +1,5 @@
{ {
"stages": "4", "stages": "4",
"targets": "X86;ARM;AArch64;WebAssembly",
"pgo": true "pgo": true
} }

Просмотреть файл

@ -38,6 +38,7 @@ build-clang.py accepts a JSON config format with the following fields:
* ld: Path to the linker. * ld: Path to the linker.
* patches: Optional list of patches to apply. * patches: Optional list of patches to apply.
* build_type: The type of build to make. Supported types: Release, Debug, RelWithDebInfo or MinSizeRel. * build_type: The type of build to make. Supported types: Release, Debug, RelWithDebInfo or MinSizeRel.
* targets: The targets supported by the final stage LLVM/clang.
* build_clang_tidy: Whether to build clang-tidy with the Mozilla checks imported. The default is false. * build_clang_tidy: Whether to build clang-tidy with the Mozilla checks imported. The default is false.
* osx_cross_compile: Whether to invoke CMake for OS X cross compile builds. * osx_cross_compile: Whether to invoke CMake for OS X cross compile builds.
* assertions: Whether to enable LLVM assertions. The default is false. * assertions: Whether to enable LLVM assertions. The default is false.

Просмотреть файл

@ -196,7 +196,7 @@ def build_one_stage(
build_type, build_type,
assertions, assertions,
libcxx_include_dir, libcxx_include_dir,
build_wasm, targets,
is_final_stage=False, is_final_stage=False,
profile=None, profile=None,
): ):
@ -211,9 +211,7 @@ def build_one_stage(
return path.replace("\\", "/") return path.replace("\\", "/")
def cmake_base_args(cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir): def cmake_base_args(cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir):
machine_targets = "X86;ARM;AArch64" if is_final_stage else "X86" machine_targets = targets if is_final_stage and targets else "X86"
if build_wasm and is_final_stage:
machine_targets += ";WebAssembly"
cmake_args = [ cmake_args = [
"-GNinja", "-GNinja",
@ -574,11 +572,7 @@ def main():
"We only know how to do Release, Debug, RelWithDebInfo or " "We only know how to do Release, Debug, RelWithDebInfo or "
"MinSizeRel builds" "MinSizeRel builds"
) )
build_wasm = False targets = config.get("targets")
if "build_wasm" in config:
build_wasm = config["build_wasm"]
if build_wasm not in (True, False):
raise ValueError("Only boolean values are accepted for build_wasm.")
build_clang_tidy = False build_clang_tidy = False
if "build_clang_tidy" in config: if "build_clang_tidy" in config:
build_clang_tidy = config["build_clang_tidy"] build_clang_tidy = config["build_clang_tidy"]
@ -766,7 +760,7 @@ def main():
build_type, build_type,
assertions, assertions,
libcxx_include_dir, libcxx_include_dir,
build_wasm, targets,
is_final_stage=(stages == 1), is_final_stage=(stages == 1),
) )
@ -793,7 +787,7 @@ def main():
build_type, build_type,
assertions, assertions,
libcxx_include_dir, libcxx_include_dir,
build_wasm, targets,
is_final_stage=(stages == 2), is_final_stage=(stages == 2),
profile="gen" if pgo else None, profile="gen" if pgo else None,
) )
@ -821,7 +815,7 @@ def main():
build_type, build_type,
assertions, assertions,
libcxx_include_dir, libcxx_include_dir,
build_wasm, targets,
(stages == 3), (stages == 3),
) )
if pgo: if pgo:
@ -865,7 +859,7 @@ def main():
build_type, build_type,
assertions, assertions,
libcxx_include_dir, libcxx_include_dir,
build_wasm, targets,
(stages == 4), (stages == 4),
profile=profile, profile=profile,
) )

Просмотреть файл

@ -2,7 +2,6 @@
"cc": "/usr/bin/gcc", "cc": "/usr/bin/gcc",
"cxx": "/usr/bin/g++", "cxx": "/usr/bin/g++",
"as": "/usr/bin/gcc", "as": "/usr/bin/gcc",
"build_wasm": false,
"patches": [ "patches": [
"profile-g4a10504e1f70c.patch" "profile-g4a10504e1f70c.patch"
] ]

Просмотреть файл

@ -1,5 +1,4 @@
{ {
"build_wasm": true,
"cc": "/usr/lib/llvm-11/bin/clang", "cc": "/usr/lib/llvm-11/bin/clang",
"cxx": "/usr/lib/llvm-11/bin/clang++", "cxx": "/usr/lib/llvm-11/bin/clang++",
"as": "/usr/lib/llvm-11/bin/clang" "as": "/usr/lib/llvm-11/bin/clang"

Просмотреть файл

@ -1,5 +1,4 @@
{ {
"build_wasm": true,
"osx_cross_compile": true, "osx_cross_compile": true,
"cc": "{MOZ_FETCHES_DIR}/clang/bin/clang", "cc": "{MOZ_FETCHES_DIR}/clang/bin/clang",
"cxx": "{MOZ_FETCHES_DIR}/clang/bin/clang++", "cxx": "{MOZ_FETCHES_DIR}/clang/bin/clang++",

Просмотреть файл

@ -1,5 +1,4 @@
{ {
"build_wasm": true,
"cc": "cl.exe", "cc": "cl.exe",
"cxx": "cl.exe", "cxx": "cl.exe",
"ml": "ml64.exe" "ml": "ml64.exe"