## Windows. Using Developer Command Propmt for Visual Studio
## Windows
### Prerequisites
### 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:
D:
cd projects\hlsdk-xash3d
cd projects\hlsdk-portable
```
```
### Building
Сonfigure the project:
С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.
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:
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"
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:
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
### 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:
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`.
Prepend any make or cmake call with `schroot -c jessie --`:
Prepend any make or cmake call with `schroot -c jessie --`: