Skip to content

Commit 0388d07

Browse files
authored
Merge pull request #529 from Lgt2x/release
Update release branch with latest commits
2 parents ae5840f + c01ef38 commit 0388d07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+668
-1262
lines changed

.github/workflows/build.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,25 @@ jobs:
6666
run: |
6767
sudo apt update
6868
sudo apt install -y --no-install-recommends \
69-
ninja-build cmake g++ libgtest-dev libsdl2-dev zlib1g-dev libspdlog-dev
69+
ninja-build cmake g++ curl pkg-config autoconf automake libtool libltdl-dev make python3-jinja2 libx11-dev libxft-dev libxext-dev libwayland-dev libxkbcommon-dev libegl1-mesa-dev libibus-1.0-dev libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev
7070
7171
- name: Install Windows dependencies
7272
if: ${{ matrix.os.runner == 'windows-latest' }}
7373
run: choco install ninja
74-
74+
7575
- uses: ilammy/msvc-dev-cmd@v1
7676
if: ${{ matrix.os.runner == 'windows-latest' }}
7777
with:
7878
arch: win64
7979

80+
- uses: lukka/run-vcpkg@v11
81+
with:
82+
vcpkgJsonGlob: vcpkg.json
83+
8084
- name: Configure CMake
8185
env:
8286
CC: ${{ matrix.os.cc }}
8387
CXX: ${{ matrix.os.cxx }}
84-
VCPKG_ROOT: C:/vcpkg
8588
run: cmake --preset ${{ matrix.os.preset }} -DBUILD_TESTING=ON -DENABLE_LOGGER=ON -DFORCE_PORTABLE_INSTALL=ON -DBUILD_EDITOR=ON
8689

8790
- name: Build ${{ matrix.build_type }}

.github/workflows/release.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release source tarball
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: recursive
16+
17+
- name: Generate git hash and tarball
18+
run: |
19+
sudo apt update
20+
sudo apt install -y ninja-build cmake g++ libsdl2-dev zlib1g-dev
21+
cmake --preset linux
22+
cmake --build --preset linux -t get_git_hash
23+
cmake --build --preset linux -t package_source
24+
25+
- name: Release
26+
uses: ncipollo/[email protected]
27+
with:
28+
artifacts: "builds/linux/Descent3-*-Source.tar.xz"
29+
draft: true
30+
token: ${{ secrets.GITHUB_TOKEN }}

