refactor: clean up meson build scripts, use in-tree zlib

This commit is contained in:
Tropical 2026-03-06 00:17:31 -06:00
parent c55ed7b261
commit 7baf1cbfa1
10 changed files with 69 additions and 60 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
build/ build/
builddir/
.cache/ .cache/
.idea/ .idea/
cmake-build-debug/ cmake-build-debug/

View file

@ -1,6 +1,6 @@
#include "../../../../../Minecraft.World/Build/stdafx.h" #include "../../../../../Minecraft.World/Build/stdafx.h"
#include "../../../Minecraft.World/Socket.h" #include "../../../../../Minecraft.World/Network/Socket.h"
#include "../../../Minecraft.World/StringHelpers.h" #include "../../../../../Minecraft.World/Util/StringHelpers.h"
#include "PlatformNetworkManagerSony.h" #include "PlatformNetworkManagerSony.h"
#include "NetworkPlayerSony.h" #include "NetworkPlayerSony.h"
#include "../GameNetworkManager.h" #include "../GameNetworkManager.h"

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
using namespace std; using namespace std;
#include <vector> #include <vector>
#include "../../../Minecraft.World/C4JThread.h" #include "../../../../../Minecraft.World/Util/C4JThread.h"
#include "../NetworkPlayerInterface.h" #include "../NetworkPlayerInterface.h"
#include "../PlatformNetworkManagerInterface.h" #include "../PlatformNetworkManagerInterface.h"
#include "../SessionInfo.h" #include "../SessionInfo.h"

View file

@ -5,10 +5,10 @@
#ifdef __psp2__ #ifdef __psp2__
#include <stddef.h> #include <stddef.h>
#include <apputil.h> #include <apputil.h>
#elif __ORBIS__ #elif defined(__ORBIS__)
#include <stddef.h> #include <stddef.h>
#define SceAppUtilSaveDataDataSlot int #define SceAppUtilSaveDataDataSlot int
#elif __PS3__ #elif defined(__PS3__)
#define SceAppUtilSaveDataDataSlot int #define SceAppUtilSaveDataDataSlot int
#endif #endif

View file

@ -31,6 +31,10 @@
#ifndef ZLIB_H #ifndef ZLIB_H
#define ZLIB_H #define ZLIB_H
#ifdef __linux__
#define HAVE_UNISTD_H 1
#endif
#include "zconf.h" #include "zconf.h"
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -22,7 +22,6 @@
#include <time.h> #include <time.h>
#include <stdio.h> #include <stdio.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h>
#include <locale> #include <locale>
#include <linux/mman.h> #include <linux/mman.h>
#include <sys/mman.h> #include <sys/mman.h>

View file

