Compiling guide - tmp64/BugfixedHL-Rebased GitHub Wiki
Compiling guide
This page explains how to compile BugfixedHL-Rebased from the source code.
Prerequisites
General
Those are required to be installed on all platforms (Windows and Linux).
Visual Studio
On Windows, it is recommended to use Visual Studio.
- Visual Studio 2022 Community or newer
- Make sure to install "Desktop development with C++" workload
VS Code
You can use VS Code on Linux or on Windows (but on Windows, Visual Studio is easier to configure)
VS Code and extensions
- VS Code
- CMake Tools extension
- Windows:
- Linux:
Windows build tools
- Visual Studio 2022 Build Tools or newer
- Make sure to install "Desktop development with C++" workload
- If you have Community/Professional/Enterprise already installed, you don't need this.
Linux build tools
- GCC 9 or newer
- Ninja build system
vcpkg configuration
BugfixedHL-Rebased uses vcpkg for dependency management. It must be installed in the OS correctly, so it can be
accessed using VCPKG_ROOT environment variable. To do that, follow the steps below.
- Perform step 1 from this page.
DO NOT RUNvcpkg.exe integrate install! It's not necessary. - On Windows:
- Remember the path to vcpkg folder
- Open Windows PowerShell
- In the next command, replace
C:\vcpkgwith the path. Then run it.[Environment]::SetEnvironmentVariable("VCPKG_ROOT", "C:\vcpkg", "User")
- On Linux:
- Remember the path to vcpkg folder
- Open Terminal
- In the next command, replace
/home/user/vcpkgwith the path. Then run it.echo "VCPKG_ROOT=/home/user/vcpkg" >> ~/.config/environment.d/vcpkg.conf - Log out and log back in (this is important)
Configuring
Cloning source code repo
- Open a folder in Explorer
- (Windows) Right-click and press "Open Git Bash here"
(Linux) Open Terminal in the folder - Run this command to clone the repo
git clone --recursive https://github.com/tmp64/BugfixedHL-Rebased.git
Configuring for Visual Studio
- Open the cloned BugfixedHL-Rebased folder in Explorer
- Copy
CMakeUserPresets.example.jsonfile and rename it toCMakeUserPresets.json - Open CMake GUI
- Set "Where is the source code:" to path to BugfixedHL-Rebased folder
- Set "Preset" to "user"
- Press "Configure"
- Press "Generate"
- Press "Open Project"
Configuring for VS Code
- Open the cloned BugfixedHL-Rebased folder in VS Code
- In
.vscode, there are files named*.example.json. Copy them and rename them to*.json - Copy
CMakeUserPresets.example.jsonfile and rename it toCMakeUserPresets.json - Press Ctrl+Shift+P and run "CMake: Configure". When prompted for preset, select
user - Wait for configuration to end.
- Press Ctrl+Shift+P and run "CMake: Build"
Selecting configuration
If you want to switch between Debug and Release:
- Open "CMake" panel:
- Change build preset:
Automatic deployment
[!WARNING] This will copy BHL resources and may overwrite custom files!
If you want to automatically install the compiled BugfixedHL into your game:
- Open
_build/user-debug-windowsor_build/user-debug-linux - To install client:
- Create file
PublishPathClient.txt - Put path to
Half-Life/valve_addon. Don't addcl_dll, it will be added automatically. All BHL files will be installed (including resources).
- Create file
- To install server:
- Create file
PublishPathServer.txt - Put path to
Half-Life/valve_addonor toHLDS/valve.
- Create file
You can put multiple paths if needed.
Compiling
Visual Studio:
Press "Build" -> "Build Solution"
VS Code
Press Ctrl+Shift+P and run "CMake: Build" (or press F7)
From terminal
cd _build/user-debug
cmake --build .