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).

  1. CMake 3.30 or newer
  2. Git
  3. Python 3.8 or newer

Visual Studio

On Windows, it is recommended to use Visual Studio.

  1. 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

  1. VS Code
  2. CMake Tools extension
  3. Windows:
    1. C++ extension
  4. Linux:
    1. clangd extension
    2. CodeLLDB extension

Windows build tools

  1. 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

  1. GCC 9 or newer
  2. 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.

  1. Perform step 1 from this page.
    DO NOT RUN vcpkg.exe integrate install! It's not necessary.
  2. On Windows:
    1. Remember the path to vcpkg folder
    2. Open Windows PowerShell
    3. In the next command, replace C:\vcpkg with the path. Then run it.
      [Environment]::SetEnvironmentVariable("VCPKG_ROOT", "C:\vcpkg", "User")
      
  3. On Linux:
    1. Remember the path to vcpkg folder
    2. Open Terminal
    3. In the next command, replace /home/user/vcpkg with the path. Then run it.
      echo "VCPKG_ROOT=/home/user/vcpkg" >> ~/.config/environment.d/vcpkg.conf
      
    4. Log out and log back in (this is important)

Configuring

Cloning source code repo

  1. Open a folder in Explorer
  2. (Windows) Right-click and press "Open Git Bash here"
    (Linux) Open Terminal in the folder
  3. Run this command to clone the repo
    git clone --recursive https://github.com/tmp64/BugfixedHL-Rebased.git
    

Configuring for Visual Studio

  1. Open the cloned BugfixedHL-Rebased folder in Explorer
  2. Copy CMakeUserPresets.example.json file and rename it to CMakeUserPresets.json
  3. Open CMake GUI
  4. Set "Where is the source code:" to path to BugfixedHL-Rebased folder
  5. Set "Preset" to "user"
  6. Press "Configure"
  7. Press "Generate"
  8. Press "Open Project"

Configuring for VS Code

  1. Open the cloned BugfixedHL-Rebased folder in VS Code
  2. In .vscode, there are files named *.example.json. Copy them and rename them to *.json
  3. Copy CMakeUserPresets.example.json file and rename it to CMakeUserPresets.json
  4. Press Ctrl+Shift+P and run "CMake: Configure". When prompted for preset, select user
  5. Wait for configuration to end.
  6. Press Ctrl+Shift+P and run "CMake: Build"

Selecting configuration

If you want to switch between Debug and Release:

  1. Open "CMake" panel:
    image
  2. Change build preset:
    image

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:

  1. Open _build/user-debug-windows or _build/user-debug-linux
  2. To install client:
    1. Create file PublishPathClient.txt
    2. Put path to Half-Life/valve_addon. Don't add cl_dll, it will be added automatically. All BHL files will be installed (including resources).
  3. To install server:
    1. Create file PublishPathServer.txt
    2. Put path to Half-Life/valve_addon or to HLDS/valve.

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 .