Crusader_Decomp/docs/scummvm/visual-studio-build.md
Marco 3b2561b053 Add build scripts, documentation, and smooth camera analysis for ScummVM's Ultima VIII engine
- Introduced `build-scummvm.ps1` and `run-scummvm.ps1` scripts for building and running the ScummVM project with MSVC.
- Created `phase-0-evidence-compatibility-gate.md` to outline the evidence and compatibility gate for the Crusader project.
- Added `smooth-camera-analysis.md` detailing the proposed smooth camera behavior and regression checks.
- Documented the Visual Studio build process in `visual-studio-build.md`, including prerequisites and steps for generating the Ultima solution.
- Updated `startup-map-patch-file.md` to clarify the behavior of the fixed-map and glob archives in the GOG installation.
2026-10-09 16:59:29 +02:00

95 lines
4.4 KiB
Markdown

# ScummVM Visual Studio Build
These steps create an isolated MSVC solution for building the Ultima engine, including the Crusader camera changes. Generated project files, vcpkg packages, and binaries stay under the ignored `scummvm/build-msvc/` directory.
## Prerequisites
- Visual Studio 2022 with the Desktop development with C++ workload, an MSVC x64 toolset, and a Windows SDK.
- ScummVM's Visual Studio-bundled vcpkg. Run `vcpkg integrate install` once from that vcpkg distribution so MSBuild imports its C++ targets.
- PowerShell with the ScummVM source root as the working directory.
The ScummVM wiki's Visual Studio page was behind an anti-bot challenge during verification. The commands below follow this checkout's `dists/msvc/readme.txt` and `devtools/create_project` generator.
## Build The Project Generator
From the ScummVM source root:
```powershell
MSBuild.exe .\devtools\create_project\msvc\create_project.vcxproj /m /p:Configuration=Release /p:Platform=Win32 /verbosity:minimal
```
The post-build event copies `create_project.exe` to `dists/msvc/`.
## Generate An Ultima Solution
Create `build-msvc/`, then run the generator from that directory:
```powershell
Set-Location .\build-msvc
..\dists\msvc\create_project.exe .. --msvc --vcpkg --disable-all-engines --enable-engine=ultima --enable-engine=ultima8
```
The engine selection keeps builds focused while compiling the shared application, Ultima metaengine, and Ultima VIII/Crusader subengine.
## Helper Scripts
From this directory, build either configuration and launch it for testing:
```powershell
.\build-scummvm.ps1 -Configuration Debug
.\run-scummvm.ps1 -Configuration Debug -ScummVMArgs @('--version')
.\build-scummvm.ps1 -Configuration Release
.\run-scummvm.ps1 -Configuration Release -ScummVMArgs @('--version')
```
The build script creates the solution and build-local vcpkg files when needed. Use `-RegenerateProject` to rebuild the project generator and regenerate the solution. The launcher temporarily adds the matching vcpkg DLL directory to `PATH` for either configuration.
## Isolate The vcpkg Manifest
This checkout's root `vcpkg.json` does not declare a registry baseline. The installed vcpkg requires one, so keep the workaround local to `build-msvc/` rather than editing the source manifest.
Copy the root `vcpkg.json` into `build-msvc/` and change its package name to `scummvm-local-build`. Copy the `embeddedsha` value from the Visual Studio vcpkg root's `vcpkg-bundle.json` into this `build-msvc/vcpkg-configuration.json`:
```json
{
"default-registry": {
"kind": "builtin",
"baseline": "<embeddedsha from vcpkg-bundle.json>"
}
}
```
Add `build-msvc/Directory.Build.props` so MSBuild uses this local manifest and install tree:
```xml
<Project>
<PropertyGroup>
<VcpkgManifestRoot>$(MSBuildThisFileDirectory)</VcpkgManifestRoot>
<VcpkgInstalledDir>$(MSBuildThisFileDirectory)vcpkg_installed</VcpkgInstalledDir>
</PropertyGroup>
</Project>
```
If the files already exist, update the copied dependency list when the root manifest changes, and refresh the baseline when the Visual Studio vcpkg bundle changes. Keep these three build-local files when regenerating the solution; the project generator does not create them.
## Build And Smoke-Test
From the ScummVM source root:
```powershell
MSBuild.exe .\build-msvc\scummvm.sln /m /p:Configuration=Debug /p:Platform=x64 /verbosity:minimal
MSBuild.exe .\build-msvc\scummvm.sln /m /p:Configuration=Release /p:Platform=x64 /verbosity:minimal
$env:PATH = (Resolve-Path .\build-msvc\vcpkg_installed\x64-windows\debug\bin).Path + ";" + $env:PATH
.\build-msvc\Debugx64\scummvm.exe --version
$env:PATH = (Resolve-Path .\build-msvc\vcpkg_installed\x64-windows\bin).Path + ";" + $env:PATH
.\build-msvc\Releasex64\scummvm.exe --version
```
The Debug and Release binaries are written to `build-msvc/Debugx64/` and `build-msvc/Releasex64/`. The first build restores dependencies into `build-msvc/vcpkg_installed/`. Add the matching vcpkg `bin` directory to `PATH` when launching either configuration.
## Verified Here
- Built `create_project.exe` with Visual Studio MSBuild 17.14 and the installed v143 toolset.
- Generated the Ultima-only solution with MSVC 17 and vcpkg manifest mode.
- Debug and Release x64 builds passed after enabling vcpkg MSBuild integration and supplying the isolated manifest baseline.
- Both executables passed `--version` with the matching vcpkg `bin` directory on `PATH`.