Build modernize: Object targets / Client and server build should share objects #14669
Labels
@ Build
CMake, build scripts, official builds, compiler and linker errors
Maintenance
Tasks to keep the codebase and related parts in order, including architectural improvements
Performance
Currently building both
minetest
andminetestserver
essentially builds the entirety of our source code twice.But out of our 300+ source files only 43 contain a preprocessor macro that checks
SERVER
, which means the rest (in theory) don't differ between client and server builds.A lot of these are headers which infects other files whenever included but this can be improved once the first step is made.
Step 1:
As it is now absence of
SERVER
indicates a client build. This becomes a risk with files that are built only once because of easy confusion.These should be replaced with a macro
CLIENT_BUILD
which is defined to 0 or 1.Then, if someone uses
#if CLIENT_BUILD
in a file that is supposed to be non-specific a clear compiler warning is raised and the build probably fails at some point anyway.Step 2:
Common files are moved to an object target that is then linked into both the server and the client.
The text was updated successfully, but these errors were encountered: