From 7b582e920d0738be9dcd0f6430f454463764a56f Mon Sep 17 00:00:00 2001 From: Xtr126 Date: Tue, 28 Nov 2023 17:16:05 +0530 Subject: [PATCH] fix: windows build --- .github/workflows/tauri.yml | 6 +++++- src-tauri/.cargo/config.toml | 7 +++++++ src-tauri/src/qemu_install.rs | 15 +++++++++------ 3 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 src-tauri/.cargo/config.toml diff --git a/.github/workflows/tauri.yml b/.github/workflows/tauri.yml index 9745836..1477ef8 100644 --- a/.github/workflows/tauri.yml +++ b/.github/workflows/tauri.yml @@ -1,6 +1,9 @@ name: 'publish' on: workflow_dispatch: + push: + paths: + - '**.yml' jobs: publish-tauri: @@ -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: @@ -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: | diff --git a/src-tauri/.cargo/config.toml b/src-tauri/.cargo/config.toml new file mode 100644 index 0000000..51e6bce --- /dev/null +++ b/src-tauri/.cargo/config.toml @@ -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" +] diff --git a/src-tauri/src/qemu_install.rs b/src-tauri/src/qemu_install.rs index e2e4914..f4fa036 100644 --- a/src-tauri/src/qemu_install.rs +++ b/src-tauri/src/qemu_install.rs @@ -1,6 +1,4 @@ use std::path::Path; -use std::os::unix::fs::OpenOptionsExt; -use std::fs; #[tauri::command] pub fn install_qemu( @@ -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} ")) -} \ No newline at end of file +}