Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REFAC(client): Get rid of launcher and DLL on Windows
Browse files Browse the repository at this point in the history
davidebeatrici committed Oct 25, 2023
1 parent 1adbe6d commit f70fef8
Showing 8 changed files with 63 additions and 418 deletions.
8 changes: 2 additions & 6 deletions docs/dev/TheMumbleSourceCode.md
Original file line number Diff line number Diff line change
@@ -41,7 +41,6 @@ When cloning the repo, the source tree should look something like this:
├── src
│   ├── crypto
│   ├── mumble
│   ├── mumble_exe
│   ├── murmur
│   └── tests
└── themes
@@ -81,11 +80,8 @@ mainly occupied by various scripts used throughout various tasks surrounding Mum
default configuration file for the Mumble server.

Your main focus should lie on the `src` directory as this is where the bulk of Mumble's source code is living. Directly in `src/` are shared sources
that are used by the Mumble client as well as by the server that live in `src/mumble` and `src/murmur` respectively. The `src/mumble_exe` direcrtory
contains code for the Windows-specific executable. In order to make sense of that you have to know that on Windows we are currently using a bit of an
odd system: The main application is packaged inside a DLL that is loaded by the main executable. This is a historic artifact and currently only
serves to create problems every now and then. In any case though, the mentioned "main executable" whose sole job is loading of that DLL lives in
`mumble_exe`. Generally you don't have to worry about it. The remaining directories within `src` should be somewhat self-explanatory.
that are used by the Mumble client as well as by the server that live in `src/mumble` and `src/murmur` respectively. The remaining directories within
`src` should be somewhat self-explanatory.

The `themes` directory contains all built-in themes that are currently shipped with Mumble. At this point there is only one theme available: the
`Default` theme (note that it contains the Lite and the Dark theme variant). If you want to customize any kind of icons within Mumble, this is the
2 changes: 0 additions & 2 deletions installer/ClientInstaller.cs
Original file line number Diff line number Diff line change
@@ -89,7 +89,6 @@ public ClientInstaller(string version, string arch, Features features) {
"rnnoise.dll",
"speexdsp.dll",
"mumble.exe",
"mumble_app.dll",
};

