Add icon to servo.exe

This commit is contained in:
UK992 2018-03-16 19:54:19 +01:00
parent 1ae5715309
commit 13ce5c239c
7 changed files with 33 additions and 9 deletions

10
Cargo.lock generated
View file

@ -2687,6 +2687,7 @@ dependencies = [
"webrender_api 0.57.0 (git+https://github.com/servo/webrender)", "webrender_api 0.57.0 (git+https://github.com/servo/webrender)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winit 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "winit 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winres 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"x11 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3610,6 +3611,14 @@ dependencies = [
"x11-dl 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "x11-dl 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "winres"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "ws" name = "ws"
version = "0.6.0" version = "0.6.0"
@ -3995,6 +4004,7 @@ dependencies = [
"checksum winapi-i686-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ec6667f60c23eca65c561e63a13d81b44234c2e38a6b6c959025ee907ec614cc" "checksum winapi-i686-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ec6667f60c23eca65c561e63a13d81b44234c2e38a6b6c959025ee907ec614cc"
"checksum winapi-x86_64-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98f12c52b2630cd05d2c3ffd8e008f7f48252c042b4871c72aed9dc733b96668" "checksum winapi-x86_64-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98f12c52b2630cd05d2c3ffd8e008f7f48252c042b4871c72aed9dc733b96668"
"checksum winit 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "396f0350e661940359e3c8c7d58ff847f67997943e2c80ecac374c5aa8287f63" "checksum winit 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "396f0350e661940359e3c8c7d58ff847f67997943e2c80ecac374c5aa8287f63"
"checksum winres 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "27d9192d6356d7efe8405dec6c5506b67543cf64b6049968f39f4c4623b4f25d"
"checksum ws 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "04614a58714f3fd4a8b1da4bcae9f031c532d35988c3d39627619248113f8be8" "checksum ws 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "04614a58714f3fd4a8b1da4bcae9f031c532d35988c3d39627619248113f8be8"
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
"checksum x11 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5c4ac579b5d324dc4add02312b5d0e3e0218521e2d5779d526ac39ee4bb171" "checksum x11 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5c4ac579b5d324dc4add02312b5d0e3e0218521e2d5779d526ac39ee4bb171"

View file

@ -13,6 +13,15 @@ path = "main.rs"
test = false test = false
bench = false bench = false
[target.'cfg(windows)'.build-dependencies]
winres = "0.1"
[package.metadata.winres]
FileDescription = "Servo"
LegalCopyright = "© The Servo Project Developers"
OriginalFilename = "servo.exe"
ProductName = "Servo"
[features] [features]
default = ["unstable", "default-except-unstable"] default = ["unstable", "default-except-unstable"]
default-except-unstable = ["webdriver", "max_log_level"] default-except-unstable = ["webdriver", "max_log_level"]

View file

@ -2,6 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[cfg(windows)]
extern crate winres;
use std::env; use std::env;
use std::path::Path; use std::path::Path;
use std::process; use std::process;
@ -13,6 +16,14 @@ fn main() {
if target.contains("android") { if target.contains("android") {
android_main() android_main()
} }
#[cfg(windows)]
{
let mut res = winres::WindowsResource::new();
res.set_icon("../../resources/Servo.ico");
res.set_manifest_file("platform/windows/servo.exe.manifest");
res.compile().unwrap();
}
} }
fn android_main() { fn android_main() {

View file

@ -17,8 +17,7 @@
<asmv3:application> <asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware> <dpiAware>true</dpiAware>
</asmv3:windowsSettings> </asmv3:windowsSettings>
</asmv3:application> </asmv3:application>
</assembly> </assembly>

View file

@ -354,9 +354,6 @@ class MachCommands(CommandBase):
if status == 0: if status == 0:
if sys.platform == "win32": if sys.platform == "win32":
servo_exe_dir = path.join(base_path, "debug" if dev else "release") servo_exe_dir = path.join(base_path, "debug" if dev else "release")
# On windows, copy in our manifest
shutil.copy(path.join(self.get_top_dir(), "components", "servo", "servo.exe.manifest"),
servo_exe_dir)
msvc_x64 = "64" if "x86_64" in (target or host_triple()) else "" msvc_x64 = "64" if "x86_64" in (target or host_triple()) else ""
# on msvc builds, use editbin to change the subsystem to windows, but only # on msvc builds, use editbin to change the subsystem to windows, but only

View file

@ -317,7 +317,6 @@ class PackageCommands(CommandBase):
dir_to_resources = path.join(dir_to_temp_servo, 'resources') dir_to_resources = path.join(dir_to_temp_servo, 'resources')
shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources) shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources)
shutil.copy(binary_path, dir_to_temp_servo) shutil.copy(binary_path, dir_to_temp_servo)
shutil.copy("{}.manifest".format(binary_path), dir_to_temp_servo)
copy_windows_dependencies(target_dir, dir_to_temp_servo) copy_windows_dependencies(target_dir, dir_to_temp_servo)
change_prefs(dir_to_resources, "windows") change_prefs(dir_to_resources, "windows")

View file

@ -36,8 +36,7 @@
Directory="ProgramMenuDir" Directory="ProgramMenuDir"
Name="Servo Tech Demo" Name="Servo Tech Demo"
WorkingDirectory="INSTALLDIR" WorkingDirectory="INSTALLDIR"
Icon="Servo.ico" Icon="servo.exe"
IconIndex="0"
Advertise="yes"/> Advertise="yes"/>
</File> </File>
${include_dependencies()} ${include_dependencies()}
@ -70,7 +69,7 @@
<ComponentRef Id="ProgramMenuDir"/> <ComponentRef Id="ProgramMenuDir"/>
</Feature> </Feature>
<Icon Id="Servo.ico" SourceFile="${windowize(resources_path)}\Servo.ico"/> <Icon Id="servo.exe" SourceFile="${windowize(exe_path)}\servo.exe"/>
</Product> </Product>
</Wix> </Wix>
<%! <%!