-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from serpilliere/add_winres
Add windows binaries properties
- Loading branch information
Showing
5 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "sanzu" | ||
version = "0.1.0" | ||
version = "0.1.1" | ||
authors = ["Fabrice Desclaux <[email protected]>"] | ||
edition = "2018" | ||
readme = "README.md" | ||
|
@@ -10,6 +10,7 @@ license = "GPL-3.0" | |
[build-dependencies] | ||
bindgen = "0.63" | ||
cc = "1.0" | ||
winres = {git = "https://github.com/serpilliere/winres", branch="link_resources"} | ||
|
||
[dependencies] | ||
anyhow = "1.0" | ||
|
@@ -108,6 +109,9 @@ assets = [ | |
{ source = "README.md", dest = "/usr/share/doc/sanzu/README", mode = "0644", doc = true }, | ||
] | ||
|
||
[package.metadata.winres] | ||
LegalCopyright = "Copyright © 2021-2023" | ||
FileDescription = "Sanzu video server, proxy and client" | ||
|
||
# Compilation for Windows: | ||
# export PKG_CONFIG_ALLOW_CROSS=1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
extern crate winres; | ||
|
||
fn main() { | ||
// only run if target os is windows | ||
if std::env::var("CARGO_CFG_TARGET_OS").unwrap() != "windows" { | ||
return; | ||
} | ||
// only build the resource for release builds | ||
// as calling rc.exe might be slow | ||
if std::env::var("PROFILE").unwrap() == "release" { | ||
let mut res = winres::WindowsResource::new(); | ||
if cfg!(unix) { | ||
// paths for X64 on archlinux | ||
res.set_toolkit_path("/usr/bin"); | ||
// ar tool for mingw in toolkit path | ||
res.set_ar_path("/usr/bin/x86_64-w64-mingw32-ar"); | ||
// windres tool | ||
res.set_windres_path("/usr/bin/x86_64-w64-mingw32-windres"); | ||
} | ||
|
||
res.set_icon("data/icons/sanzu.ico") | ||
// can't use winapi crate constants for cross compiling | ||
// MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US ) | ||
.set_language(0x0409) | ||
.set_manifest_file("data/winres/manifest.xml"); | ||
if let Err(e) = res.compile() { | ||
eprintln!("{}", e); | ||
std::process::exit(1); | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!-- example.exe.manifest --> | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> | ||
<assemblyIdentity | ||
type="win32" | ||
name="Sanzu" | ||
processorArchitecture="x86" | ||
/> | ||
<description>Sanzu</description> | ||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | ||
<application> | ||
<!-- Windows 10 and Windows 11 --> | ||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> | ||
<!-- Windows 8.1 --> | ||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> | ||
<!-- Windows 8 --> | ||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> | ||
<!-- Windows 7 --> | ||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> | ||
<!-- Windows Vista --> | ||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> | ||
</application> | ||
</compatibility> | ||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
<security> | ||
<requestedPrivileges> | ||
<!-- | ||
UAC settings: | ||
- app should run at same integrity level as calling process | ||
- app does not need to manipulate windows belonging to | ||
higher-integrity-level processes | ||
--> | ||
<requestedExecutionLevel | ||
level="asInvoker" | ||
uiAccess="false" | ||
/> | ||
</requestedPrivileges> | ||
</security> | ||
</trustInfo> | ||
</assembly> |