Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build UWP with native UWP rustc target #24198

Merged
merged 5 commits into from Oct 12, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Support building UWP with native UWP rustc target.

  • Loading branch information
jdm committed Oct 12, 2019
commit 5367da98f86fa0fd033791bc8f48b640e31bba91
@@ -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"

Some generated files are not rendered by default. Learn more.

@@ -29,4 +29,3 @@ 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" }

@@ -0,0 +1,7 @@
[target.x86_64-uwp-windows-msvc.dependencies]
std = { features = ["panic-unwind"] }
This conversation was marked as resolved by jdm

This comment has been minimized.

@SimonSapin

SimonSapin Oct 11, 2019

Member

Is this necessary? Unlike the ARM target (see comment below), this appears to default to keep the PanicStrategy::Unwind default: https://github.com/rust-lang/rust/blob/000d90b11f7be70ffb7812680f7abc6deb52ec88/src/librustc_target/spec/x86_64_uwp_windows_msvc.rs

This comment has been minimized.

@jdm

jdm Oct 11, 2019

Author Member

Xargo doesn't build libstd successfully unless one of panic-unwind or panic-abort is specified.


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

@@ -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",
This conversation was marked as resolved by jdm

This comment has been minimized.

@SimonSapin

SimonSapin Oct 11, 2019

Member

Are the --uwp and --win-arm64 flags still useful, or should they be removed from mach?

This comment has been minimized.

@jdm

jdm Oct 11, 2019

Author Member

I think it's time to remove them.

"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())
@@ -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())
@@ -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))
@@ -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:
@@ -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"])

@@ -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

@@ -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
@@ -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 = {
@@ -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'),
@@ -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")
@@ -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",
}
@@ -40,4 +40,4 @@
<Capability Name="codeGeneration" />
<Capability Name="privateNetworkClientServer" />
</Capabilities>
</Package>
</Package>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.