force zengine to be linked as a whole

This commit is contained in:
Ricardo Luís Vaz Silva 2025-01-10 15:16:17 -03:00 committed by Rachael Alexanderson
commit 57f4fb1d37
11 changed files with 4 additions and 43 deletions

View file

@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 3.16.0 )
cmake_minimum_required( VERSION 3.24.0 )
include(precompiled_headers)
@ -1312,8 +1312,9 @@ add_dependencies( zdoom zengine )
add_dependencies( ztool zengine )
target_link_libraries( zengine ${PROJECT_LIBRARIES} lzma ${ZMUSIC_LIBRARIES} )
target_link_libraries( zdoom zengine )
target_link_libraries( ztool zengine )
target_link_libraries( zdoom "$<LINK_LIBRARY:WHOLE_ARCHIVE,zengine>" )
target_link_libraries( ztool "$<LINK_LIBRARY:WHOLE_ARCHIVE,zengine>" )
# Due to some quirks, we need to do this in this order
if( NOT ZDOOM_OUTPUT_OLDSTYLE )

View file

@ -52,8 +52,6 @@
#include <zmusic.h>
#include "filereadermusicinterface.h"
void LinkMoviePlayer() { }
class MoviePlayer
{
protected:

View file

@ -40,7 +40,6 @@
time_t epochoffset = 0; // epoch start in seconds (0 = January 1st, 1970)
void LinkDate() { }
//==========================================================================
//

View file

@ -81,28 +81,6 @@ AUTOSEG_VARIABLE(CVarDecl, AUTOSEG_VREG)
#undef AUTOSEG_STOP
#undef AUTOSEG_START
void LinkVMThunksActors();
void LinkVMIterators();
void LinkDynArrays();
void LinkMaps();
void LinkDate();
void LinkPPShader();
void LinkMoviePlayer();
void LinkPlayermenu();
void LinkUnreferencedZScriptGlobals()
{
// The linker in C++ only links .obj files from static libraries that it can find direct references to.
// Some source files contain no external references so we have to force the linkage.
LinkVMThunksActors();
LinkVMIterators();
LinkDynArrays();
LinkMaps();
LinkDate();
LinkPPShader();
LinkMoviePlayer();
LinkPlayermenu();
}
void FAutoSeg::Initialize()
{

View file

@ -23,8 +23,6 @@
#include "hwrenderer/postprocessing/hw_postprocessshader.h"
#include "hwrenderer/postprocessing/hw_postprocess.h"
void LinkPPShader() { }
static void ShaderSetEnabled(const FString &shaderName, bool value)
{
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)

View file

@ -39,8 +39,6 @@
#include "types.h"
#include "v_draw.h"
void LinkDynArrays() { }
// We need one specific type for each of the 8 integral VM types and instantiate the needed functions for each of them.
// Dynamic arrays cannot hold structs because for every type there'd need to be an internal implementation which is impossible.

View file

@ -6,7 +6,6 @@
#include "v_draw.h"
#include "maps.h"
void LinkMaps() { }
//==========================================================================
//

View file

@ -1,6 +1,4 @@
void LinkUnreferencedZScriptGlobals();
#if defined(WIN32)
#define WIN32_MEAN_AND_LEAN
@ -10,7 +8,6 @@ int I_GameMain(HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int nCmdS
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int nCmdShow)
{
LinkUnreferencedZScriptGlobals();
return I_GameMain(hInstance, nothing, cmdline, nCmdShow);
}
@ -20,7 +17,6 @@ int I_GameMain(int argc, char** argv);
int main(int argc, char** argv)
{
LinkUnreferencedZScriptGlobals();
return I_GameMain(argc, argv);
}

View file

@ -41,8 +41,6 @@
#include "vm.h"
#include "d_player.h"
void LinkPlayermenu() { }
EXTERN_CVAR(Int, team)
EXTERN_CVAR(Float, autoaim)
EXTERN_CVAR(Bool, neverswitchonpickup)

View file

@ -30,8 +30,6 @@
#include "g_levellocals.h"
#include "vm.h"
void LinkVMIterators() { }
//==========================================================================
//
// scriptable thinker iterator

View file

@ -57,8 +57,6 @@
#include "gi.h"
#include "shadowinlines.h"
void LinkVMThunksActors() { }
DVector2 AM_GetPosition();
int Net_GetLatency(int *ld, int *ad);
void PrintPickupMessage(bool localview, const FString &str);