2dlib/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
set(HEADERS
2+
gr.h
3+
lib2d.h)
14
set(CPPS
25
font.cpp
36
hardsurf.cpp
@@ -9,7 +12,7 @@ set(CPPS
912
viewport.cpp
1013
)
1114

12-
add_library(2dlib STATIC ${CPPS})
15+
add_library(2dlib STATIC ${HEADERS} ${CPPS})
1316
target_link_libraries(2dlib PRIVATE
1417
cfile
1518
mem

2dlib/font.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ void grFont::translate_to_surfaces(int slot) {
554554
void grFont::translate_mono_char(grSurface *sf, int x, int y, int index, gr_font_file_record *ft, int width) {
555555
int row, col; // byte width of char
556556
int rowsize;
557-
uint8_t bit_mask = 0, byte;
557+
uint8_t bit_mask = 0, byte = 0;
558558
uint8_t *fp;
559559

560560
fp = ft->char_data[index];

AudioEncode/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
set(HEADERS
2+
adecode.h
3+
aencode.h
4+
audio_encode.h)
15
set(CPPS
26
adecode.cpp
37
aencode.cpp
48
encoder.cpp
59
)
610

7-
add_library(AudioEncode STATIC ${CPPS})
11+
add_library(AudioEncode STATIC ${HEADERS} ${CPPS})
812
target_link_libraries(AudioEncode PRIVATE
913
libacm
1014
)

AudioEncode/encoder.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ bool aenc_Compress(char *input_filename, char *output_filename, const int *input
4242
FILE *in, *out;
4343
int32_t result;
4444

45-
int levels, samples_per_subband;
46-
unsigned sample_rate, channels;
47-
float factor, volume_scale;
45+
int levels = 0, samples_per_subband = 0;
46+
unsigned sample_rate = 0, channels = 0;
47+
float factor = 0, volume_scale = 0;
4848
int levels_set = 0, samples_per_subband_set = 0, sample_rate_set = 0, channels_set = 0, factor_set = 0,
4949
volume_scale_set = 0;
5050

@@ -105,7 +105,8 @@ bool aenc_Compress(char *input_filename, char *output_filename, const int *input
105105
}
106106

107107
if (!levels_set && !samples_per_subband_set) {
108-
levels = 7, samples_per_subband = 16;
108+
levels = 7;
109+
samples_per_subband = 16;
109110
} else if (!samples_per_subband_set) {
110111
samples_per_subband = 2048 / (1 << levels);
111112

BUILD.md

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
2+
# Building Descent 3 Open Source
3+
4+
## Dependencies
5+
The build process uses [**CMake**](https://cmake.org/) and, by default, [**Ninja**](https://ninja-build.org/). You must install these; the project cannot locate them for you. The source code depends on [**SDL2**](https://github.com/libsdl-org/SDL/tree/SDL2) and [**zlib**](https://github.com/madler/zlib). You can supply these dependencies yourself via your system's library management tools, or the build system can locate the dependencies for you using [vcpkg](https://github.com/microsoft/vcpkg), a cross-platform dependency-management system developed by Microsoft. The official builds source their dependencies from vcpkg.
6+
7+
## Installing and using vcpkg
8+
* When building for Windows, vcpkg is already installed and configured when using any of the Visual Studio command prompts (either actual Command Prompt, or PowerShell).
9+
* For Android, Linux or Mac (or non-standard-Windows) configurations, you will need to install vcpkg locally by cloning https://github.com/microsoft/vcpkg and setting your `VCPKG_ROOT` env var to the repository location. With this environment variable set, the build will automatically locate its dependencies.
10+
11+
## Building - Windows
12+
1. **Install the prerequisite build tools.**
13+
14+
Make sure that you have Git and Visual Studio 2022 with the “Desktop development with C++” workload and the “C++ MFC for latest v143 build tools (x86 & x64)” component. If you don’t already have those installed or you aren’t sure, then open an elevated Command Prompt and run:
15+
<!--
16+
The following code block specifies the full path to the Visual Studio Installer because the Visual Studio Installer doesn’t add itself to the user’s Path. The installer is guaranteed to be in a specific location on 64-bit systems [1]. The installer will be in a different location on 32-bit systems [2], but Visual Studio 2022 doesn’t support 32-bit systems [3] so we can ignore that detail.
17+
18+
[1]: <https://learn.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2022>
19+
[2]: <https://github.com/microsoft/vswhere/wiki#installing>
20+
[3]: <https://learn.microsoft.com/en-us/answers/questions/1689898/does-visual-studio-build-tools-2022-support-32-bit>
21+
-->
22+
```batch
23+
winget install Git.Git Microsoft.VisualStudio.2022.Community
24+
25+
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\setup.exe" modify^
26+
--passive^
27+
--channelId VisualStudio.17.Release^
28+
--productId Microsoft.VisualStudio.Product.Community^
29+
--add Microsoft.VisualStudio.Workload.NativeDesktop;includeRecommended^
30+
--add Microsoft.VisualStudio.Component.VC.ATLMFC
31+
```
32+
33+
**NOTE:**
34+
Builds _must_ be performed in one of the Visual Studio-provided **x64 Native Tools** command prompts ("x64 Native Tools Command Prompt" or "x64 Native Tools PowerShell"), _not_ a standard Command Prompt or PowerShell. The VS prompts will already have vcpkg installed and configured for use, so no dependency management is needed.
35+
36+
2. **Clone the Descent3 source code.**
37+
38+
Open a "x64 Native Tools Command Prompt" or "x64 Native Tools PowerShell" and run:
39+
```batch
40+
git clone https://github.com/DescentDevelopers/Descent3
41+
```
42+
43+
4. **Build Descent3.**
44+
45+
```batch
46+
cd Descent3
47+
cmake --preset win
48+
cmake --build --preset win --config [Debug|Release]
49+
```
50+
See [Build Options](#build-options) below for more information on `Debug` vs `Release`.
51+
52+
Once CMake finishes, the built files will be put in `builds\win\Descent3\Debug` or `builds\win\Descent3\Release`.
53+
54+
## Building - macOS
55+
1. **Install the prerequisite build tools.**
56+
57+
* Make sure that [Xcode](https://developer.apple.com/xcode) is installed.
58+
* Make sure that [Homebrew](https://brew.sh) is installed.
59+
60+
2. **Acquire the library dependencies.**
61+
62+
* If you would like to use vcpkg:
63+
```sh
64+
git clone https://github.com/microsoft/vcpkg
65+
export VCPKG_ROOT="$PWD/vcpkg"
66+
```
67+
**NOTE:**
68+
You will need `$VCPKG_ROOT` defined in the environment for all build runs. It is a good idea to set this in your `.bashrc` or equivalent.
69+
* If you would like to manage the code dependencies yourself:
70+
```sh
71+
brew install sdl2 zlib googletest
72+
```
73+
74+
3. **Clone the Descent3 source code.**
75+
76+
```sh
77+
git clone https://github.com/DescentDevelopers/Descent3
78+
```
79+
80+
4. **Build Descent3.**
81+
82+
```sh
83+
cd Descent3
84+
brew bundle install
85+
cmake --preset mac
86+
cmake --build --preset mac --config [Debug|Release]
87+
```
88+
See [Build Options](#build-options) below for more information on `Debug` vs `Release`.
89+
90+
Once CMake finishes, the built files will be put in `builds/mac/Descent3/Debug` or `builds/mac/Descent3/Release`.
91+
92+
## Building - Linux
93+
1. **Install the prerequisite build tools.**
94+
95+
* APT users (Debian, Ubuntu)
96+
```sh
97+
sudo apt update
98+
sudo apt install -y --no-install-recommends git ninja-build cmake g++
99+
```
100+
* DNF users (Red Hat, Fedora)
101+
```sh
102+
sudo dnf update --refresh
103+
sudo dnf install -y git ninja-build cmake gcc-c++
104+
```
105+
106+
2. **Acquire the library dependencies.**
107+
108+
* If you would like to use vcpkg:
109+
1. Clone vcpkg:
110+
```sh
111+
git clone https://github.com/microsoft/vcpkg
112+
export VCPKG_ROOT="$PWD/vcpkg"
113+
```
114+
**NOTE:**
115+
You will need `$VCPKG_ROOT` defined in the environment for all build runs. It is a good idea to set this in your `.bashrc` or equivalent.
116+
2. Install vcpkg-needed build tools and dependencies:
117+
* APT users
118+
```sh
119+
sudo apt install -y --no-install-recommends curl pkg-config autoconf automake libtool libltdl-dev make python3-jinja2 libx11-dev libxft-dev libxext-dev libwayland-dev libxkbcommon-dev libegl1-mesa-dev libibus-1.0-dev libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev
120+
```
121+
* DNF users
122+
```sh
123+
sudo dnf install -y autoconf automake libtool perl-open perl-FindBin python-jinja2 libX11-devel libXft-devel libXext-devel wayland-devel libxkbcommon-devel mesa-libEGL-devel ibus-devel alsa-lib-devel pulseaudio-libs-devel
124+
```
125+
* If you would like to manage the code dependencies yourself:
126+
* APT users
127+
```sh
128+
sudo apt install -y --no-install-recommends libsdl2-dev zlib1g-dev libgtest-dev
129+
```
130+
* DNF users
131+
```sh
132+
sudo dnf install -y SDL2-devel zlib-devel gtest
133+
```
134+
135+
3. **Clone the Descent3 source code.**
136+
137+
```sh
138+
git clone https://github.com/DescentDevelopers/Descent3
139+
```
140+
141+
4. **Build Descent3.**
142+
143+
```sh
144+
cd Descent3
145+
cmake --preset linux
146+
cmake --build --preset linux --config [Debug|Release]
147+
```
148+
See [Build Options](#build-options) below for more information on `Debug` vs `Release`.
149+
150+
Once CMake finishes, the built files will be put in `builds/linux/Descent3/Debug` or `builds/linux/Descent3/Release`.
151+
152+
## Build Options
153+
154+
The Descent3 build can be customized by [setting CMake variables on the command line](https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-D) during its "Configuration" phase (the command without the `--build` option). To set a variable, you prepend the variable name with `-D` and then append the value, all as one single parameter. For example:
155+
```sh
156+
cmake --preset linux -DENABLE_LOGGER=ON
157+
```
158+
159+
**NOTE:** CMake variables, or more technically _CMake cache entries_, will persist in their values until they are explicitly cleared. So, if you set a variable and then run another CMake command _without_ that variable specified, the variable will still be set. Variables must be explicitly unset, or the `builds/` directory cleaned, in order to be cleared.
160+
161+
| Option | Description | Default |
162+
| ------ | ----------- | ------- |
163+
| `CMAKE_BUILD_TYPE`<br/>(or just [`--config`](https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-build-config), without the `-D` syntax) | <p>`Debug` builds are generally larger, slower and contain extra correctness checks that will validate game data and interrupt gameplay when problems are detected.</p><p>`Release` builds are optimized for size and speed and do not include debugging information, which makes it harder to find problems.</p> | `Debug` |
164+
| `BUILD_EDITOR` | _(Windows-only)_ Build internal editor. | `OFF` |
165+
| `BUILD_TESTING` | Enable testing. Requires GTest. | `OFF` |
166+
| `ENABLE_LOGGER` | Enable logging to the terminal. | `OFF` |
167+
| `ENABLE_MEM_RTL` | Enable Real-time library memory management functions (disable to verbose memory allocations). | `ON` |
168+
| `FORCE_COLORED_OUTPUT` | Always produce ANSI-colored compiler warnings/errors (GCC/Clang only; esp. useful with Ninja). | `OFF` |
169+
| `FORCE_PORTABLE_INSTALL` | Install all files into local directory defined by `CMAKE_INSTALL_PREFIX`. | `ON` |
170+
| `USE_VCPKG` | Explicitly control whether or not to use vcpkg for dependency resolution. `ON` requires the environment variable `VCPKG_ROOT` to be set. | Determined by the existence of `VCPKG_ROOT` in the environment: If it exists, vcpkg is used. |

Brewfile

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ brew "ninja"
99

1010
# zlib
1111
brew "zlib"
12+
13+
brew "glm"

0 commit comments

Comments
 (0)