Skip to content

Commit

Permalink
Simplify build process for UWP app.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdm authored and paulrouget committed Jul 3, 2019
1 parent f2e0870 commit 7a3d346
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 5 deletions.
3 changes: 2 additions & 1 deletion components/servo/Cargo.toml
Expand Up @@ -15,6 +15,7 @@ crate-type = ["rlib"]
canvas2d-azure = ["canvas/canvas2d-azure"]
canvas2d-raqote = ["canvas/canvas2d-raqote"]
debugmozjs = ["script/debugmozjs"]
egl = ["mozangle/egl"]
energy-profiling = ["profile_traits/energy-profiling"]
profilemozjs = ["script/profilemozjs"]
googlevr = ["webvr/googlevr"]
Expand Down Expand Up @@ -85,4 +86,4 @@ git = "https://github.com/servo/media"
git = "https://github.com/servo/media"

[target.'cfg(target_os = "windows")'.dependencies]
mozangle = { version = "0.2", features = ["egl"] }
mozangle = {version = "0.2"}
1 change: 1 addition & 0 deletions ports/glutin/Cargo.toml
Expand Up @@ -30,6 +30,7 @@ ProductName = "Servo"
canvas2d-azure = ["libservo/canvas2d-azure"]
canvas2d-raqote = ["libservo/canvas2d-raqote"]
default = ["webdriver", "max_log_level"]
egl = ["libservo/egl"]
energy-profiling = ["libservo/energy-profiling"]
debugmozjs = ["libservo/debugmozjs"]
js_backtrace = ["libservo/js_backtrace"]
Expand Down
1 change: 1 addition & 0 deletions ports/libmlservo/Cargo.toml
Expand Up @@ -15,6 +15,7 @@ bench = false
[features]
canvas2d-azure = ["simpleservo/canvas2d-azure"]
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
egl = ["simpleservo/egl"]

[dependencies]
libservo = { path = "../../components/servo", features = ["no_static_freetype"] }
Expand Down
1 change: 1 addition & 0 deletions ports/libsimpleservo/api/Cargo.toml
Expand Up @@ -30,6 +30,7 @@ canvas2d-azure = ["libservo/canvas2d-azure"]
canvas2d-raqote = ["libservo/canvas2d-raqote"]
default = ["webdriver", "max_log_level"]
debugmozjs = ["libservo/debugmozjs"]
egl = ["libservo/egl"]
energy-profiling = ["libservo/energy-profiling"]
googlevr = ["libservo/googlevr"]
js_backtrace = ["libservo/js_backtrace"]
Expand Down
1 change: 1 addition & 0 deletions ports/libsimpleservo/capi/Cargo.toml
Expand Up @@ -25,6 +25,7 @@ canvas2d-azure = ["simpleservo/canvas2d-azure"]
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
debugmozjs = ["simpleservo/debugmozjs"]
default = ["webdriver", "max_log_level"]
egl = ["simpleservo/egl"]
energy-profiling = ["simpleservo/energy-profiling"]
googlevr = ["simpleservo/googlevr"]
js_backtrace = ["simpleservo/js_backtrace"]
Expand Down
1 change: 1 addition & 0 deletions ports/libsimpleservo/jniapi/Cargo.toml
Expand Up @@ -30,6 +30,7 @@ canvas2d-azure = ["simpleservo/canvas2d-azure"]
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
debugmozjs = ["simpleservo/debugmozjs"]
default = ["webdriver", "max_log_level"]
egl = ["simpleservo/egl"]
energy-profiling = ["simpleservo/energy-profiling"]
googlevr = ["simpleservo/googlevr"]
js_backtrace = ["simpleservo/js_backtrace"]
Expand Down
24 changes: 20 additions & 4 deletions python/servo/build_commands.py
Expand Up @@ -30,7 +30,7 @@
from mach.registrar import Registrar

from mach_bootstrap import _get_exec_path
from servo.command_base import CommandBase, cd, call, check_call, BIN_SUFFIX
from servo.command_base import CommandBase, cd, call, check_call, BIN_SUFFIX, append_to_path_env
from servo.util import host_triple


Expand Down Expand Up @@ -169,7 +169,7 @@ class MachCommands(CommandBase):
@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,
target=None, android=False, magicleap=False, libsimpleservo=False, uwp=False,
features=None, **kwargs):
opts = params or []
features = features or []
Expand Down Expand Up @@ -240,6 +240,21 @@ def build(self, release=False, dev=False, jobs=None, params=None,
env['CXXFLAGS'] = ''
env["CXXFLAGS"] += "-mmacosx-version-min=10.10"

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

# Ensure that the NuGet ANGLE package containing libEGL is accessible
# to the Rust linker.
append_to_path_env(
path.join(
os.getcwd(), "support", "hololens", "packages",
"ANGLE.WindowsStore.2.1.13", "bin", "UAP", "x64"
),
env,
"LIB"
)

if android:
if "ANDROID_NDK" not in env:
print("Please set the ANDROID_NDK environment variable.")
Expand Down Expand Up @@ -532,7 +547,7 @@ def build(self, release=False, dev=False, jobs=None, params=None,

status = self.run_cargo_build_like_command(
"build", opts, env=env, verbose=verbose,
target=target, android=android, magicleap=magicleap, libsimpleservo=libsimpleservo,
target=target, android=android, magicleap=magicleap, libsimpleservo=libsimpleservo, uwp=uwp,
features=features, **kwargs
)
status = 0
Expand Down Expand Up @@ -585,7 +600,8 @@ def package_generated_shared_libraries(libs, build_path, servo_exe_dir):
for lib in libs:
print("WARNING: could not find " + lib)

package_generated_shared_libraries(["libEGL.dll"], build_path, servo_exe_dir)
if not uwp:
package_generated_shared_libraries(["libEGL.dll"], build_path, servo_exe_dir)

# copy needed gstreamer DLLs in to servo.exe dir
target_triple = target or host_triple()
Expand Down
12 changes: 12 additions & 0 deletions python/servo/command_base.py
Expand Up @@ -782,6 +782,11 @@ 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('--without-wgl', default=None, action='store_true'),
]
Expand Down Expand Up @@ -809,6 +814,7 @@ def run_cargo_build_like_command(
target=None, android=False, magicleap=False, libsimpleservo=False,
features=None, debug_mozjs=False, with_debug_assertions=False,
with_frame_pointer=False, with_raqote=False, without_wgl=False,
uwp=False,
):
env = env or self.build_env()
target, android = self.pick_target_triple(target, android, magicleap)
Expand Down Expand Up @@ -836,6 +842,12 @@ def run_cargo_build_like_command(
features.append("debugmozjs")
if not magicleap:
features.append("native-bluetooth")
if uwp:
features.append("canvas2d-raqote")
features.append("no_wgl")
else:
# Non-UWP builds provide their own libEGL via mozangle.
features.append("egl")
if with_raqote and "canvas2d-azure" not in features:
features.append("canvas2d-raqote")
elif "canvas2d-raqote" not in features:
Expand Down

0 comments on commit 7a3d346

Please sign in to comment.