mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-09 00:24:15 +00:00
Move project to CMake (#781)
* Move to cmake * Move sources to source_groups and ditch more old VS files * Add BuildVer.h generation * Break out cmake source lists to platforms * Don't copy swf files * Revert audio changes from merge * Add platform defines * Match MSBuild flags * Move BuildVer.h to common include and fix rebuild issue * Seperate projects properly * Exclude more files and make sure GameHDD exists * Missing line * Remove remaining VS project files * Update readme and actions * Use incremental LTCG * Update workflows * Update build workflows and output folder * Disable vcpkg checks * Force MSVC * Use precompiled headers * Only use PCH for cpp * Exclude compat_shims from PCH * Handle per-platform source includes * Copy only current platform media * Define Iggy libs per platform * Fix EnsureGameHDD check * Only set WIN32_EXECUTABLE on Windows * Correct Iggy libs path * Remove include of terrain_MipmapLevel * Correct path to xsb/xwb * Implement copilot suggestions * Add clang flags (untested) * Fix robocopy error checking * Update documentation * Drop CMakePresets.json version as we dont use v6 features * Always cleanup artifacts in nightly even if some builds fail * Re-work compiler target options * Move newer iggy dll into redist and cleanup * Fix typos * Remove 'Source Files' from all source groups * Remove old ps1 build scripts
This commit is contained in:
38
COMPILE.md
38
COMPILE.md
@@ -1,16 +1,14 @@
|
||||
# Compile Instructions
|
||||
|
||||
## Visual Studio (`.sln`)
|
||||
## Visual Studio
|
||||
|
||||
1. Open `MinecraftConsoles.sln` in Visual Studio 2022.
|
||||
2. Set Startup Project:
|
||||
- Client: `Minecraft.Client`
|
||||
- Dedicated server: `Minecraft.Server`
|
||||
3. Select configuration:
|
||||
- `Debug` (recommended), or
|
||||
- `Release`
|
||||
4. Select platform: `Windows64`.
|
||||
5. Build and run:
|
||||
1. Clone or download the repository
|
||||
1. Open the repo folder in Visual Studio 2022+.
|
||||
2. Wait for cmake to configure the project and load all assets (this may take a few minutes on the first run).
|
||||
3. Right click a folder in the solution explorer and switch to the 'CMake Targets View'
|
||||
4. Select platform and configuration from the dropdown. EG: `Windows64 - Debug` or `Windows64 - Release`
|
||||
5. Pick the startup project `Minecraft.Client.exe` or `Minecraft.Server.exe` using the debug targets dropdown
|
||||
6. Build and run the project:
|
||||
- `Build > Build Solution` (or `Ctrl+Shift+B`)
|
||||
- Start debugging with `F5`.
|
||||
|
||||
@@ -29,50 +27,52 @@
|
||||
|
||||
Configure (use your VS Community instance explicitly):
|
||||
|
||||
Open `Developer PowerShell for VS` and run:
|
||||
|
||||
```powershell
|
||||
cmake -S . -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Community"
|
||||
cmake --preset windows64
|
||||
```
|
||||
|
||||
Build Debug:
|
||||
|
||||
```powershell
|
||||
cmake --build build --config Debug --target MinecraftClient
|
||||
cmake --build --preset windows64-debug --target Minecraft.Client
|
||||
```
|
||||
|
||||
Build Release:
|
||||
|
||||
```powershell
|
||||
cmake --build build --config Release --target MinecraftClient
|
||||
cmake --build --preset windows64-release --target Minecraft.Client
|
||||
```
|
||||
|
||||
Build Dedicated Server (Debug):
|
||||
|
||||
```powershell
|
||||
cmake --build build --config Debug --target MinecraftServer
|
||||
cmake --build --preset windows64-debug --target Minecraft.Server
|
||||
```
|
||||
|
||||
Build Dedicated Server (Release):
|
||||
|
||||
```powershell
|
||||
cmake --build build --config Release --target MinecraftServer
|
||||
cmake --build --preset windows64-release --target Minecraft.Server
|
||||
```
|
||||
|
||||
Run executable:
|
||||
|
||||
```powershell
|
||||
cd .\build\Debug
|
||||
.\MinecraftClient.exe
|
||||
cd .\build\windows64\Minecraft.Client\Debug
|
||||
.\Minecraft.Client.exe
|
||||
```
|
||||
|
||||
Run dedicated server:
|
||||
|
||||
```powershell
|
||||
cd .\build\Debug
|
||||
cd .\build\windows64\Minecraft.Server\Debug
|
||||
.\Minecraft.Server.exe -port 25565 -bind 0.0.0.0 -name DedicatedServer
|
||||
```
|
||||
|
||||
Notes:
|
||||
- The CMake build is Windows-only and x64-only.
|
||||
- Contributors on macOS or Linux need a Windows machine or VM to build the project. Running the game via Wine is separate from having a supported build environment.
|
||||
- Post-build asset copy is automatic for `MinecraftClient` in CMake (Debug and Release variants).
|
||||
- Post-build asset copy is automatic for `Minecraft.Client` in CMake (Debug and Release variants).
|
||||
- The game relies on relative paths (for example `Common\Media\...`), so launching from the output directory is required.
|
||||
|
||||
Reference in New Issue
Block a user