Skip to content

Switch to Meson instead of GNUmakefile#665

Open
mcarans wants to merge 20 commits into
OoliteProject:masterfrom
mcarans:meson
Open

Switch to Meson instead of GNUmakefile#665
mcarans wants to merge 20 commits into
OoliteProject:masterfrom
mcarans:meson

Conversation

@mcarans
Copy link
Copy Markdown
Contributor

@mcarans mcarans commented Jun 5, 2026

Meson (using ninja backend) is faster
Meson integrates with IDEs (tested with CLion)
It can generate XCode projects apparently
No need to source GNUstep.sh with all its obscure magic - all required flags are in the build
Top level Makefile remains (although refactored and calls meson)
Also added to manifest:

echo "    git_remote_url = \"$(git config --get remote.origin.url)\";"
echo "    git_commit_hash = \"$(git rev-parse HEAD)\";"

Fixes #577

@oocube
Copy link
Copy Markdown
Contributor

oocube commented Jun 5, 2026

Does meson require all the build files to be mentioned? What happens if we restructure the code but omit updating the build files?

@mcarans
Copy link
Copy Markdown
Contributor Author

mcarans commented Jun 5, 2026

@oocube Yes files are mentioned but in meson.build files in each subfolder under src rather than in one long file in the root

@oocube
Copy link
Copy Markdown
Contributor

oocube commented Jun 5, 2026

You definitely know more about Meson and C++ projects than I do.
But I see the builds and tests were successful. Let's give it a try.

oocube
oocube previously approved these changes Jun 5, 2026
@mcarans
Copy link
Copy Markdown
Contributor Author

mcarans commented Jun 5, 2026

I noticed a problem with the Windows installer - I will investigate

@mcarans
Copy link
Copy Markdown
Contributor Author

mcarans commented Jun 6, 2026

@phkb Given this is a fairly large change, please can you check it works for you.

One thing I've noticed with this and older versions like Oolite 1.93.1-kja-sdl3.2 is that speech doesn't work for me on Windows. This is unrelated to this change. I'm guessing it's related to SDL3. With 1.92.1, speech works ok for me on Windows. On Linux, there is no issue with speech.

@oocube
Copy link
Copy Markdown
Contributor

oocube commented Jun 6, 2026

Looks like there some things we need to check for regularly. I extended
https://wiki.alioth.net/index.php/Common_Testing

@phkb
Copy link
Copy Markdown
Contributor

phkb commented Jun 7, 2026

How do I add meson to my build environment?
I pulled the PR, tried my normal "make debug=no" which failed and told me I needed to use "make release", which also failed with the error "/bin/bash: line 1: meson: command not found". So I'm assuming meson isn't available yet.

@phkb
Copy link
Copy Markdown
Contributor

phkb commented Jun 7, 2026

I ran ShellScripts/Windows/install_deps.sh which didn't seem to help.

@phkb
Copy link
Copy Markdown
Contributor

phkb commented Jun 7, 2026

I notice the install script is failing:

Packages (1) mingw-w64-ucrt-x86_64-sdl3-3.4.2-1

Total Installed Size:  14.31 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? [Y/n]
(1/1) checking keys in keyring                                                                                                                                     [####################################################################################################] 100%
(1/1) checking package integrity                                                                                                                                   [####################################################################################################] 100%
(1/1) loading package files                                                                                                                                        [####################################################################################################] 100%
(1/1) checking for file conflicts                                                                                                                                  [####################################################################################################] 100%
(1/1) checking available disk space                                                                                                                                [####################################################################################################] 100%
:: Processing package changes...
(1/1) reinstalling mingw-w64-ucrt-x86_64-sdl3                                                                                                                      [####################################################################################################] 100%
ShellScripts/Windows/install_deps.sh: line 47: cd: ../../build/packages: No such file or directory
Installing common libraries
Installing spidermonkey package
❌ No file matching mingw-w64-ucrt-x86_64-spidermonkey*any.pkg.tar.zst found!

I'm running the command from root level of the source tree, which is where I would normally run the "make" process. Is that correct?

@mcarans
Copy link
Copy Markdown
Contributor Author

mcarans commented Jun 7, 2026

I notice the install script is failing:

Packages (1) mingw-w64-ucrt-x86_64-sdl3-3.4.2-1

Total Installed Size:  14.31 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? [Y/n]
(1/1) checking keys in keyring                                                                                                                                     [####################################################################################################] 100%
(1/1) checking package integrity                                                                                                                                   [####################################################################################################] 100%
(1/1) loading package files                                                                                                                                        [####################################################################################################] 100%
(1/1) checking for file conflicts                                                                                                                                  [####################################################################################################] 100%
(1/1) checking available disk space                                                                                                                                [####################################################################################################] 100%
:: Processing package changes...
(1/1) reinstalling mingw-w64-ucrt-x86_64-sdl3                                                                                                                      [####################################################################################################] 100%
ShellScripts/Windows/install_deps.sh: line 47: cd: ../../build/packages: No such file or directory
Installing common libraries
Installing spidermonkey package
❌ No file matching mingw-w64-ucrt-x86_64-spidermonkey*any.pkg.tar.zst found!

I'm running the command from root level of the source tree, which is where I would normally run the "make" process. Is that correct?

It's probably simplest to just run setup.cmd from a command prompt to create a fresh up to date environment. setup.cmd installs msys2 and downloads latest dependencies which are then installed by install_deps.sh (which is called by setup.cmd).

Alternatively, you need to download the dependencies manually into build/packages if you just want to run install_deps.sh from an existing msys2: https://github.com/OoliteProject/oolite_windeps_build/releases/tag/0.1.4. Prior to running install_deps.sh, it is a good idea to run pacman -Syu --noconfirm a couple of times to ensure msys2 is up to date. The script will install meson and ninja: pacboy -S meson --noconfirm and pacboy -S ninja --noconfirm.

@mcarans
Copy link
Copy Markdown
Contributor Author

mcarans commented Jun 7, 2026

I've debugged the Windows sound issue - requires fixing pcaudiolib due to SDL3 change:

struct audio_object *
create_xaudio2_object(const char *device,
                      const char *application_name,
                      const char *description)
{
	HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
	if (FAILED(hr) && hr != (HRESULT)0x80010106) {
		return NULL;
	}
...

@phkb
Copy link
Copy Markdown
Contributor

phkb commented Jun 7, 2026

OK, after some fiddling around, I've got the build working. A couple of points:

  1. Running the exe opens a command window first, and then the splash screen appears and the game opens. The command window remains open while the app is running, and closes when the app does. Is that required? It certainly didn't happen before.
  2. The app doesn't have the Oolite icon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build with Meson or CMake and pass the Oolite version from Git rather than hardcoding

3 participants