Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
10c5721
wip
Jammyjamjamman Aug 17, 2022
a95cae1
More meson progress
Jammyjamjamman Aug 22, 2022
6a9aab0
add meson build to the CI
andy5995 Aug 23, 2022
a495101
Meson: Added most stuff to shared_lib
Jammyjamjamman Aug 24, 2022
f8d4532
improve conditions for finding miniupnpc and libircclient
andy5995 Aug 25, 2022
b8dc553
More progress
Jammyjamjamman Aug 26, 2022
46d6b22
mapeditor build
Jammyjamjamman Aug 27, 2022
2438ac8
Everything builds!
Jammyjamjamman Aug 28, 2022
3d8f711
Fix ubuntu build
Jammyjamjamman Aug 28, 2022
9622221
Create meson.yml
andy5995 Oct 10, 2024
7c78e3b
meson.yml: Update
andy5995 Oct 10, 2024
f4220a2
Build and add streflop
andy5995 Oct 11, 2024
73c40b7
Use only meson.yml
andy5995 Feb 6, 2025
d9e5ed3
Use loops to prepend directory names
andy5995 Feb 6, 2025
500224b
Add build script
andy5995 Feb 6, 2025
34e3538
Change buildtype to debugoptimized
andy5995 Feb 6, 2025
f8b0f00
meson.yml: Add FreeBSD job
andy5995 Feb 6, 2025
67675da
Adjust lookup for libircclient
andy5995 Feb 6, 2025
4f98af5
Add fontconfig wrap
andy5995 Feb 6, 2025
47a7103
Add lua wrap
andy5995 Feb 6, 2025
d354922
remove fontconfig requirement
andy5995 Feb 6, 2025
6f316ba
conditionally check /usr/include/libircclient
andy5995 Feb 6, 2025
8bf6e9c
Fix default include path for libircclient
andy5995 Feb 7, 2025
9019d48
cmake.yml: Don't run unless meson workflow completes
andy5995 Feb 7, 2025
c47fd54
Also look in /usr/local/include for libircclient.h
andy5995 Feb 7, 2025
fbf2c14
Search in /usr/local/lib for libircclient
andy5995 Feb 7, 2025
7d58f77
Add macos
andy5995 Feb 7, 2025
51b3a55
Add extra flags
andy5995 Feb 7, 2025
319e97d
mv irclient from shared_lib to game
andy5995 Feb 7, 2025
ca3d020
Add xinit to macos install (fix error?)
andy5995 Feb 7, 2025
1d9f48c
Create symlink to wx-config on FreeBSD
andy5995 Feb 7, 2025
dcbba67
Define streflop unconditionally
andy5995 Feb 7, 2025
30a09f9
Add streflop dep to game
andy5995 Feb 7, 2025
9be9e66
Try to fix streflop and fail
andy5995 Feb 8, 2025
3759665
Add streflop as meson subproject
andy5995 Feb 8, 2025
dfa60ea
add cstd=c++11 (maybe fix freebsd build)
andy5995 Feb 8, 2025
6f0e080
meson format recursive
andy5995 Feb 8, 2025
2438416
add undef=false to default meson opts
andy5995 Feb 9, 2025
d315966
Specify streflop fpu in subproject call
andy5995 Feb 10, 2025
dd37441
some organizing and streflop work
andy5995 Feb 13, 2025
a226005
Fix freeze and crash when starting network game
andy5995 Feb 13, 2025
e126dce
Various unremarkable changes
andy5995 Feb 13, 2025
483a40c
For macos lua dep, don't specify 5.3 (which has been disabled)
andy5995 Feb 13, 2025
b240e8c
Use newer Ubuntu
andy5995 Feb 13, 2025
2778271
undefine a couple macros
andy5995 Feb 13, 2025
581dd49
Add '-ng' to streflop stuff
andy5995 Feb 13, 2025
92bfcb4
Add b_ndebug to default build
andy5995 Feb 14, 2025
4b2b80c
Initial implementation of config_whole for macros
andy5995 Feb 14, 2025
c543b37
Add git rev, add basic options, some improvements and cleanup
andy5995 Feb 17, 2025
4d76bf2
Reformat meson files
andy5995 Feb 17, 2025
8fafecf
output git ver to gitversion.h
andy5995 Feb 17, 2025
6a1729f
More cleanup
andy5995 Feb 17, 2025
10a50ca
Move feathery and miniupnpc from shared lib to game
andy5995 Feb 17, 2025
7994cb0
streflop-ng.wrap: Change revision to HEAD
andy5995 Feb 17, 2025
dbf975b
Organizing dependencies
andy5995 Feb 18, 2025
9658db7
script: only move binaries if they exists
andy5995 Feb 18, 2025
1a29267
cmake.yml: reenable
andy5995 Feb 18, 2025
9509721
math_wrapper: Revert comment (#include)
andy5995 Feb 18, 2025
f973d2a
streflop_cond: Revert macro rename
andy5995 Feb 18, 2025
f3f48a2
meson.yml: Rename jobs
andy5995 Feb 18, 2025
c71ddc1
Conditionally include gitversion.h
andy5995 Feb 18, 2025
bc77501
CI: Add MSYS2 job
andy5995 Feb 20, 2025
9795b1b
ircclient wrap
Jammyjamjamman Mar 11, 2025
f760818
Remove fpu and denormals option from streflop config
andy5995 Mar 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ root = true
end_of_line = lf
insert_final_newline = true
charset = utf-8

[meson.build]
indent_style = space
indent_size = 2
1 change: 0 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,3 @@ jobs:
name: megaglest-x64-macos
retention-days: 1
path: release/*.tar.bz2

127 changes: 127 additions & 0 deletions .github/workflows/meson.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Meson
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

on:
push:
branches: [ develop ]
paths:
- 'source/**/**'
- '**meson.build'
- '**/meson.yml'
pull_request:
branches: [ develop ]
paths:
- 'source/**/**'
- '**meson.build'
- '**/meson.yml'

jobs:
linux:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Get dependencies
run: |
sudo apt update && sudo apt upgrade -y
sudo mk/linux/setupBuildDeps.sh
sudo apt install -y --no-install-recommends meson
# Using pip is only required if a newer version of meson is required
# sudo apt-get install -y python3-pip python3-setuptools # required for pip
# sudo -H python3 -m pip install meson ninja
- name: Build
run: |
mk/test-meson-build.sh

#freebsd:
#runs-on: ubuntu-latest
#name: FreeBSD
#steps:
#- uses: actions/checkout@v4
#- name: Test in FreeBSD
#id: test
#uses: vmactions/freebsd-vm@v1
#with:
#usesh: true
#prepare: |
#pkg install -y \
#bash \
#meson \
#cmake \
#cppunit \
#curl \
#freetype2 \
#fribidi \
#ftgl \
#git \
#glew \
#jpeg-turbo \
#libGLU \
#libircclient \
#libogg \
#libvorbis \
#libX11 \
#libxml2 \
#lua53 \
#mesa-libs \
#miniupnpc \
#openal-soft \
#pkgconf \
#png \
#sdl2 \
#wx30-gtk3

#run: |
#git config --global --add safe.directory /home/runner/work/megaglest-source/megaglest-source
#cd /usr/local/bin
#ln -s wxgtk3u-3.0-config wx-config
#cd -
#mk/test-meson-build.sh

#macos:
#runs-on: macos-latest
#steps:
#- uses: actions/checkout@v4

#- name: Get dependencies
#run: |
#mk/macos/setupBuildDeps.sh

#- name: Build MegaGlest With Clang Compiler
#run: |
#mk/test-meson-build.sh

MSYS:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
install: >-
bison
dos2unix
flex
git
pacboy: >-
gcc:p
cmake:p
ninja:p
pkgconf:p
python-certifi:p
update: true

- name: Install dependencies
shell: msys2 {0}
run: |
pacman --noconfirm --needed -S \
mingw-w64-x86_64-libpng \
mingw-w64-x86_64-meson \
mingw-w64-x86_64-SDL2

- name: Build
shell: msys2 {0}
run: |
mk/test-meson-build.sh

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,8 @@ $RECYCLE.BIN/
*.msi
*.pdb
#

# meson
subprojects/*
!subprojects/packagefiles
!subprojects/*.wrap
69 changes: 69 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
project(
'MegaGlest',
['c', 'cpp'],
version: '3.13.0.999',
meson_version: '>= 0.55.0',
default_options: [
'warning_level=1',
'buildtype=debugoptimized',
'cpp_std=c++11',
'b_ndebug=true',
],
)
# -Db_ndebug=true | Disable assertions.
# Normally meson will add _GLIBCXX_ASSERTIONS to the build flags. When that's
# added, multiplayer network games will crash after starting.

# Setup compiler.
cxx = meson.get_compiler('cpp')
cc = meson.get_compiler('c')

# OS name reference chart
#https://mesonbuild.com/Reference-tables.html#operating-system-names
#
# s_posix = host_machine.system() not in ['windows', 'emscripten', 'android']
host_system = host_machine.system()

# Compiler id reference chart
# https://mesonbuild.com/Reference-tables.html#compiler-ids
#
#if cxx.get_id() == 'msvc'

extra_flags = [
'-fno-common',
'-Werror=odr',
'-Werror=lto-type-mismatch',
'-fno-strict-aliasing',
# '-Werror=strict-aliasing',
'-DHAVE_SYS_IOCTL_H',
]

# Defined in cmake but I didn't find references in the source code
# '-DX11_AVAILABLE'
# -DHAVE_FONTCONFIG'

add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c')
add_project_arguments(cxx.get_supported_arguments(extra_flags), language: 'cpp')

git = find_program('git')
git_version = 'unversioned'
if git.found()
git_version = run_command(
[git, 'rev-parse', '--short', 'HEAD'],
capture: true,
check: true,
)
endif
gitver = configuration_data()
gitver.set_quoted('GITVERSION', git_version.stdout().strip())
gitversion_h = configure_file(output: 'gitversion.h', configuration: gitver)

# Macros will be written to config.h later when configure_file() runs
conf = configuration_data()
conf.set('MESON_BUILD', 1)

subdir('source')

# The config.h file finally is output here, all the data assigned by
# conf.set() will be written to it.
config_h = configure_file(output: 'config_whole.h', configuration: conf)
7 changes: 7 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Build options
option('build_game', type: 'boolean', value: true, description: 'Build editor')
option('build_editor', type: 'boolean', value: true, description: 'Build the map editor')
option('build_viewer', type: 'boolean', value: true, description: 'Build the g3d viewer')

#option('docdir', type : 'string', value : 'share/doc/megaglest',
# description : 'directory where the documentation should be installed to')
2 changes: 2 additions & 0 deletions mk/macos/setupBuildDeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ brew install cmake \
libpng \
libvorbis \
lua \
meson \
miniupnpc \
pkg-config \
sdl2 \
wxwidgets \
xinit \
xorg-server \
zstd
44 changes: 44 additions & 0 deletions mk/test-meson-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh

set -e

HERE="$(readlink -f "$(dirname "$0")")"
SOURCE_ROOT="$HERE/.."
BUILD_DIR="${BUILD_DIR:-$HERE/_build}"

# Ensure BUILD_DIR is an absolute path
[ "${BUILD_DIR#/}" != "$BUILD_DIR" ] || { echo "Error: BUILD_DIR must be an absolute path!"; exit 1; }

# Detect OS type
OS_TYPE="$(uname -s)"

SETUP_OPTS="${BUILD_DIR} ${@}"

cd "$SOURCE_ROOT"
if [ ! -d "$BUILD_DIR" ]; then
meson setup ${SETUP_OPTS}
else
meson setup --reconfigure ${SETUP_OPTS}
fi

cd "$HERE"

meson compile -C "$BUILD_DIR"

GAME_BIN="$BUILD_DIR/source/glest_game/megaglest"
EDITOR_BIN="$BUILD_DIR/source/glest_map_editor/megaglest_editor"
VIEWER_BIN="$BUILD_DIR/source/g3d_viewer/megaglest_g3d_viewer"

# Determine the correct directory based on OS
if [ "$OS_TYPE" = "Darwin" ]; then
TARGET_DIR="$HERE/macos"
else
TARGET_DIR="$HERE/linux"
fi

# Move binaries to the correct directory
for bin in "$GAME_BIN" "$EDITOR_BIN" "$VIEWER_BIN"; do
if [ -f "$bin" ]; then
mv -vf "$bin" "$TARGET_DIR"
fi
done
6 changes: 6 additions & 0 deletions source/config_whole.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file is used for the cmake file and is used now as a placeholder.
// The meson build generates this automatically

#pragma once


1 change: 1 addition & 0 deletions source/g3d_viewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER)
ENDIF()

INCLUDE_DIRECTORIES(${GLEST_LIB_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/source) # For config_whole.h

IF(WIN32)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/source/shared_lib/include/platform/win32)
Expand Down
32 changes: 32 additions & 0 deletions source/g3d_viewer/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
src_viewer = [
'main.cpp',
'renderer.cpp',
'../glest_game/global/config.cpp',
'../glest_game/graphics/unit_particle_type.cpp',
'../glest_game/graphics/particle_type.cpp',
]

# Some includes from the game are required for the viewer.
# Other required includes are imported from the dep_libmegaglest object
inc_viewer = [
'../glest_game/global',
'../glest_game/game',
'../glest_game/graphics',
'../glest_game/facilities',
'../glest_game/sound',
]

executable(
'megaglest_g3d_viewer',
src_viewer,
include_directories: inc_viewer,
dependencies: [
dep_libmegaglest,
wx_dep,
gl_dep,
x11_dep,
jpeg_dep,
png_dep,
glew_dep,
],
)
1 change: 1 addition & 0 deletions source/glest_game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
ENDIF()

INCLUDE_DIRECTORIES( ${GLEST_LIB_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/source) # For config_whole.h

#INCLUDE_DIRECTORIES( ${GLEST_LIB_INCLUDE_ROOT}platform/${SDL_VERSION_SNAME} )

Expand Down
7 changes: 7 additions & 0 deletions source/glest_game/facilities/game_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
// License, or (at your option) any later version
// ==============================================================

// This condition can be removed after the cmake build is deprecated
#ifdef MESON_BUILD
#include "gitversion.h"
#endif

#include "game_util.h"

#include "util.h"
Expand All @@ -35,9 +40,11 @@ const char *mailString = " http://bugs.megaglest.org";
const string glestVersionString = "v3.13-dev";
const string lastCompatibleSaveGameVersionString = "v3.11.1";

// This won't be needed after the cmake build is deprecated
#if defined(GITVERSIONHEADER)
#include "gitversion.h"
#endif

#if defined(GITVERSION) || defined(GITVERSIONHEADER)
const string GIT_RawRev = string(GITVERSION);
#else
Expand Down
Loading
Loading