From 87782c0d735d7103870014e1d3485d8c07dfd346 Mon Sep 17 00:00:00 2001 From: Benjamin Klum Date: Thu, 5 Dec 2024 22:14:22 +0100 Subject: [PATCH] #1261 Restore Windows 7 compatibility for most parts of ReaLearn Helgobox App and the egui-based GUIs of the plug-in are still not Windows-7-compatible! --- .github/workflows/release.yml | 26 +++++++++++++------------- .github/workflows/windows-i686.yml | 2 +- .github/workflows/windows-x86_64.yml | 4 ++-- CONTRIBUTING.adoc | 2 +- Cargo.toml | 17 +++++++++++++++-- main/Cargo.toml | 2 +- main/lib/helgoboss-learn | 2 +- main/src/domain/backbone.rs | 4 +++- 8 files changed, 37 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e860eebc..446ef36bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: include: - artifact: windows-x86_64 os: windows-latest - toolchain-suffix: x86_64-pc-windows-msvc + toolchain: 1.77.2-x86_64-pc-windows-msvc lib-file-name: helgobox.dll extension-file-name: reaper_helgobox.dll target: x86_64-pc-windows-msvc @@ -24,7 +24,7 @@ jobs: features: "playtime,egui,licensing" - artifact: windows-i686 os: windows-latest - toolchain-suffix: i686-pc-windows-msvc + toolchain: 1.81.0-i686-pc-windows-msvc lib-file-name: helgobox.dll extension-file-name: reaper_helgobox.dll target: i686-pc-windows-msvc @@ -33,48 +33,48 @@ jobs: features: "egui" - artifact: macos-x86_64 os: macos-latest - toolchain-suffix: x86_64-apple-darwin + toolchain: 1.81.0-x86_64-apple-darwin lib-file-name: libhelgobox.dylib extension-file-name: libreaper_helgobox.dylib target: x86_64-apple-darwin use-cross: false - profile: release + profile: release-strip features: "playtime,egui,licensing" - artifact: macos-aarch64 os: macos-latest - toolchain-suffix: x86_64-apple-darwin + toolchain: 1.81.0-x86_64-apple-darwin lib-file-name: libhelgobox.dylib extension-file-name: libreaper_helgobox.dylib target: aarch64-apple-darwin use-cross: false - profile: release + profile: release-strip features: "playtime,egui,licensing" - artifact: linux-x86_64 os: ubuntu-20.04 - toolchain-suffix: x86_64-unknown-linux-gnu + toolchain: 1.81.0-x86_64-unknown-linux-gnu lib-file-name: libhelgobox.so extension-file-name: "not-yet-supported" target: x86_64-unknown-linux-gnu use-cross: false - profile: release + profile: release-strip features: "" # - artifact: linux-aarch64 # os: ubuntu-22.04 - # toolchain-suffix: x86_64-unknown-linux-gnu + # toolchain: 1.81.0-x86_64-unknown-linux-gnu # lib-file-name: libhelgobox.so # extension-file-name: "" # target: aarch64-unknown-linux-gnu # use-cross: true - # profile: release + # profile: release-strip # features: "" # - artifact: linux-armv7 # os: ubuntu-22.04 - # toolchain-suffix: x86_64-unknown-linux-gnu + # toolchain: 1.81.0-x86_64-unknown-linux-gnu # lib-file-name: libhelgobox.so # extension-file-name: "" # target: armv7-unknown-linux-gnueabihf # use-cross: true - # profile: release + # profile: release-strip # features: "" env: # This is relevant for macOS builds only (and only if not overridden). @@ -96,7 +96,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.81.0-${{ matrix.toolchain-suffix }} + toolchain: ${{ matrix.toolchain }} target: ${{ matrix.target }} override: true # Install OS dependencies (Linux/macOS only) diff --git a/.github/workflows/windows-i686.yml b/.github/workflows/windows-i686.yml index 387619819..435a3b8a8 100644 --- a/.github/workflows/windows-i686.yml +++ b/.github/workflows/windows-i686.yml @@ -31,7 +31,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.81.0-i686-pc-windows-msvc + toolchain: 1.77.2-i686-pc-windows-msvc target: i686-pc-windows-msvc override: true - name: cargo build diff --git a/.github/workflows/windows-x86_64.yml b/.github/workflows/windows-x86_64.yml index a8cc110d0..eae1dfe69 100644 --- a/.github/workflows/windows-x86_64.yml +++ b/.github/workflows/windows-x86_64.yml @@ -31,7 +31,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.81.0 + toolchain: 1.77.2 override: true - name: cargo check uses: actions-rs/cargo@v1 @@ -57,7 +57,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.81.0 + toolchain: 1.77.2 override: true - name: cargo build uses: actions-rs/cargo@v1 diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index 55e8e21cd..9b435b1cc 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -134,7 +134,7 @@ On Windows, it's necessary to use the MSVC (Microsoft Visual Studio C++) toolcha + [source,shell] ---- -rustup default 1.81.0-x86_64-pc-windows-msvc +rustup default 1.77.2-x86_64-pc-windows-msvc ---- . Download and install https://git-scm.com/download/win[Git for Windows] . Clone the ReaLearn Git repository diff --git a/Cargo.toml b/Cargo.toml index 37bf50c89..b7234e8a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -126,9 +126,22 @@ cached = "0.53.1" imageproc = "0.25.0" [profile.release] -# There's a long reasoning about those values in CONTRIBUTING.adoc debug = 2 -# Switching to "symbols" will reduce size even more but leads to useless stack traces when panicking + +[profile.release-strip] +inherits = "release" +# We use this profile on Linux and macOS only. On Windows, we build with older Rust version 1.77.2 +# in order to support Windows 7. This old version strips away too much due to an implementation +# error in rustc: +# +# "Prior to 1.79, this unintentionally disabled the generation of *.pdb files on MSVC, resulting +# in the absence of symbols." +# (https://doc.rust-lang.org/rustc/codegen-options/index.html#strip). +# +# Not stripping on Windows is okay because the PDB is a separate file anyway. We do the following +# mainly for macOS. There's a long reasoning about the concrete values in CONTRIBUTING.adoc. +# BTW, switching to "symbols" would reduce size even more but leads to useless stack traces when +# panicking. strip = "debuginfo" split-debuginfo = "packed" diff --git a/main/Cargo.toml b/main/Cargo.toml index 23b5e9780..010ebae5c 100644 --- a/main/Cargo.toml +++ b/main/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Benjamin Klum "] edition = "2021" build = "build.rs" license = "GPL-3.0" -rust-version = "1.81.0" +rust-version = "1.77.2" publish = false [features] diff --git a/main/lib/helgoboss-learn b/main/lib/helgoboss-learn index c9ed6d39f..259ce0a73 160000 --- a/main/lib/helgoboss-learn +++ b/main/lib/helgoboss-learn @@ -1 +1 @@ -Subproject commit c9ed6d39f8aab5a77383c6c7a29166b646cd9013 +Subproject commit 259ce0a7347accc0662a7f3c7c4c165ac373e764 diff --git a/main/src/domain/backbone.rs b/main/src/domain/backbone.rs index 9e12f0e41..abf0705eb 100644 --- a/main/src/domain/backbone.rs +++ b/main/src/domain/backbone.rs @@ -24,13 +24,15 @@ use helgobox_api::persistence::{ }; use imageproc::definitions::{HasBlack, HasWhite}; use once_cell::sync::Lazy; +// Use once_cell::sync::Lazy instead of std::sync::LazyLock in order to be able to build with Rust 1.77.2 (to stay Win7-compatible) +use once_cell::sync::Lazy as LazyLock; use palette::IntoColor; use reaper_high::{Fx, Reaper}; use std::cell::{Cell, Ref, RefCell, RefMut}; use std::cmp::min; use std::hash::Hash; use std::rc::Rc; -use std::sync::{LazyLock, RwLock}; +use std::sync::RwLock; use std::time::{Duration, Instant}; use streamdeck::StreamDeck; use strum::EnumCount;