if (features.overlay) {
@@ -109,7 +108,6 @@ public ClientInstaller(string version, string arch, Features features) {
"rnnoise.dll",
"speexdsp.dll",
"mumble.exe",
"mumble_app.dll",
};

if (features.overlay) {
93 changes: 61 additions & 32 deletions src/mumble/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ set(MUMBLE_ICON "${CMAKE_SOURCE_DIR}/icons/mumble.ico")
set(MUMBLE_ICNS "${CMAKE_SOURCE_DIR}/icons/mumble.icns")

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mumble.rc.in" "${MUMBLE_RC}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mumble_dll.rc.in" "${MUMBLE_DLL_RC}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mumble.plist.in" "${MUMBLE_PLIST}")

include(qt-utils)
@@ -333,42 +332,31 @@ list(APPEND MUMBLE_SOURCES "${CMAKE_BINARY_DIR}/mumble_flags.qrc")

add_library(mumble_client_object_lib OBJECT ${MUMBLE_SOURCES})

if(static AND WIN32)
# On Windows, building a static client means building the main app into a DLL.
add_library(mumble SHARED "main.cpp")
target_compile_definitions(mumble_client_object_lib PUBLIC "MUMBLEAPP_DLL")

set_target_properties(mumble PROPERTIES OUTPUT_NAME "mumble_app")
if(MINGW)
# Remove "lib" prefix.
set_target_properties(mumble PROPERTIES PREFIX "")
endif()

target_sources(mumble_client_object_lib PRIVATE "${MUMBLE_DLL_RC}")

add_subdirectory("${SHARED_SOURCE_DIR}/mumble_exe" "${CMAKE_BINARY_DIR}/mumble_exe")
if(WIN32 AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
# We don't want the console to appear in release builds.
add_executable(mumble WIN32 "main.cpp")
else()
add_executable(mumble "main.cpp")
endif()

if(WIN32)
target_sources(mumble_client_object_lib
PRIVATE
"${CMAKE_SOURCE_DIR}/auxiliary_files/mumble.appcompat.manifest"
"${MUMBLE_RC}"
)
if(WIN32)
target_sources(mumble_client_object_lib
PRIVATE
"${CMAKE_SOURCE_DIR}/auxiliary_files/mumble.appcompat.manifest"
"${MUMBLE_RC}"
)

if(elevation)
set_property(TARGET mumble APPEND_STRING PROPERTY LINK_FLAGS " /MANIFESTUAC:\"level=\'asInvoker\' uiAccess=\'true\'\"")
endif()
elseif(APPLE)
set_target_properties(mumble
PROPERTIES
OUTPUT_NAME "Mumble"
MACOSX_BUNDLE TRUE
RESOURCE ${MUMBLE_ICNS}
MACOSX_BUNDLE_INFO_PLIST ${MUMBLE_PLIST}
)
if(elevation)
set_property(TARGET mumble APPEND_STRING PROPERTY LINK_FLAGS " /MANIFESTUAC:\"level=\'asInvoker\' uiAccess=\'true\'\"")
endif()
elseif(APPLE)
set_target_properties(mumble
PROPERTIES
OUTPUT_NAME "Mumble"
MACOSX_BUNDLE TRUE
RESOURCE ${MUMBLE_ICNS}
MACOSX_BUNDLE_INFO_PLIST ${MUMBLE_PLIST}
)
endif()

add_custom_command(
@@ -1144,3 +1132,44 @@ endif()
target_include_directories(${TARGET_NAME} INTERFACE
$<BUILD_INTERFACE:${AUTOGEN_INCLUDE_DIR}>
)

if(packaging)
set(overlay ON)
set(plugins ON)

if(translations)
list(APPEND installer_vars "--all-languages")
endif()


list(APPEND installer_vars
"--version" ${PROJECT_VERSION}
"--arch" "${MUMBLE_TARGET_ARCH}"
)

if(overlay)
list(APPEND installer_vars
"--overlay"
)
endif()

if(g15)
list(APPEND installer_vars
"--g15"
)
endif()

file(COPY
${CMAKE_SOURCE_DIR}/installer/MumbleInstall.cs
${CMAKE_SOURCE_DIR}/installer/ClientInstaller.cs
DESTINATION
${CMAKE_BINARY_DIR}/installer/client
)

add_custom_command(TARGET mumble
POST_BUILD
COMMAND cscs.exe -cd MumbleInstall.cs
COMMAND cscs.exe ClientInstaller.cs ${installer_vars}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/installer/client
)
endif()
4 changes: 0 additions & 4 deletions src/mumble/Overlay_win.cpp
Original file line number Diff line number Diff line change
@@ -17,10 +17,6 @@
#include "../../overlay/overlay_exe/overlay_exe.h"

// Used by the overlay to detect whether we injected into ourselves.
//
// A similar declaration can be found in mumble_exe's Overlay.cpp,
// for the overlay's self-detection checks to continue working in a
// mumble_app.dll world.
extern "C" __declspec(dllexport) void mumbleSelfDetection(){};

// Determine if the current Mumble client is able to host
49 changes: 0 additions & 49 deletions src/mumble/mumble_dll.rc.in

This file was deleted.

88 changes: 0 additions & 88 deletions src/mumble_exe/CMakeLists.txt

This file was deleted.

14 changes: 0 additions & 14 deletions src/mumble_exe/Overlay.cpp

This file was deleted.

223 changes: 0 additions & 223 deletions src/mumble_exe/mumble_exe.cpp

This file was deleted.

0 comments on commit f70fef8

Please sign in to comment.