Skip to content

Commit 11a0457

Browse files
authored
Merge pull request #86 from InspirationByte/develop-assisted
- add dav1d linux prebuilt so Linux engine builds are OK - build GUI tools on Linux since no Windows stuff is needed
2 parents 8df9833 + 4eb6589 commit 11a0457

10 files changed

Lines changed: 74 additions & 8 deletions

File tree

‎.github/workflows/linux_build.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
url: https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
6060

6161
- name: Install dependencies 1
62-
run: sudo add-apt-repository universe && sudo apt-get update && sudo apt-get install -y build-essential libsdl2-dev libopenal-dev libxxf86vm-dev
62+
run: sudo add-apt-repository universe && sudo apt-get update && sudo apt-get install -y build-essential meson ninja-build nasm libsdl2-dev libopenal-dev libxxf86vm-dev libdbus-1-dev
6363

6464
- name: Install dependencies 2
6565
run: ./utils/linux_dev_prepare.sh

‎docs/building.md‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ msbuild /m /p:Configuration=Release /p:Platform=x64 build\auto_tests\auto_tests.
5555
### Prerequisites
5656

5757
- clang, make (`build-essential`).
58-
- Development packages for SDL2, OpenAL-soft and libXxf86vm. On Ubuntu:
58+
- Meson, ninja and nasm to build dav1d.
59+
- Development packages for SDL2, OpenAL-soft, libXxf86vm and D-Bus (native file dialogs in `egfMan2`). On Ubuntu:
5960

6061
```
61-
sudo apt-get install build-essential libsdl2-dev libopenal-dev libxxf86vm-dev
62+
sudo apt-get install build-essential meson ninja-build nasm libsdl2-dev libopenal-dev libxxf86vm-dev libdbus-1-dev
6263
```
6364

6465
### Dependencies
@@ -67,10 +68,15 @@ msbuild /m /p:Configuration=Release /p:Platform=x64 build\auto_tests\auto_tests.
6768
./utils/linux_dev_prepare.sh
6869
```
6970

70-
The script downloads Slang into `src_dependency/slang/`. SDL2 and OpenAL come from system packages.
71+
The script downloads Slang into `src_dependency/slang/` and builds dav1d 1.5.4 from source into
72+
`src_dependency/dav1d/`. SDL2 and OpenAL come from system packages.
7173

7274
### Generating projects
7375

76+
The engine workspace is generated with `./utils/premake5 gmake2`. It builds the engine libraries
77+
and tools, including `egfMan2` (for example `make -C build config=debug_x64 egfMan2`). The tests
78+
workspace:
79+
7480
```
7581
./utils/premake5 --file=premake5-tests.lua gmake2
7682
cd build/auto_tests
@@ -84,7 +90,7 @@ names are the lowercase configuration and platform: `debug_x64`, `release_x64`,
8490

8591
For VS Code, additionally run the `vscode` action for the same script
8692
(`./utils/premake5 --file=samples/GPUDriven/premake5.lua vscode`), open the folder and press F5.
87-
GUI tools (`egfMan2`) are not built on Linux.
93+
`egfMan2` is built on Linux as well and uses the D-Bus xdg-desktop-portal backend for native file dialogs.
8894

8995
## Output layout
9096

‎premake5.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require ".premake_modules/vscode"
1111
IS_ANDROID = (_ACTION == "androidndk")
1212

1313
local CAN_BUILD_TOOLS = (_TARGET_OS == "linux" or _TARGET_OS == "windows")
14-
local CAN_BUILD_GUI_TOOLS = (--[[os.target() == "linux" or]] _TARGET_OS == "windows")
14+
local CAN_BUILD_GUI_TOOLS = (_TARGET_OS == "linux" or _TARGET_OS == "windows")
1515

1616
WORKSPACE_NAME = (WORKSPACE_NAME or "Equilibrium2")
1717
ENGINE_DIR = ENGINE_DIR or _WORKING_DIR

‎src_dependency/dav1d/BUILD.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@ meson install -C build
1414

1515
Copy `<install_dir>/include/dav1d` to `include/`, `lib/dav1d.lib` to `lib/`, `bin/dav1d.dll` to `bin/`.
1616

17+
## Linux x86_64
18+
19+
Requires meson, ninja and nasm in `PATH` (for example `sudo apt-get install meson ninja-build nasm`). Run from the repository root:
20+
21+
```
22+
meson setup build <dav1d_src> --backend=ninja --buildtype=release --libdir=lib -Ddefault_library=shared -Denable_tools=false -Denable_tests=false -Denable_examples=false --prefix=<install_dir>
23+
meson compile -C build
24+
meson install -C build
25+
```
26+
27+
Copy `<install_dir>/include/dav1d` to `include/` and the `<install_dir>/lib/libdav1d.so*` files
28+
(with their symlinks) to `lib/x64/`. The build script does this automatically:
29+
30+
```
31+
./utils/linux_dev_prepare.sh
32+
```
33+
1734
## Movie content
1835

