forked from mumble-voip/mumble
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
127 lines (110 loc) · 3.04 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Copyright 2020-2023 The Mumble Developers. All rights reserved.
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file at the root of the
# Mumble source tree or at <https://www.mumble.info/LICENSE>.
option(retracted-plugins "Build redacted (outdated) plugins as well" OFF)
if(retracted-plugins)
message(STATUS "Including retracted plugins")
endif()
set(AVAILABLE_PLUGINS "")
# Plugins available on all platforms
list(APPEND AVAILABLE_PLUGINS
"link"
)
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
message("Including TestPlugin in debug mode")
list(APPEND AVAILABLE_PLUGINS
"testPlugin"
"deadLockPlugin"
)
endif()
if(WIN32 OR (UNIX AND CMAKE_SYSTEM_NAME STREQUAL "Linux"))
# Plugins available on Windows and Linux
list(APPEND AVAILABLE_PLUGINS
"amongus"
"aoc"
"arma2"
"bf1"
"bf1942"
"bf2"
"bf2142"
"bf3"
"bf4"
"bf4_x86"
"bfbc2"
"bfheroes"
"blacklight"
"borderlands"
"borderlands2"
"breach"
"cod2"
"cod4"
"cod5"
"codmw2"
"codmw2so"
"cs"
"css"
"dods"
"dys"
"etqw"
"ffxiv"
"ffxiv_x64"
"gmod"
"gtaiv"
"gtasa"
"gtav"
"gw"
"hl2dm"
"insurgency"
"jc2"
"l4d"
"l4d2"
"lol"
"lotro"
"ql"
"rl"
"se"
"sr"
"sto"
"tf2"
"ut2004"
"ut3"
"ut99"
"wolfet"
"wow"
"wow_x64"
)
endif()
list(REMOVE_DUPLICATES AVAILABLE_PLUGINS)
# Note: We are assuming that all plugins follow the convention of naming their sub-directory the same as the
# plugin cmake target. Therefore we can use the CURRENT_PLUGIN variable to reference the dir as well as the
# target.
foreach(CURRENT_PLUGIN IN LISTS AVAILABLE_PLUGINS)
set(PLUGIN_RETRACTED OFF)
# If the plugin is retracted the corresponding CMakeLists.txt is supposed to set the
# PLUGIN_RETRACTED variable in the parent scope so that we can access it here
add_subdirectory(${CURRENT_PLUGIN})
if(PLUGIN_RETRACTED AND NOT retracted-plugins)
# The included subdir didn't actually add a target since the associated plugin is retracted
# and therefore it should not be built.
continue()
endif()
target_include_directories(${CURRENT_PLUGIN} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
if(WIN32)
target_compile_definitions(${CURRENT_PLUGIN} PRIVATE "OS_WINDOWS")
target_link_libraries(${CURRENT_PLUGIN} user32.lib)
# Shared library on Windows (e.g. ".dll")
set_target_properties(${CURRENT_PLUGIN} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
install(TARGETS ${CURRENT_PLUGIN} RUNTIME DESTINATION "${MUMBLE_INSTALL_PLUGINDIR}" COMPONENT mumble_client)
elseif(UNIX)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_compile_definitions(${CURRENT_PLUGIN} PRIVATE "OS_LINUX")
elseif(APPLE)
target_compile_definitions(${CURRENT_PLUGIN} PRIVATE "OS_MACOS")
endif()
# Shared library on UNIX (e.g. ".so")
set_target_properties(${CURRENT_PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
install(TARGETS ${CURRENT_PLUGIN} LIBRARY DESTINATION "${MUMBLE_INSTALL_PLUGINDIR}" COMPONENT mumble_client)
endif()
add_dependencies(mumble ${CURRENT_PLUGIN})
endforeach()