Skip to content

Commit 1fc0ada

Browse files
author
Dennis Waldherr
committed
chore: Updated readme, check for windows target on build
1 parent f79976d commit 1fc0ada

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,43 @@ You may want to join the [SSCAIT Discord](https://discord.gg/frDVAwk), which is
1313
For more information on Starcraft AI development, you can visit the [SSCAIT website](http://www.sscaitournament.com/). There should be enough information to get you started.
1414

1515
If you have any questions or feedback, feel free to create an issue on the `rsbwapi` GitHub repository.
16+
17+
# Usage
18+
19+
## Windows
20+
You should be fine to just compile your bot. The resulting x64 executable should run fine in all current tournaments/ladders.
21+
22+
## Linux
23+
Note: These instructions will create a 32-bit executable. There are no 32-bit tournaments and the result is not a DLL, so you can choose to create a 64-bit executable.
24+
25+
### Windows-GNU target
26+
Install support for the target:
27+
```
28+
rustup target add i686-pc-windows-gnu
29+
```
30+
31+
Create the file '.cargo/config.toml':
32+
```toml
33+
[build]
34+
target="i686-pc-windows-gnu"
35+
```
36+
37+
### Windows MSVC target
38+
Follow the installation instructions for xwin: https://github.com/rust-cross/cargo-xwin
39+
40+
Create the file '.cargo/config.toml':
41+
```toml
42+
[build]
43+
target="i686-pc-windows-msvc"
44+
45+
[target.i686-pc-windows-msvc]
46+
linker = "lld"
47+
rustflags = [
48+
"-Lnative=/home/<youruser>/.xwin/crt/lib/x86",
49+
"-Lnative=/home/<youruser/.xwin/sdk/lib/um/x86",
50+
"-Lnative=/home/<youruser/.xwin/sdk/lib/ucrt/x86"
51+
]
52+
53+
54+
## Mac
55+
It should work the same way as with Linux - but it's untested.

bwapi_wrapper/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ impl ParseCallbacks for FromPrimitiveDerive {
1919
}
2020

2121
fn main() {
22+
if env::var("CARGO_CFG_TARGET_OS").unwrap() != "windows" {
23+
panic!(
24+
"RSBWAPI does not yet support targeting OpenBW, please compile with a Windows target."
25+
);
26+
}
2227
println!("cargo::rerun-if-changed=bwapi");
2328

2429
// The bindgen::Builder is the main entry point

0 commit comments

Comments
 (0)