Skip to content

Commit d09e89a

Browse files
committed
split uwp and desktop
1 parent 30a69a4 commit d09e89a

20 files changed

+366
-95
lines changed

AppxManifest.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp build" xmlns:build="http://schemas.microsoft.com/developer/appx/2015/build">
3+
<Identity Name="748880FC-7B08-4BC5-B0C1-35FA863C53C8" Publisher="CN=25C90434-4343-4A2A-BB16-CF3209256BD3" Version="0.0.1.0" ProcessorArchitecture="x64" />
4+
<mp:PhoneIdentity PhoneProductId="748880FC-7B08-4BC5-B0C1-35FA863C53C8" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
5+
<Properties>
6+
<DisplayName>Minesweeper-rs</DisplayName>
7+
<PublisherDisplayName>robmi</PublisherDisplayName>
8+
<Logo>assets\StoreLogo.png</Logo>
9+
</Properties>
10+
<Dependencies>
11+
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17134.0" MaxVersionTested="10.0.18362.0" />
12+
<PackageDependency Name="Microsoft.VCLibs.140.00" MinVersion="14.0.27810.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
13+
</Dependencies>
14+
<Resources>
15+
<Resource Language="EN-US" />
16+
</Resources>
17+
<Applications>
18+
<Application Id="App" Executable="target\x86_64-uwp-windows-msvc\debug\minesweeper-rs.exe" EntryPoint="Minesweeper.App">
19+
<uap:VisualElements DisplayName="minesweeper-rs" Description="A port of robmikh/Minesweeper using winrt-rs." Square44x44Logo="assets\Square44x44Logo.png" Square150x150Logo="assets\Square150x150Logo.png" BackgroundColor="transparent">
20+
<uap:DefaultTile Wide310x150Logo="assets\Wide310x150Logo.png"></uap:DefaultTile>
21+
<uap:SplashScreen Image="assets\SplashScreen.png" />
22+
</uap:VisualElements>
23+
</Application>
24+
</Applications>
25+
<Capabilities>
26+
</Capabilities>
27+
</Package>

Cargo.lock

Lines changed: 24 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ edition = "2018"
77
[dependencies]
88
windows = "0.18.0"
99
bindings = { path = "bindings" }
10+
rand = "0.8.3"
11+
12+
[target.'cfg(target_vendor = "pc")'.dependencies]
1013
winit = "0.24.0"
1114
raw-window-handle = "0.3.3"
12-
rand = "0.8.3"
1315

1416
[features]
1517
show-mines = []

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,25 @@
22
A port of [robmikh/Minesweeper](https://github.com/robmikh/Minesweeper) using [windows-rs](https://github.com/microsoft/windows-rs).
33

44
## Running
5-
Running this sample requires at least Windows build 1803 (v10.0.17134.0). To compile and run (after setting up), use:
5+
Running this sample requires at least Windows build 1803 (v10.0.17134.0). Instructions are a little different between desktop and UWP:
6+
7+
### Desktop
8+
Running Minesweeper as a normal desktop application can be done as follows:
69

710
```
811
cargo run --release
912
```
1013

14+
### UWP
15+
16+
Running Minesweeper as a UWP application can be done by building for a `*-uwp-windows-msvc` target and then registering the app. More information can be found [here](UWP.md).
17+
18+
```
19+
cargo +nightly build -Z build-std=std,panic_abort --target x86_64-uwp-windows-msvc
20+
(powershell.exe) Add-AppxPackage -Register AppxManifest.xml
21+
```
22+
*NOTE: AppManifest.xml currently assumes the `x86_64-uwp-windows-msvc` target but can be updated.*
23+
24+
Then launch minesweeper-rs from the Start Menu.
25+
1126
![minesweeper-opt2](https://user-images.githubusercontent.com/7089228/80656536-45ac2c80-8a36-11ea-8521-ab40fc922ce1.gif)

UWP.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Building for `*-uwp-windows-msvc` targets
2+
3+
## Required tools
4+
First, you'll need to install the nightly toolchain:
5+
6+
```
7+
rustup toolchain install nightly
8+
rustup component add rust-src
9+
```
10+
11+
I'm using version `1.50.0-nightly (1c389ffef 2020-11-24)`. If you already have a nightly toolchain installed and you're seeing an error about `SetThreadStackGuarantee`, update your nightly toolchain.
12+
13+
## Building Minesweeper
14+
From the appropriate VS command prompt (e.g. "x64 Native Tools Command Prompt for VS 2019" when building for x86_64), run cargo but target a uwp target:
15+
16+
```
17+
cargo +nightly build -Z build-std=std,panic_abort --target x86_64-uwp-windows-msvc
18+
```
19+
20+
After that, you should be able to register your application:
21+
22+
```
23+
(powershell.exe) Add-AppxPackage -Register AppxManifest.xml
24+
```
25+
26+
Special thanks to [bdbai](https://github.com/bdbai) for the [firstuwp-rs](https://github.com/bdbai/firstuwp-rs) project. Without that, I wouldn't have known about the [build-std](https://doc.rust-lang.org/cargo/reference/unstable.html#build-std) cargo feature.

assets/LockScreenLogo.png

1.15 KB
Loading

assets/SplashScreen.png

17.3 KB
Loading

assets/Square150x150Logo.png

4.35 KB
Loading

assets/Square44x44Logo.png

2.06 KB
Loading

assets/StoreLogo.png

1.2 KB
Loading

0 commit comments

Comments
 (0)