Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build modernize: Object targets / Client and server build should share objects #14669

Open
sfan5 opened this issue May 15, 2024 · 0 comments
Open
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

Comments

@sfan5
Copy link
Member

sfan5 commented May 15, 2024

Currently building both minetest and minetestserver 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.

@sfan5 sfan5 added @ 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 labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant