Skip to content

Commit

Permalink
Auto merge of #24198 - jdm:xargo-uwp3, r=SimonSapin
Browse files Browse the repository at this point in the history
Build UWP with native UWP rustc target

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24198)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Oct 12, 2019
2 parents 228b34a + 9812305 commit eee2c89
Show file tree
Hide file tree
Showing 11 changed files with 801 additions and 771 deletions.
6 changes: 6 additions & 0 deletions .cargo/config
Expand Up @@ -25,8 +25,14 @@ ar = "aarch64-linux-gnu-ar"
[target.x86_64-pc-windows-msvc]
linker = "lld-link.exe"

[target.x86_64-uwp-windows-msvc]
linker = "lld-link.exe"

[target.i686-pc-windows-msvc]
linker = "lld-link.exe"

[target.aarch64-pc-windows-msvc]
linker = "lld-link.exe"

[target.aarch64-uwp-windows-msvc]
linker = "lld-link.exe"
59 changes: 42 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Expand Up @@ -29,4 +29,7 @@ opt-level = 3
mio = { git = "https://github.com/servo/mio.git", branch = "servo" }
rand_os = { git = "https://github.com/servo/rand", branch = "servo-rand_os-0.1.3-uwp" }
rand_core = { git = "https://github.com/servo/rand", branch = "servo-rand_os-0.1.3-uwp" }

# https://github.com/cuviper/autocfg/pull/10
autocfg = { git = "https://github.com/servo/autocfg", branch = "rustflags" }
# https://github.com/retep998/winapi-rs/pull/816
winapi = { git = "https://github.com/servo/winapi-rs", branch = "patch-1" }
7 changes: 7 additions & 0 deletions Xargo.toml
@@ -0,0 +1,7 @@
[target.x86_64-uwp-windows-msvc.dependencies]
std = { features = ["panic-unwind"] }

# https://github.com/rust-lang/rust/issues/65313
[target.aarch64-uwp-windows-msvc.dependencies]
std = {}

14 changes: 7 additions & 7 deletions etc/taskcluster/decision_task.py
Expand Up @@ -390,8 +390,8 @@ def windows_arm64():
windows_build_task("UWP dev build", arch="arm64", package=False)
.with_treeherder("Windows arm64")
.with_script(
"python mach build --dev --uwp --win-arm64",
"python mach package --dev --target aarch64-pc-windows-msvc --uwp=arm64",
"python mach build --dev --target=aarch64-uwp-windows-msvc",
"python mach package --dev --target aarch64-uwp-windows-msvc --uwp=arm64",
)
.with_artifacts(appx_artifact(debug=True))
.find_or_create("build.windows_uwp_arm64_dev." + CONFIG.task_id())
Expand All @@ -403,8 +403,8 @@ def windows_uwp_x64():
windows_build_task("UWP dev build", package=False)
.with_treeherder("Windows x64")
.with_script(
"mach build --dev --uwp",
"mach package --dev --uwp=x64",
"python mach build --dev --target=x86_64-uwp-windows-msvc",
"python mach package --dev --target=x86_64-uwp-windows-msvc --uwp=x64",
)
.with_artifacts(appx_artifact(debug=True))
.find_or_create("build.windows_uwp_x64_dev." + CONFIG.task_id())
Expand All @@ -418,9 +418,9 @@ def uwp_nightly():
.with_features("taskclusterProxy")
.with_scopes("secrets:get:project/servo/s3-upload-credentials")
.with_script(
"mach build --release --uwp",
"python mach build --release --uwp --win-arm64",
"mach package --release --uwp=x64 --uwp=arm64",
"python mach build --release --target=x86_64-uwp-windows-msvc",
"python mach build --release --target=aarch64-uwp-windows-msvc",
"mach package --release --target=x86_64-uwp-windows-msvc --uwp=x64 --uwp=arm64",
"mach upload-nightly uwp --secret-from-taskcluster",
)
.with_artifacts(appx_artifact(debug=False))
Expand Down
21 changes: 10 additions & 11 deletions python/servo/build_commands.py
Expand Up @@ -164,17 +164,18 @@ class MachCommands(CommandBase):
@CommandArgument('--very-verbose', '-vv',
action='store_true',
help='Print very verbose output')
@CommandArgument('--win-arm64', action='store_true', help="Use arm64 Windows target")
@CommandArgument('params', nargs='...',
help="Command-line arguments to be passed through to Cargo")
@CommandBase.build_like_command_arguments
def build(self, release=False, dev=False, jobs=None, params=None,
no_package=False, verbose=False, very_verbose=False,
target=None, android=False, magicleap=False, libsimpleservo=False, uwp=False,
features=None, win_arm64=False, **kwargs):
target=None, android=False, magicleap=False, libsimpleservo=False,
features=None, **kwargs):
opts = params or []
features = features or []

target, android = self.pick_target_triple(target, android, magicleap)
uwp = target and 'uwp' in target

target_path = base_path = self.get_target_dir()
if android:
Expand Down Expand Up @@ -220,14 +221,8 @@ def build(self, release=False, dev=False, jobs=None, params=None,
if very_verbose:
opts += ["-vv"]

if win_arm64:
if target:
print("Can't specify explicit --target value with --win-arm64.")
sys.exit(1)
target = "aarch64-pc-windows-msvc"

if target:
if self.config["tools"]["use-rustup"]:
if self.config["tools"]["use-rustup"] and not uwp:
# 'rustup target add' fails if the toolchain is not installed at all.
self.call_rustup_run(["rustc", "--version"])

Expand Down Expand Up @@ -265,6 +260,10 @@ def build(self, release=False, dev=False, jobs=None, params=None,
env['PKG_CONFIG_ALLOW_CROSS'] = "1"

if uwp:
# Ensure libstd is ready for the new UWP target.
check_call(["rustup", "component", "add", "rust-src"])
env['RUST_SYSROOT'] = path.expanduser('~\\.xargo')

# Don't try and build a desktop port.
libsimpleservo = True

Expand Down Expand Up @@ -943,7 +942,7 @@ def package_msvc_dlls(servo_exe_dir, target, vcinstalldir, vs_version):
"msvcp140.dll",
"vcruntime140.dll",
]
if target_arch != "aarch64" and vs_version in ("14.0", "15.0", "16.0"):
if target_arch != "aarch64" and "uwp" not in target and vs_version in ("14.0", "15.0", "16.0"):
msvc_deps += ["api-ms-win-crt-runtime-l1-1-0.dll"]

# Check if it's Visual C++ Build Tools or Visual Studio 2015
Expand Down
11 changes: 5 additions & 6 deletions python/servo/command_base.py
Expand Up @@ -634,6 +634,7 @@ def build_env(self, hosts_file_path=None, target=None, is_build=False, test_unit
extra_path += [path.join(self.msvc_package_dir("llvm"), "bin")]
extra_path += [path.join(self.msvc_package_dir("ninja"), "bin")]
extra_path += [self.msvc_package_dir("nuget")]
extra_path += [path.join(self.msvc_package_dir("xargo"))]

arch = (target or host_triple()).split('-')[0]
vcpkg_arch = {
Expand Down Expand Up @@ -821,11 +822,6 @@ def build_like_command_arguments(decorated_function):
action='store_true',
help='Build with frame pointer enabled, used by the background hang monitor.',
),
CommandArgument(
'--uwp',
default=None,
action='store_true',
help='Build for HoloLens (x64)'),
CommandArgument('--with-raqote', default=None, action='store_true'),
CommandArgument('--with-layout-2020', default=None, action='store_true'),
CommandArgument('--without-wgl', default=None, action='store_true'),
Expand Down Expand Up @@ -912,7 +908,10 @@ def run_cargo_build_like_command(
assert "--features" not in cargo_args
args += ["--features", " ".join(features)]

return self.call_rustup_run(["cargo", command] + args + cargo_args, env=env, verbose=verbose)
if target and 'uwp' in target:
return call(["xargo", command] + args + cargo_args, env=env, verbose=verbose)
else:
return self.call_rustup_run(["cargo", command] + args + cargo_args, env=env, verbose=verbose)

def android_support_dir(self):
return path.join(self.context.topdir, "support", "android")
Expand Down
1 change: 1 addition & 0 deletions python/servo/packages.py
Expand Up @@ -11,4 +11,5 @@
"openssl": "111.3.0+1.1.1c-vs2017-2019-09-18",
"gstreamer-uwp": "1.16.0.5",
"openxr-loader-uwp": "1.0",
"xargo": "v0.3.16",
}
2 changes: 1 addition & 1 deletion support/hololens/ServoApp/Package.appxmanifest
Expand Up @@ -40,4 +40,4 @@
<Capability Name="codeGeneration" />
<Capability Name="privateNetworkClientServer" />
</Capabilities>
</Package>
</Package>

0 comments on commit eee2c89

Please sign in to comment.