Skip to content

Commit

Permalink
fix: windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtr126 committed Nov 28, 2023
1 parent c25f081 commit 7b582e9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/tauri.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: 'publish'
on:
workflow_dispatch:
push:
paths:
- '**.yml'

jobs:
publish-tauri:
Expand All @@ -12,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-22.04]
platform: [ubuntu-22.04, windows-latest]

runs-on: ${{ matrix.platform }}
steps:
Expand All @@ -35,6 +38,7 @@ jobs:
run: echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV

- name: Cache vcpkg
if: matrix.platform == 'windows-latest'
uses: actions/cache@v3
with:
path: |
Expand Down
7 changes: 7 additions & 0 deletions src-tauri/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[target.x86_64-pc-windows-msvc]
linker = "lld"
rustflags = [
"-Lnative=/home/hp/.xwin/crt/lib/x86_64",
"-Lnative=/home/hp/.xwin/sdk/lib/um/x86_64",
"-Lnative=/home/hp/.xwin/sdk/lib/ucrt/x86_64"
]
15 changes: 9 additions & 6 deletions src-tauri/src/qemu_install.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::path::Path;
use std::os::unix::fs::OpenOptionsExt;
use std::fs;

#[tauri::command]
pub fn install_qemu(
Expand Down Expand Up @@ -70,10 +68,15 @@ fi
"#);

let script_path = Path::new(&install_dir).join("start_android.sh");
// make file executable
fs::OpenOptions::new().create(true).write(true).mode(0o770)
.open(script_path.clone()).unwrap();

// make script executable
#[cfg(linux)] {
let mut options = fs::OpenOptions::new();
std::os::unix::fs::OpenOptionsExt::mode(&mut options, 0o770);
options.create(true).write(true).open(script_path.clone()).unwrap();
}

std::fs::write(script_path, contents).map_err(|err| err.to_string())?;
Ok(format!("qemu script written to {install_dir}/start_android.sh
-m {memsize_mb} -smp {cpus} res: {x_res}x{y_res} -display {display_type} use-gl={use_gl} input: {device_type} {input_type} serial_console: {enable_serial_console} e2fsck: {perform_e2fsck} forwardport: {forward_port} {forward_port_no} override_sdl_videodriver: {override_sdl_videodriver} {sdl_videodriver} "))
}
}

0 comments on commit 7b582e9

Please sign in to comment.