diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 74d946f01..29521ad73 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,6 +37,45 @@ debugger session use the `dev-full` profile, which is the same build with full d cargo run --profile dev-full -p effectcraft -- --demo ``` +### Windows + +The MSVC toolchain, rustup's default on Windows, is what the releases use: with the Visual Studio +C++ build tools installed, the commands above work as they are. + +The GNU toolchain (`x86_64-pc-windows-gnu`) needs a current mingw-w64 GCC and binutils first on +`PATH`. They provide the linker and the Windows import libraries, such as `libshlwapi.a` for +opening links from the app. With MSYS2: + +```powershell +C:\msys64\usr\bin\pacman.exe -S --needed mingw-w64-x86_64-gcc +$env:PATH = "C:\msys64\mingw64\bin;$env:PATH" +cargo +stable-x86_64-pc-windows-gnu run -p effectcraft -- --demo +``` + +An older MinGW earlier on `PATH` can break the build: CodeBlocks' GCC 8.1 fails to link +`boa_engine` ([#1882](https://github.com/storytold/effectcraft/issues/1882)). + +Rust's bundled LLD and self-contained libraries don't include every import library EffectCraft +needs, so on their own they stop with `unable to find library` for `-lshlwapi`, `-lktmw32`, +`-lpropsys` and `-lversion` ([#1886](https://github.com/storytold/effectcraft/issues/1886)). To +link that way, copy those four from mingw-w64 into a folder of its own and add that folder to the +search path in your own Cargo config (`%USERPROFILE%\.cargo\config.toml`). Don't add all of +mingw-w64's `lib` folder: its C runtime clashes with Rust's bundled one +(`undefined symbol: DllEntryPoint`). + +```powershell +New-Item -ItemType Directory -Force C:\gnu-import-libs +foreach ($lib in "shlwapi", "ktmw32", "propsys", "version") { + Copy-Item "C:\msys64\mingw64\lib\lib$lib.a" C:\gnu-import-libs\ +} +``` + +```toml +[target.x86_64-pc-windows-gnu] +linker = "rust-lld" +rustflags = ["-C", "link-self-contained=yes", "-L", "native=C:/gnu-import-libs"] +``` + ## Ground rules - **Clean room.** Work from After Effects' public documentation and its observable behaviour only.