1936
`movieLib` plays WebM files with 8 bit 4:2:0 AV1 video and Vorbis audio (mono or stereo). Convert videos with:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
libdav1d.so.7
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
libdav1d.so.7.0.0
2.84 MB
Binary file not shown.

‎src_dependency/dav1d/premake5.lua‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ usage "dav1d"
88
"./lib"
99
}
1010

11+
filter "system:Linux"
12+
libdirs {
13+
"./lib/%{cfg.platform}"
14+
}
15+
1116
filter "system:Windows or system:linux"
1217
links {
1318
"dav1d",
@@ -18,4 +23,9 @@ usage "dav1d"
1823
"{COPYDIR} %[%{!_WORKING_DIR}/src_dependency/dav1d/bin/dav1d*.dll] %[%{!cfg.targetdir}]",
1924
}
2025

21-
-- TODO: linux build, android?
26+
filter "system:Linux"
27+
postbuildcommands {
28+
"{COPYFILE} %[%{!_WORKING_DIR}/src_dependency/dav1d/lib/%{!cfg.platform}/libdav1d.so.7] %[%{!cfg.targetdir}/libdav1d.so.7]",
29+
}
30+
31+
-- TODO: android?

‎tools/egfMan2/egfman2_viewer.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,10 @@ void CState_EGFViewer::DrawBrowserFiltered(const EqString& dirPath)
745745
if (name.Find(m_browserFilter) == -1)
746746
continue;
747747

748-
const EqString label = *relativeDir ? EqString::Format("%s/%s", relativeDir, name.ToCString()) : name;
748+
EqString label(name);
749+
if (*relativeDir)
750+
label = EqString::Format("%s/%s", relativeDir, name.ToCString());
751+
749752
DrawBrowserFile(dirPath, name, label);
750753
}
751754
}

‎utils/linux_dev_prepare.sh‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
11
#!/bin/bash
2+
set -e
23
set -x
34

45
SLANG_VER="2025.19.1"
6+
DAV1D_VER="1.5.4"
57

68
# TODO: openal-soft, SDL2, X11, Wayland, wxGTK packages
79

810
wget "https://github.com/shader-slang/slang/releases/download/v${SLANG_VER}/slang-${SLANG_VER}-linux-x86_64.tar.gz"
911
tar -xzf ./slang-${SLANG_VER}-linux-x86_64.tar.gz -C "./src_dependency/slang/"
1012
rm -f ./slang-${SLANG_VER}-linux-x86_64.tar.gz
1113

14+
# dav1d is built from source: distributions ship older versions than the engine expects
15+
for tool in meson ninja nasm; do
16+
if ! command -v "$tool" >/dev/null; then
17+
echo "$tool is required to build dav1d (on Ubuntu: sudo apt-get install meson ninja-build nasm)" >&2
18+
exit 1
19+
fi
20+
done
21+
22+
dav1d_build_dir="$(mktemp -d)"
23+
trap 'rm -rf "$dav1d_build_dir"' EXIT
24+
25+
wget "https://code.videolan.org/videolan/dav1d/-/archive/${DAV1D_VER}/dav1d-${DAV1D_VER}.tar.gz" -O "${dav1d_build_dir}/dav1d.tar.gz"
26+
tar -xzf "${dav1d_build_dir}/dav1d.tar.gz" -C "$dav1d_build_dir"
27+
28+
meson setup "${dav1d_build_dir}/build" "${dav1d_build_dir}/dav1d-${DAV1D_VER}" \
29+
--backend=ninja --buildtype=release --libdir=lib \
30+
-Ddefault_library=shared -Denable_tools=false -Denable_tests=false -Denable_examples=false \
31+
--prefix="${dav1d_build_dir}/install"
32+
meson compile -C "${dav1d_build_dir}/build"
33+
meson install -C "${dav1d_build_dir}/build"
34+
35+
cp -a "${dav1d_build_dir}/install/include/dav1d/." "./src_dependency/dav1d/include/dav1d/"
36+
rm -rf "./src_dependency/dav1d/lib/x64"
37+
mkdir -p "./src_dependency/dav1d/lib/x64"
38+
cp -a "${dav1d_build_dir}/install/lib/libdav1d.so"* "./src_dependency/dav1d/lib/x64/"
39+
1240
echo "Done"

0 commit comments

Comments
 (0)