mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 11:16:56 -04:00
M14: add Windows 7 SP1 x64 compatibility build
This commit is contained in:
1 parent
3013bbc94f
commit
58e3916e03
17 files changed
+619
-11
No files matched your search
@@ -0,0 +1,52 @@
|
||||
name: Windows 7 x64 compatibility
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- '**/*.rs'
|
||||
- '**/Cargo.toml'
|
||||
- Cargo.lock
|
||||
- vendor/windows-link/**
|
||||
- packaging/windows/windows7.ps1
|
||||
- .github/workflows/windows7.yml
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2022
|
||||
timeout-minutes: 90
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: nightly-2026-10-01
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
key: windows7-x64
|
||||
- name: Check that modern Windows backends are excluded
|
||||
shell: pwsh
|
||||
run: |
|
||||
$tree = cargo +nightly-2026-10-01 tree --locked -p vectorcraft --target x86_64-win7-windows-msvc --no-default-features --features windows7 -e normal --prefix none
|
||||
if ($LASTEXITCODE -ne 0) { throw 'dependency inspection failed' }
|
||||
if ($tree -match '^(wgpu|wgpu-core|wgpu-hal|accesskit_windows) v') { throw 'unsupported Windows backend in compatibility build' }
|
||||
- name: Build portable package
|
||||
shell: pwsh
|
||||
run: ./packaging/windows/windows7.ps1
|
||||
- name: Test Windows code paths on the build host
|
||||
shell: pwsh
|
||||
env:
|
||||
CARGO_TARGET_X86_64_WIN7_WINDOWS_MSVC_RUSTFLAGS: '-C target-feature=+crt-static'
|
||||
run: |
|
||||
cargo +nightly-2026-10-01 test -Z build-std=std,panic_unwind,test --locked --target x86_64-win7-windows-msvc --no-default-features --features vectorcraft/windows7 -p vectorcraft -p vectorcraft-cli
|
||||
if ($LASTEXITCODE -ne 0) { throw 'tests failed' }
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: vectorcraft-windows7-x64-portable
|
||||
path: dist/release/vectorcraft-windows7-x64-portable.zip
|
||||
if-no-files-found: error
|
||||
# A modern Windows runner proves compilation and host smoke tests only.
|
||||
# Run the checklist in docs/windows7.md on actual Windows 7 before claiming support.
|
||||
Generated
+1
-2
@@ -952,6 +952,7 @@ dependencies = [
|
||||
"egui-wgpu",
|
||||
"egui-winit",
|
||||
"egui_glow",
|
||||
"glow",
|
||||
"glutin",
|
||||
"glutin-winit",
|
||||
"image",
|
||||
@@ -5354,8 +5355,6 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-numerics"
|
||||
|
||||
@@ -96,3 +96,8 @@ opt-level = 1
|
||||
[profile.release]
|
||||
lto = "thin"
|
||||
codegen-units = 1
|
||||
|
||||
# windows-sys 0.61.2 imports CoTaskMemFree from a Windows 8+ DLL. This tiny
|
||||
# binding patch uses its documented Ole32 export only on the win7 target.
|
||||
[patch.crates-io]
|
||||
windows-link = { path = "vendor/windows-link" }
|
||||
@@ -67,3 +67,7 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
- windows-link 0.2.1 (vendor/windows-link), Microsoft — MIT OR Apache-2.0.
|
||||
Modified to bind CoTaskMemFree through Ole32 on the Windows 7 x64 target.
|
||||
License texts: vendor/windows-link/license-mit and license-apache-2.0.
|
||||
@@ -176,6 +176,8 @@ claude mcp add vectorcraft -- /path/to/vectorcraft-cli mcp
|
||||
|
||||
The details are in [`docs/mcp.md`](docs/mcp.md) and [`docs/control-protocol.md`](docs/control-protocol.md).
|
||||
|
||||
For the experimental 64-bit Windows 7 build, see [Windows 7 instructions](docs/windows7.md).
|
||||
|
||||
## Status
|
||||
|
||||
VectorCraft is under active development. [**ROADMAP.md**](ROADMAP.md) covers what ships today, the
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ since 2026-10-01.
|
||||
| **Bundled content:** brush, symbol, style and swatch libraries | ~30% | Ours are original and generated in code, and far fewer than Illustrator ships; brush and symbol libraries are still missing |
|
||||
| **Performance** | unverified | Multithreaded, off-thread rendering and caches are in place. The last budget run (2026-10-01, loaded machine) measured 290 ms for a 50k-path fit against a 16 ms budget. Re-run `vectorcraft-cli perf` on an idle machine |
|
||||
| **Robustness** | good, new | ~2,840 tests, property tests, no panics in shipped code (lints, the `guard` safety net, import fuzzing), Data Recovery. Missing: a corpus of real-world files, Windows/Linux/browser QA |
|
||||
| **Platforms and 1.0 polish** | ~60% | The macOS app and the web build work, and Finder opens every readable format with the macOS app (#295, #354); hybrid-graphics laptops render on the power-saving GPU by default (#306); web drops land in the document they were dropped on (#359); Windows/Linux packaging and accessibility are pending |
|
||||
| **Platforms and 1.0 polish** | ~60% | The macOS app and the web build work, and Finder opens every readable format with the macOS app (#295, #354); hybrid-graphics laptops render on the power-saving GPU by default (#306); web drops land in the document they were dropped on (#359); Windows/Linux packaging and accessibility are pending; an experimental Windows 7 x64 OpenGL build runs on a user-tested SP1/NVIDIA system, with broader runtime QA still required |
|
||||
| **Agent automation** | beyond Illustrator | Every command, gesture and dialog is drivable over MCP, the CLI and the control channel |
|
||||
|
||||
### Where we're lacking (in priority order)
|
||||
@@ -169,7 +169,7 @@ grade by behaviour against `plan/illustrator/`, not by whether a menu item exist
|
||||
| M11 | Artboards & views (artboard panel/tool, Trim View, middle-button pan, print tiling and the status bar's artboard navigator done; multiple windows, presentation polish) | 🟡 | 15–25 |
|
||||
| M12 | Advanced color & art (CMYK/ICC, separations, Gradient Mesh, Live Paint, Image Trace, Graphs) | 🟡 Gradient Mesh, Live Paint, Image Trace (12 presets, 18 ms/1k² image), Recolor Artwork, colour management (ICC, soft proofing, separations preview), Graphs (all 9 tools, Graph Data/Type, regenerate in place) done; graph Design/Column/Marker designs pending | 6–10 |
|
||||
| M13 | Automation (Actions ✅ record/playback, persisted; variables, scripting, batch) | 🟡 | 18–27 |
|
||||
| M14 | 1.0 polish (preferences, shortcut editor, workspaces, accessibility, packaging for all OSes) | 🟡 Preferences, shortcut editor (chords with Shift and a punctuation key fire as typed), workspaces, a custom title bar on Windows/Linux with a Home button, content-sized dialogs and menus that scroll when longer than the window done; accessibility, Windows/Linux packaging pending | 18–28 |
|
||||
| M14 | 1.0 polish (preferences, shortcut editor, workspaces, accessibility, packaging for all OSes) | 🟡 Preferences, shortcut editor (chords with Shift and a punctuation key fire as typed), workspaces, a custom title bar on Windows/Linux with a Home button, content-sized dialogs and menus that scroll when longer than the window done; experimental Windows 7 x64 portable OpenGL build with a user-confirmed SP1/NVIDIA launch; accessibility and broader Windows/Linux packaging/QA pending | 18–28 |
|
||||
| — | Interaction fidelity pass (every tool's modifiers, Properties panel per context, isolation, nuance) | ⬜ | 60–90 |
|
||||
| — | Hardening at scale (big-file corpus, fuzzing, cross-platform + browser QA) | 🟡 | 50–80 |
|
||||
| | **Total to full parity** (one agent; re-derived from the [Parity estimate](#parity-estimate) table) | | **~320–500** |
|
||||
|
||||
@@ -9,10 +9,17 @@ default-run = "vectorcraft"
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
default = ["wgpu", "accessibility"]
|
||||
wgpu = ["eframe/wgpu"]
|
||||
accessibility = ["eframe/accesskit"]
|
||||
# Build with --no-default-features --features windows7 and the win7 Rust target.
|
||||
windows7 = ["eframe/glow"]
|
||||
|
||||
[dependencies]
|
||||
vectorcraft-engine = { workspace = true }
|
||||
vectorcraft-ui-egui = { workspace = true }
|
||||
eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "wayland", "x11"] }
|
||||
eframe = { workspace = true, features = ["default_fonts", "wayland", "x11"] }
|
||||
egui = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
log = { workspace = true }
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
//! See `vectorcraft_ui_egui::control` for the methods.
|
||||
#![cfg_attr(all(target_os = "windows", not(debug_assertions)), windows_subsystem = "windows")]
|
||||
|
||||
#[cfg(all(feature = "windows7", any(feature = "wgpu", feature = "accessibility")))]
|
||||
compile_error!("windows7 requires --no-default-features (wgpu and accessibility must be disabled)");
|
||||
#[cfg(all(windows, feature = "windows7", not(target_vendor = "win7")))]
|
||||
compile_error!("windows7 requires --target x86_64-win7-windows-msvc; the ordinary Windows target still imports newer APIs");
|
||||
#[cfg(all(target_vendor = "win7", not(feature = "windows7")))]
|
||||
compile_error!("the win7 target requires --no-default-features --features windows7");
|
||||
|
||||
mod clipboard;
|
||||
mod control_server;
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -50,9 +57,14 @@ impl eframe::App for App {
|
||||
discard_marked_text();
|
||||
}
|
||||
}
|
||||
#[cfg(not(feature = "windows7"))]
|
||||
fn on_exit(&mut self) {
|
||||
save_prefs(&self.0);
|
||||
}
|
||||
#[cfg(feature = "windows7")]
|
||||
fn on_exit(&mut self, _gl: Option<&eframe::glow::Context>) {
|
||||
save_prefs(&self.0);
|
||||
}
|
||||
}
|
||||
|
||||
/// Open files handed to the app (command line, macOS Finder and Dock) as documents. A file that
|
||||
@@ -262,6 +274,7 @@ fn app_icon() -> egui::IconData {
|
||||
/// integrated GPU of a hybrid-graphics laptop does easily, while presenting frames rendered on the
|
||||
/// discrete GPU through the integrated one made the window flicker on some laptops. With a single
|
||||
/// GPU both preferences pick it.
|
||||
#[cfg(feature = "wgpu")]
|
||||
fn power_preference(pref: Option<&str>, env: Option<eframe::wgpu::PowerPreference>) -> eframe::wgpu::PowerPreference {
|
||||
use eframe::wgpu::PowerPreference;
|
||||
match (env, pref) {
|
||||
@@ -272,6 +285,7 @@ fn power_preference(pref: Option<&str>, env: Option<eframe::wgpu::PowerPreferenc
|
||||
}
|
||||
|
||||
/// "name (backend, kind)" of the adapter the window renders with, for Help › About and bug reports.
|
||||
#[cfg(feature = "wgpu")]
|
||||
fn adapter_summary(info: &eframe::wgpu::AdapterInfo) -> String {
|
||||
format!("{} ({:?}, {:?})", info.name.trim(), info.backend, info.device_type)
|
||||
}
|
||||
@@ -297,9 +311,11 @@ fn main() -> eframe::Result {
|
||||
}
|
||||
let saved = read_prefs();
|
||||
let saved_window = saved.as_ref().and_then(|ui| ui.window);
|
||||
#[cfg(feature = "wgpu")]
|
||||
let gpu_pref = saved.as_ref().and_then(|ui| ui.engine_prefs.get("gpuPreference")).and_then(serde_json::Value::as_str);
|
||||
#[cfg(feature = "wgpu")]
|
||||
let power = power_preference(gpu_pref, eframe::wgpu::PowerPreference::from_env());
|
||||
let mut options = eframe::NativeOptions {
|
||||
let options = eframe::NativeOptions {
|
||||
viewport: egui::ViewportBuilder::default()
|
||||
.with_title("VectorCraft")
|
||||
.with_inner_size(window::DEFAULT_SIZE)
|
||||
@@ -311,11 +327,18 @@ fn main() -> eframe::Result {
|
||||
.with_title_shown(false)
|
||||
.with_icon(app_icon())
|
||||
.with_app_id("ai.storyteller.vectorcraft"),
|
||||
#[cfg(feature = "windows7")]
|
||||
renderer: eframe::Renderer::Glow,
|
||||
..Default::default()
|
||||
};
|
||||
if let eframe::egui_wgpu::WgpuSetup::CreateNew(create) = &mut options.wgpu_options.wgpu_setup {
|
||||
create.power_preference = power;
|
||||
}
|
||||
#[cfg(feature = "wgpu")]
|
||||
let options = {
|
||||
let mut options = options;
|
||||
if let eframe::egui_wgpu::WgpuSetup::CreateNew(create) = &mut options.wgpu_options.wgpu_setup {
|
||||
create.power_preference = power;
|
||||
}
|
||||
options
|
||||
};
|
||||
// Files opened from Finder and the Dock arrive as events, not arguments.
|
||||
#[cfg(target_os = "macos")]
|
||||
open_documents::install();
|
||||
@@ -340,11 +363,16 @@ fn main() -> eframe::Result {
|
||||
let recovery = prefs_path().and_then(|p| Some(p.parent()?.join("Data Recovery").to_string_lossy().to_string()));
|
||||
app.session.recovery.set_default_folder(recovery);
|
||||
}
|
||||
#[cfg(feature = "wgpu")]
|
||||
if let Some(rs) = &cc.wgpu_render_state {
|
||||
let summary = adapter_summary(&rs.adapter.get_info());
|
||||
log::info!("vectorcraft: rendering with {summary} (power preference {power:?})");
|
||||
app.graphics_adapter = Some(summary);
|
||||
}
|
||||
#[cfg(feature = "windows7")]
|
||||
{
|
||||
app.graphics_adapter = Some("OpenGL (Windows 7 compatibility)".into());
|
||||
}
|
||||
app.integrated_titlebar = cfg!(target_os = "macos");
|
||||
app.custom_titlebar = CUSTOM_TITLEBAR;
|
||||
if let Some(port) = control_port {
|
||||
@@ -363,7 +391,7 @@ fn main() -> eframe::Result {
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(test, feature = "wgpu"))]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use eframe::wgpu::PowerPreference;
|
||||
|
||||
@@ -156,6 +156,9 @@ mod system {
|
||||
}
|
||||
|
||||
pub fn printers() -> Vec<Printer> {
|
||||
#[cfg(feature = "windows7")]
|
||||
let script = "Get-WmiObject Win32_Printer | ForEach-Object { \"$($_.Default)`t$($_.Name)\" }";
|
||||
#[cfg(not(feature = "windows7"))]
|
||||
let script = "Get-CimInstance Win32_Printer | ForEach-Object { \"$($_.Default)`t$($_.Name)\" }";
|
||||
output(&mut powershell(script)).map(|t| windows_printers(&t)).unwrap_or_default()
|
||||
}
|
||||
@@ -174,7 +177,19 @@ mod system {
|
||||
}
|
||||
|
||||
pub fn setup(_printer: Option<&str>) -> Result<(), String> {
|
||||
Command::new("explorer").arg("ms-settings:printers").spawn().map(|_| ()).map_err(|e| e.to_string())
|
||||
#[cfg(feature = "windows7")]
|
||||
let mut command = {
|
||||
let mut command = Command::new("control.exe");
|
||||
command.arg("printers");
|
||||
command
|
||||
};
|
||||
#[cfg(not(feature = "windows7"))]
|
||||
let mut command = {
|
||||
let mut command = Command::new("explorer");
|
||||
command.arg("ms-settings:printers");
|
||||
command
|
||||
};
|
||||
command.spawn().map(|_| ()).map_err(|e| e.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
# Windows 7 x64 compatibility build (experimental)
|
||||
|
||||
This separate build targets **64-bit Windows 7 SP1**. It uses OpenGL instead of wgpu,
|
||||
and omits the native AccessKit accessibility adapter. Printer discovery supports the
|
||||
PowerShell version included with Windows 7, and printer setup opens Control Panel.
|
||||
The normal desktop and web builds retain their existing defaults. A vendor graphics driver providing **OpenGL 3.3 or newer**
|
||||
is required; the Windows built-in generic display driver is insufficient. GPU selection
|
||||
in Preferences and `WGPU_POWER_PREF` do not control this OpenGL build.
|
||||
|
||||
## Build or download
|
||||
|
||||
In your GitHub fork, open **Actions → Windows 7 x64 compatibility → Run workflow**.
|
||||
When it succeeds, download the `vectorcraft-windows7-x64-portable` artifact, extract the
|
||||
contained portable ZIP, then run `vectorcraft.exe` on Windows 7. The CLI is included.
|
||||
No MSI is provided: the existing installer remains for modern Windows.
|
||||
|
||||
To build locally, use a **Windows 10/11 build computer**, with Rust/rustup and Visual Studio
|
||||
2022 C++ build tools (x64 compiler and Windows SDK). Open an **x64 Native Tools Command
|
||||
Prompt for VS 2022**, change to your clone's repository root (the directory containing
|
||||
`Cargo.toml`), and run:
|
||||
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File packaging/windows/windows7.ps1
|
||||
```
|
||||
|
||||
Output: `dist/release/vectorcraft-windows7-x64-portable.zip`. The script installs the pinned
|
||||
nightly compiler and `rust-src`, rebuilds the standard library for
|
||||
`x86_64-win7-windows-msvc`, and links the C runtime statically. It never installs Rust on
|
||||
the Windows 7 machine. The optional `CRAFT_FONTS_DIR` setting works as in the normal build.
|
||||
Without it, install fonts for the languages you need on the destination machine.
|
||||
|
||||
The Windows 7 target matters: modern Rust's ordinary `x86_64-pc-windows-msvc` target
|
||||
requires Windows 10, including standard-library and random-number APIs. Selecting OpenGL
|
||||
alone or changing an installer version check cannot fix that.
|
||||
|
||||
References: [Rust's Windows 7 target](https://doc.rust-lang.org/rustc/platform-support/win7-windows-msvc.html)
|
||||
and [Windows baseline change](https://blog.rust-lang.org/2024/02/26/Windows-7/).
|
||||
|
||||
The packaging script checks x64 PE headers, the subsystem version, and known incompatible
|
||||
imports (including `GetSystemTimePreciseAsFileTime`) before creating the ZIP. This is a
|
||||
regression check, not an exhaustive audit of every Windows API.
|
||||
|
||||
The small vendored `windows-link` patch routes `CoTaskMemFree` to its documented
|
||||
`ole32.dll` export on the Windows 7 target; the newer binding otherwise imports
|
||||
`combase.dll`, which is absent on Windows 7. Other targets keep upstream behavior.
|
||||
|
||||
## Runtime validation
|
||||
|
||||
A user confirmed that the portable x64 compatibility build runs on Windows 7 SP1
|
||||
with an NVIDIA graphics card. Their original build failed at startup with
|
||||
`GetSystemTimePreciseAsFileTime` missing from `kernel32.dll`; the compatibility
|
||||
build resolved that failure. The tested build was based on upstream commit
|
||||
`1f7873273b67007b0aefc63313e0d34a39f45453`. The exact GPU/driver version and completion
|
||||
of every checklist item below were not recorded, so support remains experimental.
|
||||
|
||||
## Runtime acceptance checklist
|
||||
|
||||
A successful build on the Windows 2022 CI runner does **not** prove Windows 7 runtime
|
||||
compatibility. Before declaring support, test on a Windows 7 SP1 x64 machine and record
|
||||
its GPU, driver version, Windows updates and any missing-DLL/entry-point error:
|
||||
|
||||
- Start `vectorcraft.exe`; verify a visible canvas, resizing, minimize/restore and exit.
|
||||
- Draw a shape, save a `.vectorcraft` document, close and reopen it.
|
||||
- Open `examples/dusk-poster.vectorcraft`; export PNG and PDF and inspect both.
|
||||
- Exercise native Open/Save dialogs, clipboard text/images and drag-and-drop.
|
||||
- Change a preference, exit and verify it survives restarting.
|
||||
- Run `vectorcraft-cli.exe --version` and a headless export from a Command Prompt in the
|
||||
extracted application folder.
|
||||
|
||||
This build is experimental until that checklist passes. New dependency versions can add
|
||||
newer Windows imports, so retain Cargo.lock and repeat runtime QA after dependency updates.
|
||||
@@ -0,0 +1,65 @@
|
||||
<# Build on Windows 10/11 with the VS 2022 x64 C++ tools and Windows SDK.
|
||||
From the repository root: powershell -File packaging/windows/windows7.ps1
|
||||
The resulting portable ZIP targets Windows 7 SP1 x64 with an OpenGL 3.3 driver.
|
||||
The compiler runs on the build host, not on Windows 7. #>
|
||||
param([string] $Toolchain = 'nightly-2026-10-01')
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$Root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
|
||||
$Target = 'x86_64-win7-windows-msvc'
|
||||
function Invoke-Checked([scriptblock] $Command) {
|
||||
& $Command
|
||||
if ($LASTEXITCODE -ne 0) { throw "Command failed with exit code $LASTEXITCODE" }
|
||||
}
|
||||
Push-Location $Root
|
||||
$FlagName = 'CARGO_TARGET_X86_64_WIN7_WINDOWS_MSVC_RUSTFLAGS'
|
||||
$OldFlags = [Environment]::GetEnvironmentVariable($FlagName)
|
||||
$OldWinres = $env:VECTORCRAFT_REQUIRE_WINRES
|
||||
try {
|
||||
Invoke-Checked { rustup toolchain install $Toolchain --profile minimal --component rust-src }
|
||||
# The ordinary pc-windows-msvc standard library requires Windows 10. Rebuild std for win7.
|
||||
[Environment]::SetEnvironmentVariable($FlagName, '-C target-feature=+crt-static')
|
||||
$env:VECTORCRAFT_REQUIRE_WINRES = '1'
|
||||
$BuildArgs = @('-Z', 'build-std=std,panic_unwind', '--locked',
|
||||
'--target', $Target, '--no-default-features', '--features', 'vectorcraft/windows7',
|
||||
'-p', 'vectorcraft', '-p', 'vectorcraft-cli')
|
||||
Invoke-Checked { cargo "+$Toolchain" build @BuildArgs --release }
|
||||
$TargetDir = if ($env:CARGO_TARGET_DIR) { $env:CARGO_TARGET_DIR } else { 'target' }
|
||||
$Bin = Join-Path $TargetDir "$Target\release"
|
||||
foreach ($Name in 'vectorcraft.exe', 'vectorcraft-cli.exe') {
|
||||
$Exe = Join-Path $Bin $Name
|
||||
$Bytes = [IO.File]::ReadAllBytes($Exe)
|
||||
$Pe = [BitConverter]::ToInt32($Bytes, 0x3c)
|
||||
if ([BitConverter]::ToUInt16($Bytes, $Pe + 4) -ne 0x8664) { throw "$Name is not x64" }
|
||||
$Major = [BitConverter]::ToUInt16($Bytes, $Pe + 0x48)
|
||||
$Minor = [BitConverter]::ToUInt16($Bytes, $Pe + 0x4a)
|
||||
if ($Major -gt 6 -or ($Major -eq 6 -and $Minor -gt 1)) { throw "$Name requires subsystem $Major.$Minor" }
|
||||
$Imports = & dumpbin /nologo /imports $Exe
|
||||
if ($LASTEXITCODE -ne 0) { throw "Could not inspect $Name imports" }
|
||||
# Regression gate for known loader failures; actual Win7 runtime QA remains necessary.
|
||||
if ($Imports -match '(?i)\b(GetSystemTimePreciseAsFileTime|ProcessPrng|WaitOnAddress|WakeByAddressSingle|WakeByAddressAll)\b|combase\.dll|bcryptprimitives\.dll|d3d12\.dll|api-ms-win-core-path-') {
|
||||
throw "$Name directly imports a known post-Windows-7 API"
|
||||
}
|
||||
}
|
||||
Invoke-Checked { & (Join-Path $Bin 'vectorcraft-cli.exe') --version }
|
||||
$Stage = Join-Path $TargetDir ('windows7-portable-' + [Guid]::NewGuid().ToString('N'))
|
||||
New-Item -ItemType Directory -Force $Stage | Out-Null
|
||||
Copy-Item (Join-Path $Bin 'vectorcraft.exe'), (Join-Path $Bin 'vectorcraft-cli.exe') $Stage
|
||||
Copy-Item LICENSE-MIT, LICENSE-APACHE, NOTICE $Stage
|
||||
Copy-Item vendor/windows-link/license-mit (Join-Path $Stage 'LICENSE-windows-link-MIT')
|
||||
Copy-Item vendor/windows-link/license-apache-2.0 (Join-Path $Stage 'LICENSE-windows-link-Apache-2.0')
|
||||
Copy-Item docs/windows7.md (Join-Path $Stage 'WINDOWS7.md')
|
||||
if ($env:CRAFT_FONTS_DIR) {
|
||||
foreach ($ofl in Get-ChildItem (Join-Path $env:CRAFT_FONTS_DIR 'fonts\*\OFL.txt')) {
|
||||
Copy-Item $ofl.FullName (Join-Path $Stage "OFL-$($ofl.Directory.Name).txt")
|
||||
}
|
||||
}
|
||||
New-Item -ItemType Directory -Force dist/release | Out-Null
|
||||
$Zip = Join-Path $Root 'dist/release/vectorcraft-windows7-x64-portable.zip'
|
||||
Compress-Archive -Path (Join-Path $Stage '*') -DestinationPath $Zip -Force
|
||||
Remove-Item -Recurse -Force $Stage
|
||||
Get-Item $Zip
|
||||
} finally {
|
||||
[Environment]::SetEnvironmentVariable($FlagName, $OldFlags)
|
||||
$env:VECTORCRAFT_REQUIRE_WINRES = $OldWinres
|
||||
Pop-Location
|
||||
}
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you are reading this file be aware that the original Cargo.toml
|
||||
# will likely look very different (and much more reasonable).
|
||||
# See Cargo.toml.orig for the original contents.
|
||||
|
||||
[package]
|
||||
edition = "2021"
|
||||
rust-version = "1.71"
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
build = false
|
||||
autolib = false
|
||||
autobins = false
|
||||
autoexamples = false
|
||||
autotests = false
|
||||
autobenches = false
|
||||
description = "Linking for Windows"
|
||||
readme = "readme.md"
|
||||
categories = ["os::windows-apis"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/microsoft/windows-rs"
|
||||
|
||||
[lib]
|
||||
name = "windows_link"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[lints.rust]
|
||||
missing_unsafe_on_extern = "warn"
|
||||
|
||||
[lints.rust.unexpected_cfgs]
|
||||
level = "warn"
|
||||
priority = 0
|
||||
check-cfg = ["cfg(windows_raw_dylib, windows_slim_errors)"]
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
# Windows 7 x64 import compatibility
|
||||
|
||||
Upstream: Microsoft windows-link 0.2.1, from crates.io, MIT OR Apache-2.0.
|
||||
Source: https://crates.io/crates/windows-link/0.2.1
|
||||
The original license texts are retained here.
|
||||
|
||||
Only the non-x86 win7-target macro differs: CoTaskMemFree is imported from
|
||||
ole32.dll rather than combase.dll. windows-sys 0.61.2 otherwise causes native
|
||||
file dialogs to introduce a DLL absent on Windows 7. Ordinary targets retain
|
||||
upstream behavior. This is a binding correction, not a replacement allocator.
|
||||
|
||||
Microsoft documents Ole32.dll and Windows 2000 as the API's minimum:
|
||||
https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-cotaskmemfree
|
||||
|
||||
The Windows 7 packaging check rejects combase.dll to guard this fix. Remove this
|
||||
patch when upstream bindings provide the same compatibility and recheck imports.
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
## Linking for Windows
|
||||
|
||||
The [windows-link](https://crates.io/crates/windows-link) crate provides the `link` macro that simplifies linking. The `link` macro is much the same as the one provided by [windows-targets](https://crates.io/crates/windows-targets) but uses `raw-dylib` and thus does not require import lib files.
|
||||
|
||||
* [Getting started](https://kennykerr.ca/rust-getting-started/)
|
||||
* [Samples](https://github.com/microsoft/windows-rs/tree/master/crates/samples)
|
||||
* [Releases](https://github.com/microsoft/windows-rs/releases)
|
||||
|
||||
Start by adding the following to your Cargo.toml file:
|
||||
|
||||
```toml
|
||||
[dependencies.windows-link]
|
||||
version = "0.2"
|
||||
```
|
||||
|
||||
Use the `link` macro to define the external functions you wish to call:
|
||||
|
||||
```rust
|
||||
windows_link::link!("kernel32.dll" "system" fn SetLastError(code: u32));
|
||||
windows_link::link!("kernel32.dll" "system" fn GetLastError() -> u32);
|
||||
|
||||
unsafe {
|
||||
SetLastError(1234);
|
||||
assert_eq!(GetLastError(), 1234);
|
||||
}
|
||||
```
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
#![doc = include_str!("../readme.md")]
|
||||
#![no_std]
|
||||
|
||||
/// Defines an external function to import.
|
||||
#[cfg(all(windows, target_arch = "x86"))]
|
||||
#[macro_export]
|
||||
macro_rules! link {
|
||||
($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => (
|
||||
#[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim", import_name_type = "undecorated")]
|
||||
extern $abi {
|
||||
$(#[link_name=$link_name])?
|
||||
pub fn $($function)*;
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/// Defines an external function to import.
|
||||
#[cfg(all(windows, not(target_arch = "x86"), not(target_vendor = "win7")))]
|
||||
#[macro_export]
|
||||
macro_rules! link {
|
||||
($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => (
|
||||
#[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim")]
|
||||
extern $abi {
|
||||
$(#[link_name=$link_name])?
|
||||
pub fn $($function)*;
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/// Defines an external function to import.
|
||||
#[cfg(not(windows))]
|
||||
#[macro_export]
|
||||
macro_rules! link {
|
||||
($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => (
|
||||
extern $abi {
|
||||
pub fn $($function)*;
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// VectorCraft compatibility patch: windows-sys 0.61.2 binds CoTaskMemFree to
|
||||
// combase.dll (Windows 8+). The same API is exported by ole32.dll on Windows 7.
|
||||
// Redirect only this known API; leave every other binding unchanged.
|
||||
#[cfg(all(windows, not(target_arch = "x86"), target_vendor = "win7"))]
|
||||
#[macro_export]
|
||||
macro_rules! link {
|
||||
("combase.dll" $abi:literal fn CoTaskMemFree $($signature:tt)*) => (
|
||||
$crate::link!("ole32.dll" $abi fn CoTaskMemFree $($signature)*);
|
||||
);
|
||||
($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => (
|
||||
#[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim")]
|
||||
extern $abi {
|
||||
$(#[link_name=$link_name])?
|
||||
pub fn $($function)*;
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user