diff options
author | Robert Adam <dev@robert-adam.de> | 2021-03-04 22:03:05 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2021-03-06 20:57:22 +0300 |
commit | 89693f6bcb860f22039dfeea570ad8f24a3b70f4 (patch) | |
tree | 8bdd3c5915b70f72e049e48ccb37c78113391d70 | |
parent | b63adf6e860ff12a85e339d2e0499ae14f574c49 (diff) |
BUILD(cmake): Exclude files from unity build
The *_plugin_import files will cause collisions in a unity build, so we
have to make sure that they are built separately as usual.
Furthermore the ObjecticeC files don't play well in unity builds (it
seems like they are then treated as cpp files). Thus they are excluded
from that as well.
WinGUID.cpp must also not be included as that breaks the DEFINE_GUID
macro wizardry needed to avoid redefinition errors.
-rw-r--r-- | cmake/qt-utils.cmake | 1 | ||||
-rw-r--r-- | src/mumble/CMakeLists.txt | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/cmake/qt-utils.cmake b/cmake/qt-utils.cmake index 794cb8bdc..b1a15fd5e 100644 --- a/cmake/qt-utils.cmake +++ b/cmake/qt-utils.cmake @@ -8,6 +8,7 @@ function(include_qt_plugin TARGET SCOPE PLUGIN) if(NOT EXISTS ${PATH}) file(WRITE ${PATH} "#include <QtPlugin>\n") set_property(SOURCE ${PATH} PROPERTY GENERATED TRUE SKIP_AUTOGEN TRUE) + set_property(SOURCE ${PATH} PROPERTY SKIP_UNITY_BUILD_INCLUSION TRUE) else() file(READ ${PATH} CONTENT) string(FIND ${CONTENT} ${PLUGIN} INDEX) diff --git a/src/mumble/CMakeLists.txt b/src/mumble/CMakeLists.txt index 949dc6154..18f861cfd 100644 --- a/src/mumble/CMakeLists.txt +++ b/src/mumble/CMakeLists.txt @@ -402,6 +402,12 @@ if(WIN32) "${CMAKE_SOURCE_DIR}/overlay/ods.cpp" ) + # WinGUIDs.cpp includes initguid.h which causes a macro definition in guiddef.h to be + # chaged in such a way that subsequent usages break (redefinition errors). + # Thus we must not package this source file in a unity build allowing other files + # to include plain guiddef.h without having to worry about side-effects. + set_source_files_properties("WinGUIDs.cpp" PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE) + find_pkg(Boost COMPONENTS system @@ -983,3 +989,18 @@ if(wasapi) set_property(TARGET mumble APPEND_STRING PROPERTY LINK_FLAGS " /DELAYLOAD:avrt.dll") endif() endif() + +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0" AND APPLE) + # Prevent objective C files from being included in unity builds as that causes issues + set_source_files_properties( + "AppNap.mm" + "GlobalShortcut_macx.mm" + "Log_macx.mm" + "os_macx.mm" + "TextToSpeech_macx.mm" + "Overlay_macx.mm" + "CoreAudio.mm" + PROPERTIES + SKIP_UNITY_BUILD_INCLUSION TRUE + ) +endif() |