# Half-Life SDK for GoldSource and Xash3D [![Build Status](https://github.com/FWGS/hlsdk-xash3d/actions/workflows/.github.yml/badge.svg?branch=master)](https://github.com/FWGS/hlsdk-xash3d/actions/workflows/.github.yml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-xash3d?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-xash3d)
# Half-Life SDK for GoldSource and Xash3D [![Build Status](https://github.com/FWGS/hlsdk-portable/actions/workflows/.github.yml/badge.svg?branch=master)](https://github.com/FWGS/hlsdk-portable/actions/workflows/.github.yml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-xash3d?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-xash3d)
Half-Life SDK for GoldSource & Xash3D with some bugfixes.
@ -9,58 +9,65 @@ Either clone the repository via [git](`https://git-scm.com/downloads`) or just d
@@ -9,58 +9,65 @@ Either clone the repository via [git](`https://git-scm.com/downloads`) or just d
To clone the repository with git type in Git Bash (on Windows) or in terminal (on Unix-like operating systems):
## Windows. Using Developer Command Propmt for Visual Studio
## Windows
### Prerequisites
Install and run [Visual Studio Installer](https://visualstudio.microsoft.com/downloads/). 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.
Install and run [Visual Studio Installer](https://visualstudio.microsoft.com/downloads/). 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`ticked. You may also keep`C++ CMake tools for Windows` ticked as you'll need **cmake**. Alternatively you can install **cmake** from the [cmake.org](https://cmake.org/download/) and during installation tick *Add to the PATH...*.
### Building
### Opening command prompt
If **cmake** was installed with Visual Studio Installer, you'll need to run `Developer command prompt for VS` via Windows `Start` menu. If **cmake** was installed with cmake installer, you can run the regular Windows `cmd`.
Run `Developer command prompt for VS` via Windows `Start` menu. Inside the prompt navigate to the hlsdk directory, using `cd` command, e.g.
Inside the prompt navigate to the hlsdk directory, using `cd` command, e.g.
```
cd C:\Users\username\projects\hlsdk-xash3d
cd C:\Users\username\projects\hlsdk-portable
```
Note: if hlsdk-xash3d is unpacked on another disk, nagivate there first:
Note: if hlsdk-portable is unpacked on another disk, nagivate there first:
```
D:
cd projects\hlsdk-xash3d
cd projects\hlsdk-portable
```
### Building
Сonfigure the project:
```
cmake -A Win32 -B build -DCMAKE_INSTALL_PREFIX="dist"
cmake -A Win32 -B build
```
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.
`hl.dll` and `client.dll` will appear in the directory configured via **CMAKE_INSTALL_PREFIX** option (**dist** in this example).
`hl.dll` and `client.dll` will appear in the `build/dlls/Release` and `build/cl_dll/Release` directories.
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 -DCMAKE_INSTALL_PREFIX="C:\Program Files (x86)\Steam\steamapps\common\Half-Life"
```
Then call `msbuild` as described above.
Then call `cmake` with `--target install` parameter:
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 -DCMAKE_INSTALL_PREFIX="dist"
cmake -G "Visual Studio 16 2019" -A Win32 -B build
```
### Editing code in Visual Studio
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.
After the configuration step, `HLSDK-PORTABLE.sln` should appear in the `build` directory. You can open this solution in Visual Studio and continue developing there.
Note that the libraries built this way might be not compatible with Steam Half-Life. If you have such issue you can configure it to build statically with c++ and gcc libraries:
@ -162,9 +167,8 @@ Insert your actual user name in place of `yourusername`.
@@ -162,9 +167,8 @@ Insert your actual user name in place of `yourusername`.
Prepend any make or cmake call with `schroot -c jessie --`:
@ -203,9 +207,8 @@ Install C and C++ compilers (like gcc or clang), cmake and make (or gmake)
@@ -203,9 +207,8 @@ Install C and C++ compilers (like gcc or clang), cmake and make (or gmake)