Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

Building guide

Дмитрий edited this page Jul 21, 2019 · 6 revisions

Menu

General

BugfixedHL uses CMake to generate build files for various platforms and IDEs.
The repository needs to be cloned recursively to fetch all submodules. GitHub's "Download ZIP" will not work correctly.

CMake options

  • USE_VGUI2 - configures whether or not VGUI2 and its UI elements should be enabled.
  • VGUI2_BUILD_4554 - disables some features (like SteamAPI or HTML) to support engine build 4554.
  • AUTO_DEPLOY - whether or not built files should be copied to deployment paths. See below for details.
  • USE_UPDATER - whether or not updater will be enabled. Requires cURL library (libcurl4-openssl-dev on Ubuntu).
  • GCC/Clang-only:
    • GCC_NO_OPTIMIZE - disable all optimizations (-O0)
    • GCC_CHECK_FOR_UB - enable run-time checks for undefined behavior (-fsanitize=address,undefined -fstack-protector)

Build instructions

Windows

Requirements

  • Windows 7 or newer
  • Visual Studio 2017 or newer
  • Git for Windows
  • CMake

Steps

  1. Clone the repository using Git
    git clone --recursive https://github.com/tmp64/BugfixedHL.git
  2. Use CMake to generate build files for Visual Studio.
    If you wish to use other IDE (e.g. Qt Creator or Visual Studio Code), you will have to build with MSVC++ compiler. GCC/MinGW/MSYS and others are not supported on Windows.
    • Use CMake GUI
      1. Set the source code location to <repo root>.
      2. Set the build directory to <repo root>/build
        build* directories are ignored by Git.
      3. Press "Configure" and set your Visual Studio version.
      4. Change settings however you like.
      5. Press "Configure" and "Generate".
    • Use CMake CLI
      cd BugfixedHL
      mkdir build
      cd build
      cmake -DUSE_VGUI2=1 -DAUTO_DEPLOY=1 ..
  3. Open /build/BugfixedHL.sln in Visual Studio and you're done.

Linux

Requirements

  • Git
  • CMake
  • C++14 compiler. Tested with GCC 7, Clang should work too.
  • make
  • patchelf (see scripts/FixClientLibPath.sh for details)
  • libcurl-openssl-dev if building with updater (you probably don't need it)

Steps

  1. Clone the repository using Git
    git clone --recursive https://github.com/tmp64/BugfixedHL.git
  2. If your IDE supports CMake, use it. Otherwise, generate Makefiles using CMake.
    cd BugfixedHL
    mkdir build
    cd build
    cmake -DUSE_VGUI2=1 -DAUTO_DEPLOY=1 -DCMAKE_TOOLCHAIN_FILE="../cmake/Linux32Toolchain.cmake" ..
  3. Now you can use make in build directory to build the libraries.

macOS

macOS is not supported at the moment. You're on your own.

Automatic deployment

BugfixedHL provides a way to automatically copy built libraries to necessary locations during development.
This is done by enabling AUTO_DEPLOY in CMake, creating PublishPath<something>.txt in <repo root>/scripts and filling it with paths where files should be copied to, one path per line.

Client library

  • File name: PublishPathClient.txt
  • Contents: path to cl_dlls folder
  • Example: D:\Projects\HalfLife\HL1_Debugging\Client1\valve\cl_dlls
  • Files to be copied:
    • client.dll/client.so
    • client.pdb (Windows only)

Server library

  • File name: PublishPathServer.txt
  • Contents: path to dlls folder
  • Example: D:\Projects\HalfLife\HL1_Debugging\Server1\valve\dlls
  • Files to be copied:
    • hl.dll/hl.so
    • hl.pdb (Windows only)

AMXX module

  • File name: PublishPathAMXXModules.txt
  • Contents: path to AMX Mod X modules folder
  • Example: D:\Projects\HalfLife\HL1_Debugging\Server1\valve\addons\amxmodx\modules
  • Files to be copied:
    • bugfixedapi_amxx.dll/bugfixedapi_amxx_i386.so
    • bugfixedapi_amxx.pdb (Windows only)

Build scripts

BugfixedHL has a cross-platform build script that can generate .zip archive with all necessary files.

Usage

See help for details:

./scripts/BuildRelease.ps1 -Target Help

Windows

Requirements:

  • Git
  • Visual Studio 2017 or 2019
  • CMake

Linux

Requirements:

  • Git
  • CMake
  • ninja (ninja-build package)
  • patchelf
  • PowerShell Core