From f7f62f00d0df2dcb47b298dcc215838153a4e9d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Beck=20K=C3=B6nig?= Date: Sun, 2 Mar 2025 12:53:26 +0100 Subject: [PATCH 1/8] dont statically link CRT on windows --- .cargo/config.toml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index ac2b23f8..00000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.x86_64-pc-windows-msvc] -rustflags = ["-C", "target-feature=+crt-static"] From 1b30ce29af013091319c4eba16aa8d693a24fccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Beck=20K=C3=B6nig?= Date: Sun, 2 Mar 2025 12:53:31 +0100 Subject: [PATCH 2/8] bump hdf5 --- crates/skytem_hdf/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/skytem_hdf/Cargo.toml b/crates/skytem_hdf/Cargo.toml index 1ef26f63..030fae0a 100644 --- a/crates/skytem_hdf/Cargo.toml +++ b/crates/skytem_hdf/Cargo.toml @@ -24,7 +24,7 @@ toml.workspace = true ndarray = "0.16.1" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -hdf5 = { package = "hdf5-metno", version = "0.9", features = ["static"] } +hdf5 = { package = "hdf5-metno", version = "0.10", features = ["static"] } [dev-dependencies] testresult.workspace = true From 584cafcea722f40dc6aa9d63c23ec9a453dbc605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Beck=20K=C3=B6nig?= Date: Sun, 2 Mar 2025 12:53:53 +0100 Subject: [PATCH 3/8] display supported hdf5 features depending on feature flag --- src/app/util.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/app/util.rs b/src/app/util.rs index 49675425..2eac47db 100644 --- a/src/app/util.rs +++ b/src/app/util.rs @@ -75,13 +75,18 @@ fn list_supported_hdf_formats(ui: &mut egui::Ui) { ui.label(RichText::new("⚠ No HDF support on web ⚠")); #[cfg(not(target_arch = "wasm32"))] { - ui.label(RichText::new("⚠ Coming soon: Bifrost TX Loop Current ⚠")); - ui.label("Loop Current measurements"); + if cfg!(feature = "hdf") { + { + ui.label("Loop Current measurements"); - ui.add(Hyperlink::from_label_and_url( - "https://github.com/luftkode/bifrost-app", - "https://github.com/luftkode/bifrost-app", - )); + ui.add(Hyperlink::from_label_and_url( + "https://github.com/luftkode/bifrost-app", + "https://github.com/luftkode/bifrost-app", + )); + } + } else { + ui.label(RichText::new("⚠ Coming soon: Bifrost TX Loop Current ⚠")); + } ui.end_row(); } } From 0c82c315c579a68c58cbc8b6dd9b7e1ec6905ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Beck=20K=C3=B6nig?= Date: Sun, 2 Mar 2025 12:54:00 +0100 Subject: [PATCH 4/8] enable hdf by default --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 03032721..f01a9ed4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1803,9 +1803,9 @@ dependencies = [ [[package]] name = "hdf5-metno" -version = "0.9.4" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c9b4d0d095403ced0b9d8b727c55212f1d09526944d84b8d3dca02ee3c0a82" +checksum = "72f8592329337a96c802cccdbd11fe5f9476cb940d5a88dcca729a2ecf82e1c9" dependencies = [ "bitflags 2.8.0", "cfg-if", diff --git a/Cargo.toml b/Cargo.toml index 88acfd0e..3476ecde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -104,7 +104,7 @@ web-sys = "0.3.70" elevated-command.workspace = true [features] -default = ["selfupdater"] +default = ["selfupdater", "hdf"] hdf = ["dep:skytem_hdf"] selfupdater = ["dep:axoupdater"] profiling = ["dep:profiling", "dep:puffin", "dep:puffin_http"] From c9f514caf69025d2645a0bbf22e7a741a0e7d9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Beck=20K=C3=B6nig?= Date: Sun, 2 Mar 2025 13:06:30 +0100 Subject: [PATCH 5/8] explicitly avoid linking crt on windows --- .cargo/config.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..2cd7be02 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "target-feature=-crt-static"] From 7faea9022dda6311a234a78f842b142e00965ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Beck=20K=C3=B6nig?= Date: Sun, 2 Mar 2025 13:40:54 +0100 Subject: [PATCH 6/8] use workaround --- .github/workflows/release.yml | 2 ++ .github/workflows/windows-build-workaround.yml | 8 ++++++++ dist-workspace.toml | 1 + 3 files changed, 11 insertions(+) create mode 100644 .github/workflows/windows-build-workaround.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d17ef807..2be64da2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,6 +125,8 @@ jobs: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y echo "$HOME/.cargo/bin" >> $GITHUB_PATH fi + - name: "Update RUSTFLAGS with -Ctarget-feature=-crt-static" + run: "echo RUSTFLAGS=\"$RUSTFLAGS -Ctarget-feature=-crt-static\" >> \"$GITHUB_ENV\"" - uses: swatinem/rust-cache@v2 with: key: ${{ join(matrix.targets, '-') }} diff --git a/.github/workflows/windows-build-workaround.yml b/.github/workflows/windows-build-workaround.yml new file mode 100644 index 00000000..b7f1d487 --- /dev/null +++ b/.github/workflows/windows-build-workaround.yml @@ -0,0 +1,8 @@ +# A workaround for +# https://github.com/axodotdev/cargo-dist/issues/1571 +# using +# https://opensource.axo.dev/cargo-dist/book/ci/customizing.html#customizing-build-setup + + +- name: Update RUSTFLAGS with -Ctarget-feature=-crt-static + run: echo RUSTFLAGS="$RUSTFLAGS -Ctarget-feature=-crt-static" >> "$GITHUB_ENV" diff --git a/dist-workspace.toml b/dist-workspace.toml index 5e546cfb..aececcc7 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -17,3 +17,4 @@ install-path = "CARGO_HOME" install-updater = false # Which actions to run on pull requests pr-run-mode = "upload" +github-build-setup = "windows-build-workaround.yml" From 26efbb3bfe9cd9a0f8f34879b5cd34fad0078f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Beck=20K=C3=B6nig?= Date: Sun, 2 Mar 2025 13:52:03 +0100 Subject: [PATCH 7/8] use dist key --- .cargo/config.toml | 1 + .github/workflows/windows-build-workaround.yml | 8 -------- dist-workspace.toml | 3 ++- 3 files changed, 3 insertions(+), 9 deletions(-) delete mode 100644 .github/workflows/windows-build-workaround.yml diff --git a/.cargo/config.toml b/.cargo/config.toml index 2cd7be02..4adc5aa8 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,3 @@ +# If we link MSVC CRT statically then it conflicts with HDF5's MSVC CRT [target.x86_64-pc-windows-msvc] rustflags = ["-C", "target-feature=-crt-static"] diff --git a/.github/workflows/windows-build-workaround.yml b/.github/workflows/windows-build-workaround.yml deleted file mode 100644 index b7f1d487..00000000 --- a/.github/workflows/windows-build-workaround.yml +++ /dev/null @@ -1,8 +0,0 @@ -# A workaround for -# https://github.com/axodotdev/cargo-dist/issues/1571 -# using -# https://opensource.axo.dev/cargo-dist/book/ci/customizing.html#customizing-build-setup - - -- name: Update RUSTFLAGS with -Ctarget-feature=-crt-static - run: echo RUSTFLAGS="$RUSTFLAGS -Ctarget-feature=-crt-static" >> "$GITHUB_ENV" diff --git a/dist-workspace.toml b/dist-workspace.toml index aececcc7..4dff2bd0 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -17,4 +17,5 @@ install-path = "CARGO_HOME" install-updater = false # Which actions to run on pull requests pr-run-mode = "upload" -github-build-setup = "windows-build-workaround.yml" +# If we link MSVC CRT statically then it conflicts with HDF5's MSVC CRT +msvc-crt-static = false From 6d7423d140ded9001b9ab3e5851d89e489f9df03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Beck=20K=C3=B6nig?= Date: Sun, 2 Mar 2025 13:53:00 +0100 Subject: [PATCH 8/8] dist init --- .github/workflows/release.yml | 2 -- dist-workspace.toml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2be64da2..d17ef807 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,8 +125,6 @@ jobs: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y echo "$HOME/.cargo/bin" >> $GITHUB_PATH fi - - name: "Update RUSTFLAGS with -Ctarget-feature=-crt-static" - run: "echo RUSTFLAGS=\"$RUSTFLAGS -Ctarget-feature=-crt-static\" >> \"$GITHUB_ENV\"" - uses: swatinem/rust-cache@v2 with: key: ${{ join(matrix.targets, '-') }} diff --git a/dist-workspace.toml b/dist-workspace.toml index 4dff2bd0..421801f8 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -17,5 +17,5 @@ install-path = "CARGO_HOME" install-updater = false # Which actions to run on pull requests pr-run-mode = "upload" -# If we link MSVC CRT statically then it conflicts with HDF5's MSVC CRT +# Whether +crt-static should be used on msvc msvc-crt-static = false