From bee21a18a66fe54538f04d41509f072fb1426f6f Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Tue, 18 Aug 2020 03:37:28 +0200 Subject: [PATCH] FIX(client): define and export "MumbleMain" also in debug builds This fixes the loader not being able to load the DLL due to the missing symbol. Previously, the function was defined and exported only when "QT_NO_DEBUG" was not defined (i.e. release builds). This was probably the case due to: - Our old environment not providing debug libraries. - The DLL + loader idea only making sense when Mumble is installed. See PR #1684 for further info. --- src/mumble/CMakeLists.txt | 2 ++ src/mumble/main.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mumble/CMakeLists.txt b/src/mumble/CMakeLists.txt index 1f0059afd..31f6e3d29 100644 --- a/src/mumble/CMakeLists.txt +++ b/src/mumble/CMakeLists.txt @@ -246,6 +246,8 @@ set(MUMBLE_SOURCES if(static AND WIN32) # On Windows, building a static client means building the main app into a DLL. add_library(mumble SHARED ${MUMBLE_SOURCES}) + add_compile_definitions(mumble PRIVATE "MUMBLEAPP_DLL") + set_target_properties(mumble PROPERTIES OUTPUT_NAME "mumble_app") if(MINGW) # Remove "lib" prefix. diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp index f223106bc..a757e03d8 100644 --- a/src/mumble/main.cpp +++ b/src/mumble/main.cpp @@ -76,7 +76,7 @@ extern int os_early_init(); extern HWND mumble_mw_hwnd; #endif // Q_OS_WIN -#if defined(Q_OS_WIN) && !defined(QT_NO_DEBUG) +#if defined(Q_OS_WIN) && !defined(MUMBLEAPP_DLL) extern "C" __declspec(dllexport) int main(int argc, char **argv) { #else int main(int argc, char **argv) { @@ -759,7 +759,7 @@ int main(int argc, char **argv) { return res; } -#if defined(Q_OS_WIN) && defined(QT_NO_DEBUG) +#if defined(Q_OS_WIN) && defined(MUMBLEAPP_DLL) extern "C" __declspec(dllexport) int MumbleMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdArg, int cmdShow) { Q_UNUSED(instance) Q_UNUSED(prevInstance)