Install and run Visual Studio Installer. The installer allows you to choose specific components. Select Desktop development with C++
. You can untick everything you don't need in Installation details, but you must keep MSVC
and C++ CMake tools for Windows
ticked.
Run Developer command prompt for VS
via Windows Start
menu. Inside the prompt navigate to the hlsdk directory, using cd
command, e.g.
cd C:\Users\username\projects\hlsdk-xash3d
Сonfigure the project:
cmake -A Win32 -B build -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="dist"
Once you configure the project you don't need to call cmake
anymore unless you modify CMakeLists.txt
files or want to reconfigure the project with different parameters.
The next step is to compile the libraries:
msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj
hl.dll
and client.dll
will appear in the directory configured via CMAKE_INSTALL_PREFIX option (dist in this example).
If you have a mod and want to automatically install libraries to the mod directory, set GAMEDIR variable to the directory name and CMAKE_INSTALL_PREFIX to your Half-Life or Xash3D installation path:
cmake -A Win32 -B build -DGAMEDIR=mod -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="C:\Program Files (x86)\Steam\steamapps\common\Half-Life"
Then call msbuild
as described above.
You can explicitly choose a Visual Studio version on the configuration step by specifying cmake generator:
cmake -G "Visual Studio 16 2019" -A Win32 -B build -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="dist"
After the configuration step, HLSDK-XASH3D.sln
should appear in the build
directory. You can open this solution in Visual Studio and continue developing there.