Andrey Akhmichin
2 years ago
40 changed files with 439 additions and 149 deletions
@ -0,0 +1,113 @@ |
|||||||
|
name: manual build |
||||||
|
|
||||||
|
on: |
||||||
|
workflow_dispatch: |
||||||
|
inputs: |
||||||
|
buildtype: |
||||||
|
type: choice |
||||||
|
description: Build Type |
||||||
|
options: |
||||||
|
- Release |
||||||
|
- Debug |
||||||
|
usevgui: |
||||||
|
type: choice |
||||||
|
description: Use VGUI |
||||||
|
options: |
||||||
|
- 'OFF' |
||||||
|
- 'ON' |
||||||
|
jobs: |
||||||
|
build: |
||||||
|
runs-on: ${{ matrix.os }} |
||||||
|
strategy: |
||||||
|
matrix: |
||||||
|
include: |
||||||
|
- os: ubuntu-latest |
||||||
|
cc: gcc |
||||||
|
cxx: g++ |
||||||
|
- os: windows-2019 |
||||||
|
cc: cl |
||||||
|
cxx: cl |
||||||
|
env: |
||||||
|
CC: ${{ matrix.cc }} |
||||||
|
CXX: ${{ matrix.cxx }} |
||||||
|
steps: |
||||||
|
- name: Checkout |
||||||
|
uses: actions/checkout@v2 |
||||||
|
with: |
||||||
|
submodules: recursive |
||||||
|
|
||||||
|
- name: Checkout steam-runtime |
||||||
|
if: startsWith(matrix.os, 'ubuntu') |
||||||
|
uses: actions/checkout@v2 |
||||||
|
with: |
||||||
|
repository: ValveSoftware/steam-runtime |
||||||
|
path: steam-runtime |
||||||
|
- name: Cache steam-runtime |
||||||
|
if: startsWith(matrix.os, 'ubuntu') |
||||||
|
id: cache-steam-runtime |
||||||
|
uses: actions/cache@v2 |
||||||
|
with: |
||||||
|
path: com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz |
||||||
|
key: ${{ runner.os }}-steam-runtime |
||||||
|
- name: Download steam-runtime |
||||||
|
if: startsWith(matrix.os, 'ubuntu') && steps.cache-steam-runtime.outputs.cache-hit != 'true' |
||||||
|
run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/0.20210610.0/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz |
||||||
|
- name: Install steam runtime |
||||||
|
if: startsWith(matrix.os, 'ubuntu') |
||||||
|
run: | |
||||||
|
sudo apt update |
||||||
|
./steam-runtime/setup_chroot.sh --i386 --tarball ./com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz |
||||||
|
sudo sed -i 's/groups=sudo/groups=adm/g' /etc/schroot/chroot.d/steamrt_scout_i386.conf |
||||||
|
|
||||||
|
- name: Copy vgui.so |
||||||
|
if: ${{ startsWith(matrix.os, 'ubuntu') && github.event.inputs.usevgui == 'ON' }} |
||||||
|
run: | |
||||||
|
mkdir -p build/cl_dll |
||||||
|
cp vgui_support/vgui-dev/lib/vgui.so build/cl_dll |
||||||
|
- name: Build on Linux |
||||||
|
if: startsWith(matrix.os, 'ubuntu') |
||||||
|
run: | |
||||||
|
schroot --chroot steamrt_scout_i386 -- cmake -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_BUILD_TYPE=${{ github.event.inputs.buildtype }} -DCMAKE_INSTALL_PREFIX="$PWD/dist" -DUSE_VGUI=${{ github.event.inputs.usevgui }} |
||||||
|
schroot --chroot steamrt_scout_i386 -- cmake --build build --target all |
||||||
|
schroot --chroot steamrt_scout_i386 -- cmake --build build --target install |
||||||
|
|
||||||
|
- name: Add msbuild to PATH |
||||||
|
if: startsWith(matrix.os, 'windows') |
||||||
|
uses: microsoft/setup-msbuild@v1.0.2 |
||||||
|
- name: Build on Windows |
||||||
|
if: startsWith(matrix.os, 'windows') |
||||||
|
run: | |
||||||
|
cmake -G "Visual Studio 16 2019" -A Win32 -B build -DCMAKE_INSTALL_PREFIX="dist" -DUSE_VGUI=${{ github.event.inputs.usevgui }} |
||||||
|
msbuild -verbosity:normal /property:Configuration=${{ github.event.inputs.buildtype }} build/INSTALL.vcxproj |
||||||
|
|
||||||
|
- name: Extract branch name |
||||||
|
shell: bash |
||||||
|
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/} | tr '/' '_')" |
||||||
|
id: extract_branch |
||||||
|
- name: Extract gamedir |
||||||
|
shell: bash |
||||||
|
run: echo "##[set-output name=gamedir;]$(grep build/CMakeCache.txt -Ee 'GAMEDIR:STRING=[a-z]+' | cut -d '=' -f 2)" |
||||||
|
id: extract_gamedir |
||||||
|
- name: Copy pdbs to dist dir |
||||||
|
if: ${{ startsWith(matrix.os, 'windows') && github.event.inputs.buildtype == 'Debug' }} |
||||||
|
run: | |
||||||
|
copy build/cl_dll/Debug/client.pdb dist/${{ steps.extract_gamedir.outputs.gamedir }}/cl_dlls/ |
||||||
|
copy build/dlls/Debug/hl.pdb dist/${{ steps.extract_gamedir.outputs.gamedir }}/dlls/ |
||||||
|
- name: Delete .lib files from dist |
||||||
|
if: startsWith(matrix.os, 'windows') |
||||||
|
run: | |
||||||
|
Remove-Item -Force -Path dist/${{ steps.extract_gamedir.outputs.gamedir }}/cl_dlls/client.lib |
||||||
|
Remove-Item -Force -Path dist/${{ steps.extract_gamedir.outputs.gamedir }}/dlls/hl.lib |
||||||
|
- name: Upload linux artifact |
||||||
|
if: startsWith(matrix.os, 'ubuntu') |
||||||
|
uses: actions/upload-artifact@v2 |
||||||
|
with: |
||||||
|
name: hlsdk-${{ steps.extract_branch.outputs.branch }}-linux |
||||||
|
path: dist/${{ steps.extract_gamedir.outputs.gamedir }} |
||||||
|
- name: Upload windows artifact |
||||||
|
if: startsWith(matrix.os, 'windows') |
||||||
|
uses: actions/upload-artifact@v2 |
||||||
|
with: |
||||||
|
name: hlsdk-${{ steps.extract_branch.outputs.branch }}-windows |
||||||
|
path: dist/${{ steps.extract_gamedir.outputs.gamedir }} |
||||||
|
|
@ -1,140 +1,261 @@ |
|||||||
# Half-Life SDK for 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/build.yml/badge.svg?branch=master)](https://github.com/FWGS/hlsdk-portable/actions/workflows/build.yml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-portable?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-portable) |
||||||
|
|
||||||
Half-Life SDK for Xash3D & GoldSource with some fixes. |
Half-Life SDK for GoldSource & Xash3D with some bugfixes. |
||||||
|
|
||||||
## How to build |
<details><summary>Changelog</summary> |
||||||
|
<p> |
||||||
|
|
||||||
### CMake as most universal way |
- Fixed an occasional bug when houndeyes stuck unable to do anything. Technical detail: now monster's `Activity` is set before the call to `SetYawSpeed`. [Patch](https://github.com/FWGS/hlsdk-portable/commit/467899b99aa225a95d90222137f18c141c929c86) |
||||||
|
- Monsters now play idle sounds as it's supposed by the code. Technical detail: the problem was a check for a wrong variable. [Patch](https://github.com/FWGS/hlsdk-portable/commit/9fc712da019a1ca646171e912209a993e7c43976) |
||||||
|
- Fixed a bug that caused talk monsters (scientists and security guards) to face a wrong direction during scripted sequence sometimes. [Patch](https://github.com/FWGS/hlsdk-portable/commit/3e2808de62e479e83068c075cb88b4f177f9acc7) |
||||||
|
- Fixed squad member removal. This bug affected houndeye attacks as their attack depends on percieved number of squad members. [Patch](https://github.com/FWGS/hlsdk-portable/commit/b4502f71336a08f3f2c72b7b061b2838a149a11b) |
||||||
|
- Scientists now react to smells. [Patch](https://github.com/FWGS/hlsdk-portable/commit/2de4e7ab003d5b1674d12525f5aefb1e57a49fa3) |
||||||
|
- Tau-cannon (gauss) plays idle animations. |
||||||
|
- Tau-cannon (gauss) beam color depends on the charge as it was before the prediction code was introduced in Half-Life. [Patch](https://github.com/FWGS/hlsdk-portable/commit/0a29ec49c8183ebb8da22a6d2ef395eae9c3dffe) |
||||||
|
- Brought back gluon flare in singleplayer. |
||||||
|
- Hand grenades don't stay primed after holster, preventing detonation after weapon switch. [Patch](https://github.com/FWGS/hlsdk-portable/commit/6e1059026faa90c5bfe5e3b3f4f58fde398d4524) |
||||||
|
- Fixed flashlight battery appearing as depleted on restore. |
||||||
|
- Fixed a potential overflow when reading sentences.txt. [Patch](https://github.com/FWGS/hlsdk-xash3d/commit/cb51d2aa179f1eb622e08c1c07b053ccd49e40a5) |
||||||
|
- Fixed beam attachment invalidated on restore (that led to visual bugs). [Patch](https://github.com/FWGS/hlsdk-xash3d/commit/74b5543c83c5cdcb88e9254bacab08bc63c4c896) |
||||||
|
- Fixed alien controllers facing wrong direction in non-combat state. [Patch](https://github.com/FWGS/hlsdk-portable/commit/e51878c45b618f9b3920b46357545cbb47befeda) |
||||||
|
- Fixed weapon deploy animations not playing sometimes on fast switching between weapons. [Patch](https://github.com/FWGS/hlsdk-portable/commit/ed676a5413c2d26b2982e5b014e0731f0eda6a0d) [Patch2](https://github.com/FWGS/hlsdk-portable/commit/4053dca7a9cf999391cbd77224144da207e4540b) |
||||||
|
- Fixed tripmine sometimes having wrong body on pickup [Patch](https://github.com/FWGS/hlsdk-portable/commit/abf08e4520e3b6cd12a40f269f4a256cf8496227) |
||||||
|
|
||||||
mkdir build && cd build |
Bugfix-related macros that can be enabled during the compilation: |
||||||
cmake ../ |
|
||||||
make |
|
||||||
|
|
||||||
Crosscompiling using mingw: |
- **CROWBAR_DELAY_FIX** fixes a bug when crowbar has a longer delay after the first hit. |
||||||
|
- **CROWBAR_FIX_RAPID_CROWBAR** fixes a "rapid crowbar" bug when hitting corpses of killed monsters. |
||||||
|
- **GAUSS_OVERCHARGE_FIX** fixes tau-cannon (gauss) charge sound not stopping after the overcharge. |
||||||
|
- **CROWBAR_IDLE_ANIM** makes crowbar play idle animations. |
||||||
|
- **TRIPMINE_BEAM_DUPLICATION_FIX** fixes tripmine's beam duplication on level transition. |
||||||
|
- **HANDGRENADE_DEPLOY_FIX** makes handgrenade play draw animation after finishing a throw. |
||||||
|
- **WEAPONS_ANIMATION_TIMES_FIX** fixes deploy and idle animation times of some weapons. |
||||||
|
|
||||||
mkdir build-mingw && cd build-mingw |
Bugfix-related server cvars: |
||||||
TOOLCHAIN_PREFIX=i686-w64-mingw32 # check up the actual mingw prefix of your mingw installation |
|
||||||
cmake ../ -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="$TOOLCHAIN_PREFIX-gcc" -DCMAKE_CXX_COMPILER="$TOOLCHAIN_PREFIX-g++" |
|
||||||
|
|
||||||
You may enable or disable some build options by -Dkey=value. All available build options are defined in CMakeLists.txt at root directory. |
- **satchelfix**: if set to 1, doors won't get blocked by satchels. Fixes an infamous exploit on `crossfire` map. |
||||||
See below if you want to build the GoldSource compatible libraries. |
- **explosionfix**: if set to 1, explosion damage won't propagate through thin bruses. |
||||||
|
- **selfgauss**: if set to 0, players won't hurt themselves with secondary attack when shooting thick brushes. |
||||||
|
|
||||||
See below, if CMake is not suitable for you: |
*Note*: the macros and cvars were adjusted in [hlfixed](https://github.com/FWGS/hlsdk-portable/tree/hlfixed) branch. The bugfix macros are kept turned off in master branch to maintain the compatibility with vanilla servers and clients. |
||||||
|
|
||||||
### Windows |
Other server cvars: |
||||||
|
|
||||||
#### Using msvc |
- **mp_bhopcap**: if set to 1, enable bunny-hop. |
||||||
|
- **chargerfix**: if set to 1, wall-mounted health and battery chargers will play reject sounds if player has the full health or armor. |
||||||
|
- **corpsephysics**: if set to 1, corpses of killed monsters will fly a bit from an impact. It's a cut feature from Half-Life. |
||||||
|
|
||||||
We use compilers provided with Microsoft Visual Studio 6. There're `compile.bat` scripts in both `cl_dll` and `dlls` directories. |
</p> |
||||||
Before running any of those files you must define `MSVCDir` variable which is the path to your msvc installation. |
</details> |
||||||
|
|
||||||
set MSVCDir=C:\Program Files\Microsoft Visual Studio |
# Obtaining source code |
||||||
compile.bat |
|
||||||
|
|
||||||
These scripts also can be ran via wine: |
Either clone the repository via [git](`https://git-scm.com/downloads`) or just download ZIP via **Code** button on github. The first option is more preferable as it also allows you to search through the repo history, switch between branches and clone the vgui submodule. |
||||||
|
|
||||||
MSVCDir="z:\home\$USER\.wine\drive_c\Program Files\Microsoft Visual Studio" wine cmd /c compile.bat |
To clone the repository with git type in Git Bash (on Windows) or in terminal (on Unix-like operating systems): |
||||||
|
|
||||||
The libraries built this way are always GoldSource compatible. |
``` |
||||||
|
git clone --recursive https://github.com/FWGS/hlsdk-portable |
||||||
|
``` |
||||||
|
|
||||||
#### Using mingw |
# Build Instructions |
||||||
|
|
||||||
TODO |
## Windows |
||||||
|
|
||||||
### Unix-like |
### Prerequisites |
||||||
|
|
||||||
To use waf, you need to install python (2.7 minimum) |
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...*. |
||||||
|
|
||||||
|
### 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`. |
||||||
|
|
||||||
|
Inside the prompt navigate to the hlsdk directory, using `cd` command, e.g. |
||||||
|
``` |
||||||
|
cd C:\Users\username\projects\hlsdk-portable |
||||||
|
``` |
||||||
|
|
||||||
|
Note: if hlsdk-portable is unpacked on another disk, nagivate there first: |
||||||
|
``` |
||||||
|
D: |
||||||
|
cd projects\hlsdk-portable |
||||||
|
``` |
||||||
|
|
||||||
|
### Building |
||||||
|
|
||||||
|
Сonfigure the project: |
||||||
|
``` |
||||||
|
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. |
||||||
|
|
||||||
|
The next step is to compile the libraries: |
||||||
|
``` |
||||||
|
cmake --build build --config Release |
||||||
|
``` |
||||||
|
`hl.dll` and `client.dll` will appear in the `build/dlls/Release` and `build/cl_dll/Release` directories. |
||||||
|
|
||||||
(./waf configure -T release) |
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: |
||||||
(./waf) |
``` |
||||||
|
cmake -A Win32 -B build -DGAMEDIR=mod -DCMAKE_INSTALL_PREFIX="C:\Program Files (x86)\Steam\steamapps\common\Half-Life" |
||||||
|
``` |
||||||
|
Then call `cmake` with `--target install` parameter: |
||||||
|
``` |
||||||
|
cmake --build build --config Release --target install |
||||||
|
``` |
||||||
|
|
||||||
### Android |
#### Choosing Visual Studio version |
||||||
|
|
||||||
Just typical `ndk-build`. |
You can explicitly choose a Visual Studio version on the configuration step by specifying cmake generator: |
||||||
TODO: describe what it is. |
``` |
||||||
|
cmake -G "Visual Studio 16 2019" -A Win32 -B build |
||||||
|
``` |
||||||
|
|
||||||
### Building GoldSource-compatible libraries |
### Editing code in Visual Studio |
||||||
|
|
||||||
To enable building the goldsource compatible client library add GOLDSOURCE_SUPPORT flag when calling cmake: |
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. |
||||||
|
|
||||||
cmake .. -DGOLDSOURCE_SUPPORT=ON |
## Windows. Using Microsoft Visual Studio 6 |
||||||
|
|
||||||
or when using waf: |
Microsoft Visual Studio 6 is very old, but if you still have it installed, you can use it to build this hlsdk. There are no project files, but two `.bat` files, for server and client libraries. They require variable **MSVCDir** to be set to the installation path of Visual Studio: |
||||||
|
|
||||||
./waf configure -T release --enable-goldsrc-support |
``` |
||||||
|
set MSVCDir=C:\Program Files\Microsoft Visual Studio |
||||||
|
cd dlls && compile.bat && cd ../cl_dll && compile.bat |
||||||
|
``` |
||||||
|
|
||||||
|
`hl.dll` and `client.dll` will appear in `dlls/` and `cl_dll/` diretories. The libraries built with msvc6 should be compatible with Windows XP. |
||||||
|
|
||||||
|
## Linux. Using Steam Runtime in chroot |
||||||
|
|
||||||
|
### Prerequisites |
||||||
|
|
||||||
Unlike original client by Valve the resulting client library will not depend on vgui or SDL2 just like the one that's used in FWGS Xash3d. |
The official way to build Steam compatible games for Linux is through steam-runtime. |
||||||
|
|
||||||
Note for **Windows**: it's not possible to create GoldSource compatible libraries using mingw, only msvc builds will work. |
Install schroot. On Ubuntu or Debian: |
||||||
|
|
||||||
Note for **Linux**: GoldSource requires libraries (both client and server) to be compiled with libstdc++ bundled with g++ of major version 4 (versions from 4.6 to 4.9 should work). |
``` |
||||||
If your Linux distribution does not provide compatible g++ version you have several options. |
sudo apt install schroot |
||||||
|
``` |
||||||
|
|
||||||
#### Method 1: Statically build with c++ library |
Clone https://github.com/ValveSoftware/steam-runtime and follow instructions: [download](https://github.com/ValveSoftware/steam-runtime/blob/e014a74f60b45a861d38a867b1c81efe8484f77a/README.md#downloading-a-steam-runtime) and [setup](https://github.com/ValveSoftware/steam-runtime/blob/e014a74f60b45a861d38a867b1c81efe8484f77a/README.md#using-schroot) the chroot. |
||||||
|
|
||||||
|
``` |
||||||
|
sudo ./setup_chroot.sh --i386 --tarball ./com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz |
||||||
|
``` |
||||||
|
|
||||||
This one is the most simple but has a drawback. |
### Building |
||||||
|
|
||||||
cmake ../ -DGOLDSOURCE_SUPPORT=ON -DCMAKE_C_FLAGS="-static-libstdc++ -static-libgcc" |
Now you can use cmake and make prepending the commands with `schroot --chroot steamrt_scout_i386 --`: |
||||||
|
``` |
||||||
|
schroot --chroot steamrt_scout_i386 -- cmake -B build-in-steamrt -S . |
||||||
|
schroot --chroot steamrt_scout_i386 -- cmake --build build-in-steamrt |
||||||
|
``` |
||||||
|
|
||||||
The drawback is that the compiled libraries will be larger in size. |
## Linux. Build without Steam Runtime |
||||||
|
|
||||||
#### Method 2: Build in Steam Runtime chroot |
### Prerequisites |
||||||
|
|
||||||
This is the official way to build Steam compatible games for Linux. |
Install C++ compilers, cmake and x86 development libraries for C, C++ and SDL2. On Ubuntu/Debian: |
||||||
|
``` |
||||||
|
sudo apt install cmake build-essential gcc-multilib g++-multilib libsdl2-dev:i386 |
||||||
|
``` |
||||||
|
|
||||||
Clone https://github.com/ValveSoftware/steam-runtime and follow instructions https://github.com/ValveSoftware/steam-runtime#building-in-the-runtime |
### Building |
||||||
|
|
||||||
sudo ./setup_chroot.sh --i386 |
``` |
||||||
|
cmake -B build -S . |
||||||
|
cmake --build build |
||||||
|
``` |
||||||
|
|
||||||
Then use cmake and make as usual, but prepend the commands with `schroot --chroot steamrt_scout_i386 --`: |
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: |
||||||
|
``` |
||||||
|
cmake .. -DCMAKE_C_FLAGS="-static-libstdc++ -static-libgcc" |
||||||
|
``` |
||||||
|
To ensure portability it's still better to build using Steam Runtime or another chroot of some older distro. |
||||||
|
|
||||||
mkdir build-in-steamrt && cd build-in-steamrt |
## Linux. Build in your own chroot |
||||||
schroot --chroot steamrt_scout_i386 -- cmake ../ -DGOLDSOURCE_SUPPORT=ON |
|
||||||
schroot --chroot steamrt_scout_i386 -- make |
|
||||||
|
|
||||||
#### Method 3: Create your own chroot with older distro that includes g++ 4. |
### Prerequisites |
||||||
|
|
||||||
Use the most suitable way for you to create an old distro 32-bit chroot. E.g. on Debian (and similar) you can use debootstrap. |
Use the most suitable way for you to create an old distro 32-bit chroot. E.g. on Ubuntu/Debian you can use debootstrap. |
||||||
|
|
||||||
sudo debootstrap --arch=i386 jessie /var/chroot/jessie-debian-i386 # On Ubuntu type trusty instead of jessie |
``` |
||||||
sudo chroot /var/chroot/jessie-debian-i386 |
sudo apt install debootstrap schroot |
||||||
|
sudo mkdir -p /var/choots |
||||||
|
sudo debootstrap --arch=i386 jessie /var/chroots/jessie-i386 # On Ubuntu type trusty instead of jessie |
||||||
|
sudo chroot /var/chroots/jessie-i386 |
||||||
|
``` |
||||||
|
|
||||||
Inside chroot install cmake, make, g++ and libsdl2-dev. Then exit the chroot. |
``` |
||||||
|
# inside chroot |
||||||
|
apt install cmake build-essential gcc-multilib g++-multilib libsdl2-dev |
||||||
|
exit |
||||||
|
``` |
||||||
|
|
||||||
On the host system install schroot. Then create and adapt the following config in /etc/schroot/chroot.d/jessie.conf (you can choose a different name): |
Create and adapt the following config in /etc/schroot/chroot.d/jessie.conf (you can choose a different name): |
||||||
|
|
||||||
``` |
``` |
||||||
[jessie] |
[jessie] |
||||||
type=directory |
type=directory |
||||||
description=Debian jessie i386 |
description=Debian jessie i386 |
||||||
directory=/var/chroot/debian-jessie-i386/ |
directory=/var/chroots/jessie-i386/ |
||||||
users=yourusername |
users=yourusername |
||||||
groups=yourusername |
groups=adm |
||||||
root-groups=root |
root-groups=root |
||||||
preserve-environment=true |
preserve-environment=true |
||||||
personality=linux32 |
personality=linux32 |
||||||
``` |
``` |
||||||
|
|
||||||
Insert your actual user name in place of `yourusername`. Then prepend any make or cmake call with `schroot -c jessie --`: |
Insert your actual user name in place of `yourusername`. |
||||||
|
|
||||||
|
### Building |
||||||
|
|
||||||
|
Prepend any make or cmake call with `schroot -c jessie --`: |
||||||
|
``` |
||||||
|
schroot --chroot jessie -- cmake -B build-in-chroot -S . |
||||||
|
schroot --chroot jessie -- cmake --build build-in-chroot |
||||||
|
``` |
||||||
|
|
||||||
|
## Android |
||||||
|
|
||||||
|
TODO |
||||||
|
|
||||||
mkdir build-in-chroot && cd build-in-chroot |
## Other platforms |
||||||
schroot --chroot jessie -- cmake ../ -DGOLDSOURCE_SUPPORT=ON |
|
||||||
schroot --chroot jessie -- make |
|
||||||
|
|
||||||
#### Method 4: Install the needed g++ version yourself |
Building on other Unix-like platforms (e.g. FreeBSD) is supported. |
||||||
|
|
||||||
TODO: describe steps. |
### Prerequisites |
||||||
|
|
||||||
#### Configuring Qt Creator to use toolchain from chroot |
Install C and C++ compilers (like gcc or clang), cmake and make (or gmake) |
||||||
|
|
||||||
Create a file with the following contents anywhere: |
### Building |
||||||
|
|
||||||
```sh |
|
||||||
#!/bin/sh |
|
||||||
schroot --chroot steamrt_scout_i386 -- cmake "$@" |
|
||||||
``` |
``` |
||||||
|
cmake -B build -S . |
||||||
|
cmake --build build |
||||||
|
``` |
||||||
|
|
||||||
|
### Building with waf |
||||||
|
|
||||||
Make it executable. |
To use waf, you need to install python (2.7 minimum) |
||||||
In Qt Creator go to `Tools` -> `Options` -> `Build & Run` -> `CMake`. Add a new cmake tool and specify the path of previously created file. |
|
||||||
Go to `Kits` tab, clone your default configuration and choose your CMake tool there. |
``` |
||||||
Choose the new kit when opening CMakeLists.txt. |
(./waf configure -T release) |
||||||
|
(./waf) |
||||||
|
``` |
||||||
|
|
||||||
|
## Build options |
||||||
|
|
||||||
|
Some useful build options that can be set during the cmake step. |
||||||
|
|
||||||
|
* **GOLDSOURCE_SUPPORT** - allows to turn off/on the support for GoldSource input. Set to **ON** by default on Windows and Linux, **OFF** on other platforms. |
||||||
|
* **USE_VGUI** - whether to use VGUI library. **OFF** by default. You need to init `vgui_support` submodule in order to build with VGUI. |
||||||
|
|
||||||
|
This list is incomplete. Look at `CMakeLists.txt` to see all available options. |
||||||
|
|
||||||
|
Prepend option names with `-D` when passing to cmake. Boolean options can take values **OFF** and **ON**. Example: |
||||||
|
|
||||||
|
``` |
||||||
|
cmake .. -DUSE_VGUI=ON -DGOLDSOURCE_SUPPORT=ON -DCROWBAR_IDLE_ANIM=ON -DCROWBAR_FIX_RAPID_CROWBAR=ON |
||||||
|
``` |
||||||
|
Loading…
Reference in new issue