add windows build process

This commit is contained in:
Crispy 2024-12-21 19:01:42 +01:00
parent 6900dadd9e
commit da12e8519e
3 changed files with 25 additions and 7 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/target
/user
*.zip
version.txt

View file

@ -1,11 +1,22 @@
release_name = marble_machinations
bin_name = marble2
VERSION = `cat version.txt`
RELEASE_DIRNAME = marble_machinations_${VERSION}
BIN_NAME = marble-machinations
TARGET_W64 = x86_64-pc-windows-gnu
linux:
cargo build --release
mkdir ${release_name}
cp target/release/${bin_name} ${release_name}/
cp -r assets levels ${release_name}/
zip -r ${release_name}_linux.zip ${release_name}/
rm -rf ${release_name}
mkdir ${RELEASE_DIRNAME}
cp target/release/${BIN_NAME} ${RELEASE_DIRNAME}/
cp -r assets levels ${RELEASE_DIRNAME}/
zip -r ${RELEASE_DIRNAME}_linux.zip ${RELEASE_DIRNAME}/
rm -rf ${RELEASE_DIRNAME}
windows:
cargo build --release --target=${TARGET_W64}
mkdir ${RELEASE_DIRNAME}_win
cp target/${TARGET_W64}/release/${BIN_NAME}.exe ${RELEASE_DIRNAME}_win/
cp -r assets levels ${RELEASE_DIRNAME}_win/
zip -r ${RELEASE_DIRNAME}_win.zip ${RELEASE_DIRNAME}_win/
rm -rf ${RELEASE_DIRNAME}_win

6
build.rs Normal file
View file

@ -0,0 +1,6 @@
use std::{fs::File, io::Write};
fn main(){
let version = concat!("v", env!("CARGO_PKG_VERSION"));
File::create("version.txt").unwrap().write_all(version.as_bytes()).unwrap();
}