1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 00:34:46 +01:00

Fix CMakeLists for MinGW cross-compilation

This makes sure that shared library built with MinGW toolchain is linked
statically to *all* its dependencies, including libc, libstdc++, libsdl2
and all the others. This allows producing of working `openrct2.dll` by
cross-compiling.

I hit a bug with libcrypto, a dependency of libssl, which in turn is a
dependency of curl, which creates a `DllMain` entrypoint for static lib
too, but since we don't do anything in ours, this should be safe.

I have only had chance to try it out when cross-compiling, ideally it
should be tested under Cygwin/MSYS too, but it is too bothersome to
setup for me.
This commit is contained in:
Michał Janiszewski
2015-12-28 01:17:28 +01:00
parent c4dcd7d3fe
commit 6a5fc90cd4
3 changed files with 38 additions and 28 deletions

View File

@@ -58,6 +58,11 @@ utf8 **windows_get_command_line_args(int *outNumArgs);
// return 0;
// }
/* DllMain is already defined in one of static libraries we implicitly depend
* on (libcrypto), which is their bug really, but since we don't do anything in
* here, just comment it out.
*/
#ifndef __MINGW32__
/**
* Entry point for when the DLL is loaded. This will be removed when OpenRCT2 can be built as a stand alone application.
*/
@@ -65,6 +70,7 @@ BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
return TRUE;
}
#endif // __MINGW32__
/**
* The function that is called directly from the host application (rct2.exe)'s WinMain. This will be removed when OpenRCT2 can