diff --git a/.gitignore b/.gitignore index a88f79e3f..fda5e9446 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/ +builddir/ .cache/ .idea/ cmake-build-debug/ diff --git a/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.cpp b/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.cpp index 80df00791..0a19a99de 100644 --- a/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.cpp +++ b/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.cpp @@ -1,6 +1,6 @@ #include "../../../../../Minecraft.World/Build/stdafx.h" -#include "../../../Minecraft.World/Socket.h" -#include "../../../Minecraft.World/StringHelpers.h" +#include "../../../../../Minecraft.World/Network/Socket.h" +#include "../../../../../Minecraft.World/Util/StringHelpers.h" #include "PlatformNetworkManagerSony.h" #include "NetworkPlayerSony.h" #include "../GameNetworkManager.h" diff --git a/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.h b/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.h index 3303a054a..4746296d4 100644 --- a/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.h +++ b/Minecraft.Client/Build/Common/Network/Sony/PlatformNetworkManagerSony.h @@ -1,7 +1,7 @@ #pragma once using namespace std; #include -#include "../../../Minecraft.World/C4JThread.h" +#include "../../../../../Minecraft.World/Util/C4JThread.h" #include "../NetworkPlayerInterface.h" #include "../PlatformNetworkManagerInterface.h" #include "../SessionInfo.h" diff --git a/Minecraft.Client/Build/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h b/Minecraft.Client/Build/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h index b3c8f5ccd..3e6e517f5 100644 --- a/Minecraft.Client/Build/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h +++ b/Minecraft.Client/Build/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorageDefines.h @@ -5,10 +5,10 @@ #ifdef __psp2__ #include #include -#elif __ORBIS__ +#elif defined(__ORBIS__) #include #define SceAppUtilSaveDataDataSlot int -#elif __PS3__ +#elif defined(__PS3__) #define SceAppUtilSaveDataDataSlot int #endif diff --git a/Minecraft.Client/Build/Common/zlib/zlib.h b/Minecraft.Client/Build/Common/zlib/zlib.h index 3e0c7672a..dcd91db0e 100644 --- a/Minecraft.Client/Build/Common/zlib/zlib.h +++ b/Minecraft.Client/Build/Common/zlib/zlib.h @@ -31,6 +31,10 @@ #ifndef ZLIB_H #define ZLIB_H +#ifdef __linux__ +#define HAVE_UNISTD_H 1 +#endif + #include "zconf.h" #ifdef __cplusplus diff --git a/Minecraft.Client/Platform/Linux/Stubs/LinuxStubs.h b/Minecraft.Client/Platform/Linux/Stubs/LinuxStubs.h index 338202771..efa4a9c6b 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/LinuxStubs.h +++ b/Minecraft.Client/Platform/Linux/Stubs/LinuxStubs.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/Minecraft.Client/meson.build b/Minecraft.Client/meson.build index 523528e5b..194cda742 100644 --- a/Minecraft.Client/meson.build +++ b/Minecraft.Client/meson.build @@ -1,40 +1,35 @@ -# get all those files (excluding Sony-SDK-dependent, Xbox XUI, and redist dirs) -_client_build_raw = run_command( +# sources that shouldn't be compiled for whatever reason +exclude_sources = [ + ' ! -path "*/Platform/*"', + ' ! -path "*/Build/Common/Network/Sony/*"', + ' ! -path "*/Build/Common/XUI/*"', +] + +# get all those files +client_sources = run_command( 'sh', '-c', - 'find "' + meson.current_source_dir() / 'Build' + '" -name "*.cpp"' + - ' ! -path "*/redist64/*"' + - ' ! -path "*/Network/Sony/*"' + - ' ! -path "*/Common/XUI/*"', + 'find "' + + meson.current_source_dir() + + '" \\( -name "*.cpp" -o -name "*.c" \\) ' + + ' '.join(exclude_sources), check : true, ).stdout().strip().split('\n') -# Non-Build, non-Platform Minecraft.Client sources (Rendering/, UI/, Textures/, -# 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') +platform_sources = [] -# linux files -_linux_cpp_sources = files( - 'Platform/Linux/Linux_App.cpp', - 'Platform/Linux/linux_game_stubs.cpp', - 'Platform/Linux/LinuxGL.cpp', - 'Platform/Linux/Linux_Minecraft.cpp', - 'Platform/Linux/Linux_UIController.cpp', - 'Platform/Linux/Linux_ShutdownManager.cpp', -) - -_linux_c_sources = files( - 'Platform/Linux/Iggy/gdraw/gdraw_glfw.c', -) +# linux-specific files (everything in Platform/Linux) +if host_machine.system() == 'linux' + platform_sources += run_command( + 'sh', '-c', + 'find "' + + meson.current_source_dir() / 'Platform/Linux' + + '" \\( -name "*.cpp" -o -name "*.c" \\) ', + check : true, + ).stdout().strip().split('\n') +endif executable('Minecraft.Client', - _client_build_raw + _client_root_raw + _linux_cpp_sources + _linux_c_sources, + client_sources + platform_sources, include_directories : include_directories('Build'), dependencies : [ render_dep, diff --git a/Minecraft.World/meson.build b/Minecraft.World/meson.build index aef4356b6..02dc995fd 100644 --- a/Minecraft.World/meson.build +++ b/Minecraft.World/meson.build @@ -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 -# Note: the files below are commented-out in CMakeLists.txt (missing headers or -# unfinished ports) and must be excluded from the build. -_world_sources_raw = run_command( +# TODO: make this process more portable using a python script :3 +world_sources = run_command( 'sh', '-c', - 'find "' + meson.current_source_dir() + '" -name "*.cpp"' + - ' ! -name "DurangoStats.cpp"' + - ' ! -name "MemoryChunkStorage.cpp"' + - ' ! -name "MemoryLevelStorage.cpp"' + - ' ! -name "MemoryLevelStorageSource.cpp"' + - ' ! -name "NbtSlotFile.cpp"' + - ' ! -name "SkyIslandDimension.cpp"' + - ' ! -name "ZonedChunkStorage.cpp"' + - ' ! -name "ZoneFile.cpp"' + - ' ! -name "ZoneIo.cpp"', + 'find "' + + meson.current_source_dir() + + '" \\( -name "*.cpp" -o -name "*.c" \\) ' + + ' '.join(exclude_sources), check : true, ).stdout().strip().split('\n') lib_world = static_library('Minecraft.World', - _world_sources_raw, + world_sources, include_directories : include_directories('Build', 'Build/x64headers'), cpp_args : global_cpp_args + global_cpp_defs + [ '-include', meson.current_source_dir() / 'Build/stdafx.h', ], ) -dep_zlib = dependency('zlib') - world_dep = declare_dependency( link_with : lib_world, - dependencies : [dep_zlib], include_directories : include_directories('Build/x64headers'), ) diff --git a/README.md b/README.md index 839ca08f5..a58b26b79 100644 --- a/README.md +++ b/README.md @@ -91,16 +91,16 @@ sudo pacman -S meson ninja ```bash # 1. Configure that bih -meson setup build_meson +meson setup build # 2. Build -ninja -C build_meson +meson compile -C build ``` The binary is output to: ``` -build_meson/Minecraft.Client +build/Minecraft.Client ``` #### Clean @@ -118,7 +118,7 @@ Then re-run `meson setup build_meson` to reconfigure. ```bash # Release build meson setup build_release --buildtype=release -ninja -C build_release +meson compile -C build_release ``` --- diff --git a/meson.build b/meson.build index 47bcbf6f6..49d049994 100644 --- a/meson.build +++ b/meson.build @@ -32,11 +32,16 @@ global_cpp_defs = [ '-D_DEBUG_MENUS_ENABLED', '-D_DEBUG', '-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.Input') subdir('4J.Profile')