A template for building Metamod plugins for GoldSrc and Xash3D FWGS dedicated servers, with optional ReHLDS API support.
Primarily targets Metamod-FWGS, but remains compatible with other Metamod forks including Metamod-R and stock Metamod-P.
- CMake ≥ 3.12 (Presets require ≥ 3.21)
- Ninja build system
- A C++11 capable compiler:
- Windows: MSVC 2017+ (or clang-cl), MinGW GCC/Clang
- Linux: GCC or Clang
# Configure (pick a preset for your platform)
cmake --preset win-x64 # Windows MSVC x64
cmake --preset linux-x64-release # Linux GCC x86_64
# Build
cmake --build --preset win-x64-release
cmake --build --preset linux-x64-releaseWindows note: Run from the matching VS Native Tools Command Prompt (x64 or x86) to select the target architecture.
| Preset | Compiler | Arch |
|---|---|---|
win-x64 / win-x86 |
MSVC | x64 / x86 |
linux-x64-release / linux-x64-debug |
GCC | x86_64 |
linux-x86-release / linux-x86-debug |
GCC | x86 (-m32) |
linux-x64-clang-release / linux-x64-clang-debug |
Clang | x86_64 |
linux-x86-clang-release / linux-x86-clang-debug |
Clang | x86 (-m32) |
All presets use the Ninja generator. See CMakePresets.json for the full list.
- Rename the plugin: edit
project()inCMakeLists.txt, theLIBRARYline inexample_plugin.def, andPlugin_infoinmeta_api.cpp. - Fill in
Plugin_info: set name, version, author, URL, log tag, and load/unload times (PT_ANYTIME,PT_STARTUP,PT_CHANGELEVEL, etc.). - Add hooks: replace
NULLentries in the function tables insideengine_api.cppanddllapi.cppwith your own handler functions. - ReHLDS hooks: if using ReHLDS, use
g_RehldsHookchainsto install engine-level hook chains aftermeta_init_rehlds_api()succeeds.