Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

move static knf thing to build rs

Louis Beaumont9311580a583f
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index 3fbff3e9f..e59158141 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -256,10 +256,6 @@ jobs:
export PKG_CONFIG_ALLOW_CROSS=1
export RUSTFLAGS="-C link-arg=-Wl,-rpath,@executable_path/../Frameworks -C link-arg=-Wl,-rpath,@loader_path/../Frameworks -C link-arg=-Wl,-install_name,@rpath/libscreenpipe.dylib"
fi
- if [[ "${{ matrix.args }}" == "--target x86_64-pc-windows-msvc" ]]; then
- export RUSTFLAGS="-C target-feature=+crt-static"
- export KNF_STATIC_CRT="1"
- fi
cargo build --release -p screenpipe-server ${{ matrix.args }}
# Run pre build again to copy the CLI into app
diff --git a/screenpipe-audio/build.rs b/screenpipe-audio/build.rs
index aa55e7227..73d774033 100644
--- a/screenpipe-audio/build.rs
+++ b/screenpipe-audio/build.rs
@@ -1,13 +1,20 @@
#[cfg(target_os = "windows")]
-use std::{io, fs, process::Command};
+use std::{env, fs, io, process::Command};
fn main() {
#[cfg(target_os = "windows")]
{
+ // Set static CRT for Windows MSVC target
+ if env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default() == "msvc" {
+ println!("cargo:rustc-env=KNF_STATIC_CRT=1");
+ println!("cargo:rustc-flag=-C target-feature=+crt-static");
+ }
+
let url = "https://github.com/microsoft/onnxruntime/releases/download/v1.19.2/onnxruntime-win-x64-gpu-1.19.2.zip";
let resp = reqwest::blocking::get(url).expect("request failed");
let body = resp.text().expect("body invalid");
- let mut out = fs::File::create("onnxruntime-win-x64-gpu-1.19.2.zip").expect("failed to create file");
+ let mut out =
+ fs::File::create("onnxruntime-win-x64-gpu-1.19.2.zip").expect("failed to create file");
io::copy(&mut body.as_bytes(), &mut out).expect("failed to copy content");
let status = Command::new("unzip")
.args(["onnxruntime-win-x64-gpu-1.19.2.zip"])
@@ -16,7 +23,9 @@ fn main() {
if !status.success() {
panic!("failed to install onnx binary");
}
- fs::rename("onnxruntime-win-x64-gpu-1.19.2",
- "../screenpipe-app-tauri/src-tauri/onnxruntime-win-x64-gpu-1.19.2");
+ fs::rename(
+ "onnxruntime-win-x64-gpu-1.19.2",
+ "../screenpipe-app-tauri/src-tauri/onnxruntime-win-x64-gpu-1.19.2",
+ );
}
}