@ -1,40 +1,35 @@
# get all those files (excluding Sony-SDK-dependent, Xbox XUI, and redist dirs) # sources that shouldn't be compiled for whatever reason
_client_build_raw = run_command( exclude_sources = [
' ! -path "*/Platform/*"',
' ! -path "*/Build/Common/Network/Sony/*"',
' ! -path "*/Build/Common/XUI/*"',
]
# get all those files
client_sources = run_command(
'sh', '-c', 'sh', '-c',
'find "' + meson.current_source_dir() / 'Build' + '" -name "*.cpp"' + 'find "'
' ! -path "*/redist64/*"' + + meson.current_source_dir()
' ! -path "*/Network/Sony/*"' + + '" \\( -name "*.cpp" -o -name "*.c" \\) '
' ! -path "*/Common/XUI/*"', + ' '.join(exclude_sources),
check : true, check : true,
).stdout().strip().split('\n') ).stdout().strip().split('\n')
# Non-Build, non-Platform Minecraft.Client sources (Rendering/, UI/, Textures/, platform_sources = []
# GameState/, Input/, Level/, Network/, Player/, Commands/, Utils/, etc.)
_client_root_raw = run_command(
'sh', '-c',
'find "' + meson.current_source_dir() + '" -name "*.cpp"' +
' ! -path "*/Build/*"' +
' ! -path "*/Platform/*"' +
' ! -path "*/CMakeFiles/*"',
check : true,
).stdout().strip().split('\n')
# linux files # linux-specific files (everything in Platform/Linux)
_linux_cpp_sources = files( if host_machine.system() == 'linux'
'Platform/Linux/Linux_App.cpp', platform_sources += run_command(
'Platform/Linux/linux_game_stubs.cpp', 'sh', '-c',
'Platform/Linux/LinuxGL.cpp', 'find "'
'Platform/Linux/Linux_Minecraft.cpp', + meson.current_source_dir() / 'Platform/Linux'
'Platform/Linux/Linux_UIController.cpp', + '" \\( -name "*.cpp" -o -name "*.c" \\) ',
'Platform/Linux/Linux_ShutdownManager.cpp', check : true,
) ).stdout().strip().split('\n')
endif
_linux_c_sources = files(
'Platform/Linux/Iggy/gdraw/gdraw_glfw.c',
)
executable('Minecraft.Client', executable('Minecraft.Client',
_client_build_raw + _client_root_raw + _linux_cpp_sources + _linux_c_sources, client_sources + platform_sources,
include_directories : include_directories('Build'), include_directories : include_directories('Build'),
dependencies : [ dependencies : [
render_dep, render_dep,

View file

@ -1,33 +1,38 @@
# sources that shouldn't be compiled for whatever reason
exclude_sources = [
'! -name DurangoStats.cpp', # Durango-specific
# Incomplete/Unused
'! -name SkyIslandDimension.cpp',
'! -name MemoryChunkStorage.cpp',
'! -name MemoryLevelStorage.cpp',
'! -name MemoryLevelStorageSource.cpp',
'! -name NbtSlotFile.cpp',
'! -name ZonedChunkStorage.cpp',
'! -name ZoneFile.cpp',
'! -name ZoneIo.cpp',
]
# GET IT ALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL # GET IT ALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
# Note: the files below are commented-out in CMakeLists.txt (missing headers or # TODO: make this process more portable using a python script :3
# unfinished ports) and must be excluded from the build. world_sources = run_command(
_world_sources_raw = run_command(
'sh', '-c', 'sh', '-c',
'find "' + meson.current_source_dir() + '" -name "*.cpp"' + 'find "'
' ! -name "DurangoStats.cpp"' + + meson.current_source_dir()
' ! -name "MemoryChunkStorage.cpp"' + + '" \\( -name "*.cpp" -o -name "*.c" \\) '
' ! -name "MemoryLevelStorage.cpp"' + + ' '.join(exclude_sources),
' ! -name "MemoryLevelStorageSource.cpp"' +
' ! -name "NbtSlotFile.cpp"' +
' ! -name "SkyIslandDimension.cpp"' +
' ! -name "ZonedChunkStorage.cpp"' +
' ! -name "ZoneFile.cpp"' +
' ! -name "ZoneIo.cpp"',
check : true, check : true,
).stdout().strip().split('\n') ).stdout().strip().split('\n')
lib_world = static_library('Minecraft.World', lib_world = static_library('Minecraft.World',
_world_sources_raw, world_sources,
include_directories : include_directories('Build', 'Build/x64headers'), include_directories : include_directories('Build', 'Build/x64headers'),
cpp_args : global_cpp_args + global_cpp_defs + [ cpp_args : global_cpp_args + global_cpp_defs + [
'-include', meson.current_source_dir() / 'Build/stdafx.h', '-include', meson.current_source_dir() / 'Build/stdafx.h',
], ],
) )
dep_zlib = dependency('zlib')
world_dep = declare_dependency( world_dep = declare_dependency(
link_with : lib_world, link_with : lib_world,
dependencies : [dep_zlib],
include_directories : include_directories('Build/x64headers'), include_directories : include_directories('Build/x64headers'),
) )

View file

@ -91,16 +91,16 @@ sudo pacman -S meson ninja
```bash ```bash
# 1. Configure that bih # 1. Configure that bih
meson setup build_meson meson setup build
# 2. Build # 2. Build
ninja -C build_meson meson compile -C build
``` ```
The binary is output to: The binary is output to:
``` ```
build_meson/Minecraft.Client build/Minecraft.Client
``` ```
#### Clean #### Clean
@ -118,7 +118,7 @@ Then re-run `meson setup build_meson` to reconfigure.
```bash ```bash
# Release build # Release build
meson setup build_release --buildtype=release meson setup build_release --buildtype=release
ninja -C build_release meson compile -C build_release
``` ```
--- ---

View file

@ -32,11 +32,16 @@ global_cpp_defs = [
'-D_DEBUG_MENUS_ENABLED', '-D_DEBUG_MENUS_ENABLED',
'-D_DEBUG', '-D_DEBUG',
'-DDEBUG', '-DDEBUG',
'-DLINUX',
'-D_LINUX',
'-D__linux__',
] ]
if host_machine.system() == 'linux'
global_cpp_defs += [
'-Dlinux',
'-D__linux',
'-D__linux__',
]
endif
subdir('4J.Render') subdir('4J.Render')
subdir('4J.Input') subdir('4J.Input')
subdir('4J.Profile') subdir('4J.Profile')