Skip to content

Commit

Permalink
replace cmake by meson
Browse files Browse the repository at this point in the history
  • Loading branch information
LizzyFleckenstein03 committed Aug 3, 2024
1 parent a824d80 commit 6f5bb5f
Show file tree
Hide file tree
Showing 53 changed files with 405 additions and 352 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
uses: actions/checkout@v4
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake lua5.3 xorg-dev libgl1-mesa-dev
sudo apt-get install -y build-essential meson cmake lua5.3 xorg-dev libgl1-mesa-dev
- name: Build
run: |
cmake -B build -S src
cd build
make -j$(nproc)
meson setup build
meson compile -C build
7 changes: 2 additions & 5 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
uses: actions/checkout@v4
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake lua5.3 xorg-dev libgl1-mesa-dev mingw-w64 curl zip
sudo apt-get install -y build-essential cmake meson lua5.3 xorg-dev libgl1-mesa-dev mingw-w64 curl zip
- name: Build linux snapshot
run: |
./snapshot.sh
Expand Down
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
build/*
!build/debug.sh
!build/debug_loop.sh
snapshot/*
/build/
!/build/debug.sh
!/build/debug_loop.sh
/snapshots/*
/subprojects/*
!/subprojects/packagefiles
!/subprojects/*.wrap
48 changes: 0 additions & 48 deletions .gitmodules

This file was deleted.

47 changes: 31 additions & 16 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,62 @@
# Building instructions

## Dependencies
You need Git, CMake, Lua, Bash and GCC. Make sure these dependencies are installed on your system. (on Debian based systems: `apt install git cmake build-essential lua5.4`)

All other dependencies are included as submodules, compiled automatically and statically linked.
Make sure to clone the repository recursively:
- You need Git, Meson, CMake, Lua and GCC. Make sure these dependencies are installed on your system.
- Debian: `apt-get install git meson cmake build-essential lua5.4`
- Arch: `pacman -S git meson cmake gcc lua`

```bash
git clone --recurse-submodules https://github.com/dragonblocks/dragonblocks_alpha.git
```
- For the client, OpenGL is required:
- Debian: `apt-get install libgl1-mesa-dev`
- Arch: `pacman -S mesa`

### Dependencies with fallbacks

These dependencies will be built from source if they are not present.

## Client dependencies
- ZLib is required by both client and server.
- Debian: `apt-get install libz-dev`
- Arch: `pacman -S zlib`

If you want to build the client, it is required to install the build dependencies for GLEW and GLFW (on X11/Debian based systems: `apt install xorg-dev libgl1-mesa-dev`).
- The server requires SQLite3.
- Debian: `apt-get install libsqlite3-dev`
- Arch: `pacman -S sqlite3`

- The client requires Freetype2, GLFW and GLEW.
- Debian: `apt-get install libglfw3-dev libglew-dev libfreetype-dev`
- Arch: `pacman -S freetype2 glfw glew`

If you plan to build GLFW and GLEW from source, you still need their build dependencies, refer to:

Refer to:
- https://www.glfw.org/docs/3.3/compile.html
- http://glew.sourceforge.net/build.html

(on X11/Debian based systems: `apt-get install xorg-dev libxkbcommon-dev`)

## Building a debug build
By default CMake will make a debug build if nothing else is specified. Simply use

By default Meson will make a debug build. Simply use

```bash
cmake -B build -S src
cd build
make -j$(nproc)
meson setup build
meson compile -C build
```

to build the dragonblocks client and server.
If you use a debug build, the singleplayer script should be invoked from the build/ directory, because that's where the binaries are located.

## Building a release snapshot
## Building a statically linked release snapshot

```bash
# Native snapshot
./snapshot.sh

# Crosscompiling for windows

# win32 (requires i686-w64-mingw32-gcc-posix)
# win32 (requires i686-w64-mingw32-gcc)
./snapshot.sh win32

# win64 (requires x86_64-w64-mingw32-gcc-posix)
# win64 (requires x86_64-w64-mingw32-gcc)
./snapshot.sh win64
```

Expand Down
2 changes: 1 addition & 1 deletion build/debug.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

if ! make -j$(nproc); then
if ! meson compile; then
exit 1
fi

Expand Down
31 changes: 31 additions & 0 deletions cross/win32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[binaries]
c = '/usr/bin/i686-w64-mingw32-gcc'
cpp = '/usr/bin/i686-w64-mingw32-g++'
objc = '/usr/bin/i686-w64-mingw32-gcc'
ar = '/usr/bin/i686-w64-mingw32-ar'
strip = '/usr/bin/i686-w64-mingw32-strip'
pkg-config = '/usr/bin/i686-w64-mingw32-pkg-config'
windres = '/usr/bin/i686-w64-mingw32-windres'
exe_wrapper = 'wine'
ld = '/usr/bin/i686-w64-mingw32-ld'
cmake = '/usr/bin/cmake'

[properties]
# Directory that contains 'bin', 'lib', etc
root = '/usr/i686-w64-mingw32'
# Directory that contains 'bin', 'lib', etc for the toolchain and system libraries
sys_root = '/usr/i686-w64-mingw32/sys-root/mingw'

[host_machine]
system = 'windows'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'

[cmake]

CMAKE_BUILD_WITH_INSTALL_RPATH = 'ON'
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = 'NEVER'
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = 'ONLY'
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = 'ONLY'
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = 'ONLY'
30 changes: 30 additions & 0 deletions cross/win64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[binaries]
c = '/usr/bin/x86_64-w64-mingw32-gcc'
cpp = '/usr/bin/x86_64-w64-mingw32-g++'
objc = '/usr/bin/x86_64-w64-mingw32-gcc'
ar = '/usr/bin/x86_64-w64-mingw32-ar'
strip = '/usr/bin/x86_64-w64-mingw32-strip'
pkg-config = '/usr/bin/x86_64-w64-mingw32-pkg-config'
windres = '/usr/bin/x86_64-w64-mingw32-windres'
exe_wrapper = 'wine'
cmake = '/usr/bin/cmake'

[properties]
# Directory that contains 'bin', 'lib', etc
root = '/usr/x86_64-w64-mingw32'
# Directory that contains 'bin', 'lib', etc for the toolchain and system libraries
sys_root = '/usr/x86_64-w64-mingw32/sys-root/mingw'

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[cmake]

CMAKE_BUILD_WITH_INSTALL_RPATH = 'ON'
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = 'NEVER'
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = 'ONLY'
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = 'ONLY'
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = 'ONLY'
1 change: 0 additions & 1 deletion deps/asprintf
Submodule asprintf deleted from bae4b1
1 change: 0 additions & 1 deletion deps/dragonnet
Submodule dragonnet deleted from 7a9046
1 change: 0 additions & 1 deletion deps/dragonstd
Submodule dragonstd deleted from 8cb199
1 change: 0 additions & 1 deletion deps/endian.h
Submodule endian.h deleted from f24960
1 change: 0 additions & 1 deletion deps/freetype
Submodule freetype deleted from d59c7c
1 change: 0 additions & 1 deletion deps/getline
Submodule getline deleted from 31d539
1 change: 0 additions & 1 deletion deps/glew-cmake
Submodule glew-cmake deleted from 7c2b75
1 change: 0 additions & 1 deletion deps/glfw
Submodule glfw deleted from 4cb368
1 change: 0 additions & 1 deletion deps/linenoise
Submodule linenoise deleted from 2da54e
1 change: 0 additions & 1 deletion deps/linmath.h
Submodule linmath.h deleted from 053875
1 change: 0 additions & 1 deletion deps/perlin
Submodule perlin deleted from 8a9301
1 change: 0 additions & 1 deletion deps/protogen
Submodule protogen deleted from f50626
1 change: 0 additions & 1 deletion deps/sqlite3-cmake
Submodule sqlite3-cmake deleted from b23390
1 change: 0 additions & 1 deletion deps/stb
Submodule stb deleted from af1a5b
1 change: 0 additions & 1 deletion deps/stpcpy
Submodule stpcpy deleted from 969029
1 change: 0 additions & 1 deletion deps/zlib
Submodule zlib deleted from 4b4fbf
Loading

0 comments on commit 6f5bb5f

Please sign in to comment.