summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2022-12-29 23:37:25 -0500
committerGravatar GitHub2022-12-29 23:37:25 -0500
commitc3af6d83724ef4640d2544f09220309cd93c701b (patch)
treed36867fbeb9bcafd8d263e9ba1a6d31fd5f93dd6 /src
parentMerge pull request #9521 from Wollnashorn/global-only-multiplayer-settings (diff)
parentcmake: make Vulkan-Headers external the default (diff)
downloadyuzu-c3af6d83724ef4640d2544f09220309cd93c701b.tar.gz
yuzu-c3af6d83724ef4640d2544f09220309cd93c701b.tar.xz
yuzu-c3af6d83724ef4640d2544f09220309cd93c701b.zip
Merge pull request #9515 from liamwhite/cmake-refactor
CMake: make more features optional
Diffstat (limited to '')
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/audio_core/CMakeLists.txt19
-rw-r--r--src/input_common/CMakeLists.txt15
-rw-r--r--src/input_common/main.cpp24
4 files changed, 49 insertions, 14 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 140415474..c7283e82c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -161,7 +161,10 @@ add_subdirectory(video_core)
161add_subdirectory(network) 161add_subdirectory(network)
162add_subdirectory(input_common) 162add_subdirectory(input_common)
163add_subdirectory(shader_recompiler) 163add_subdirectory(shader_recompiler)
164add_subdirectory(dedicated_room) 164
165if (YUZU_ROOM)
166 add_subdirectory(dedicated_room)
167endif()
165 168
166if (YUZU_TESTS) 169if (YUZU_TESTS)
167 add_subdirectory(tests) 170 add_subdirectory(tests)
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt
index 420ba62e0..e7b595459 100644
--- a/src/audio_core/CMakeLists.txt
+++ b/src/audio_core/CMakeLists.txt
@@ -187,11 +187,7 @@ add_library(audio_core STATIC
187 renderer/voice/voice_info.cpp 187 renderer/voice/voice_info.cpp
188 renderer/voice/voice_info.h 188 renderer/voice/voice_info.h
189 renderer/voice/voice_state.h 189 renderer/voice/voice_state.h
190 sink/cubeb_sink.cpp
191 sink/cubeb_sink.h
192 sink/null_sink.h 190 sink/null_sink.h
193 sink/sdl2_sink.cpp
194 sink/sdl2_sink.h
195 sink/sink.h 191 sink/sink.h
196 sink/sink_details.cpp 192 sink/sink_details.cpp
197 sink/sink_details.h 193 sink/sink_details.h
@@ -222,11 +218,22 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
222 target_link_libraries(audio_core PRIVATE dynarmic::dynarmic) 218 target_link_libraries(audio_core PRIVATE dynarmic::dynarmic)
223endif() 219endif()
224 220
225if(ENABLE_CUBEB) 221if (ENABLE_CUBEB)
222 target_sources(audio_core PRIVATE
223 sink/cubeb_sink.cpp
224 sink/cubeb_sink.h
225 )
226
226 target_link_libraries(audio_core PRIVATE cubeb::cubeb) 227 target_link_libraries(audio_core PRIVATE cubeb::cubeb)
227 target_compile_definitions(audio_core PRIVATE -DHAVE_CUBEB=1) 228 target_compile_definitions(audio_core PRIVATE -DHAVE_CUBEB=1)
228endif() 229endif()
229if(ENABLE_SDL2) 230
231if (ENABLE_SDL2)
232 target_sources(audio_core PRIVATE
233 sink/sdl2_sink.cpp
234 sink/sdl2_sink.h
235 )
236
230 target_link_libraries(audio_core PRIVATE SDL2::SDL2) 237 target_link_libraries(audio_core PRIVATE SDL2::SDL2)
231 target_compile_definitions(audio_core PRIVATE HAVE_SDL2) 238 target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
232endif() 239endif()
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt
index f24c89b04..cef2c4d52 100644
--- a/src/input_common/CMakeLists.txt
+++ b/src/input_common/CMakeLists.txt
@@ -4,14 +4,10 @@
4add_library(input_common STATIC 4add_library(input_common STATIC
5 drivers/camera.cpp 5 drivers/camera.cpp
6 drivers/camera.h 6 drivers/camera.h
7 drivers/gc_adapter.cpp
8 drivers/gc_adapter.h
9 drivers/keyboard.cpp 7 drivers/keyboard.cpp
10 drivers/keyboard.h 8 drivers/keyboard.h
11 drivers/mouse.cpp 9 drivers/mouse.cpp
12 drivers/mouse.h 10 drivers/mouse.h
13 drivers/sdl_driver.cpp
14 drivers/sdl_driver.h
15 drivers/tas_input.cpp 11 drivers/tas_input.cpp
16 drivers/tas_input.h 12 drivers/tas_input.h
17 drivers/touch_screen.cpp 13 drivers/touch_screen.cpp
@@ -62,8 +58,17 @@ if (ENABLE_SDL2)
62 target_compile_definitions(input_common PRIVATE HAVE_SDL2) 58 target_compile_definitions(input_common PRIVATE HAVE_SDL2)
63endif() 59endif()
64 60
61if (ENABLE_LIBUSB)
62 target_sources(input_common PRIVATE
63 drivers/gc_adapter.cpp
64 drivers/gc_adapter.h
65 )
66 target_link_libraries(input_common PRIVATE libusb::usb)
67 target_compile_definitions(input_common PRIVATE HAVE_LIBUSB)
68endif()
69
65create_target_directory_groups(input_common) 70create_target_directory_groups(input_common)
66target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost libusb::usb) 71target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost)
67 72
68if (YUZU_USE_PRECOMPILED_HEADERS) 73if (YUZU_USE_PRECOMPILED_HEADERS)
69 target_precompile_headers(input_common PRIVATE precompiled_headers.h) 74 target_precompile_headers(input_common PRIVATE precompiled_headers.h)
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp
index 86deb4c7c..4dc92f482 100644
--- a/src/input_common/main.cpp
+++ b/src/input_common/main.cpp
@@ -5,7 +5,6 @@
5#include "common/input.h" 5#include "common/input.h"
6#include "common/param_package.h" 6#include "common/param_package.h"
7#include "input_common/drivers/camera.h" 7#include "input_common/drivers/camera.h"
8#include "input_common/drivers/gc_adapter.h"
9#include "input_common/drivers/keyboard.h" 8#include "input_common/drivers/keyboard.h"
10#include "input_common/drivers/mouse.h" 9#include "input_common/drivers/mouse.h"
11#include "input_common/drivers/tas_input.h" 10#include "input_common/drivers/tas_input.h"
@@ -19,6 +18,10 @@
19#include "input_common/input_mapping.h" 18#include "input_common/input_mapping.h"
20#include "input_common/input_poller.h" 19#include "input_common/input_poller.h"
21#include "input_common/main.h" 20#include "input_common/main.h"
21
22#ifdef HAVE_LIBUSB
23#include "input_common/drivers/gc_adapter.h"
24#endif
22#ifdef HAVE_SDL2 25#ifdef HAVE_SDL2
23#include "input_common/drivers/sdl_driver.h" 26#include "input_common/drivers/sdl_driver.h"
24#endif 27#endif
@@ -45,7 +48,9 @@ struct InputSubsystem::Impl {
45 RegisterEngine("keyboard", keyboard); 48 RegisterEngine("keyboard", keyboard);
46 RegisterEngine("mouse", mouse); 49 RegisterEngine("mouse", mouse);
47 RegisterEngine("touch", touch_screen); 50 RegisterEngine("touch", touch_screen);
51#ifdef HAVE_LIBUSB
48 RegisterEngine("gcpad", gcadapter); 52 RegisterEngine("gcpad", gcadapter);
53#endif
49 RegisterEngine("cemuhookudp", udp_client); 54 RegisterEngine("cemuhookudp", udp_client);
50 RegisterEngine("tas", tas_input); 55 RegisterEngine("tas", tas_input);
51 RegisterEngine("camera", camera); 56 RegisterEngine("camera", camera);
@@ -72,7 +77,9 @@ struct InputSubsystem::Impl {
72 UnregisterEngine(keyboard); 77 UnregisterEngine(keyboard);
73 UnregisterEngine(mouse); 78 UnregisterEngine(mouse);
74 UnregisterEngine(touch_screen); 79 UnregisterEngine(touch_screen);
80#ifdef HAVE_LIBUSB
75 UnregisterEngine(gcadapter); 81 UnregisterEngine(gcadapter);
82#endif
76 UnregisterEngine(udp_client); 83 UnregisterEngine(udp_client);
77 UnregisterEngine(tas_input); 84 UnregisterEngine(tas_input);
78 UnregisterEngine(camera); 85 UnregisterEngine(camera);
@@ -95,8 +102,10 @@ struct InputSubsystem::Impl {
95 devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end()); 102 devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end());
96 auto mouse_devices = mouse->GetInputDevices(); 103 auto mouse_devices = mouse->GetInputDevices();
97 devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); 104 devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end());
105#ifdef HAVE_LIBUSB
98 auto gcadapter_devices = gcadapter->GetInputDevices(); 106 auto gcadapter_devices = gcadapter->GetInputDevices();
99 devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); 107 devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end());
108#endif
100 auto udp_devices = udp_client->GetInputDevices(); 109 auto udp_devices = udp_client->GetInputDevices();
101 devices.insert(devices.end(), udp_devices.begin(), udp_devices.end()); 110 devices.insert(devices.end(), udp_devices.begin(), udp_devices.end());
102#ifdef HAVE_SDL2 111#ifdef HAVE_SDL2
@@ -119,9 +128,11 @@ struct InputSubsystem::Impl {
119 if (engine == mouse->GetEngineName()) { 128 if (engine == mouse->GetEngineName()) {
120 return mouse; 129 return mouse;
121 } 130 }
131#ifdef HAVE_LIBUSB
122 if (engine == gcadapter->GetEngineName()) { 132 if (engine == gcadapter->GetEngineName()) {
123 return gcadapter; 133 return gcadapter;
124 } 134 }
135#endif
125 if (engine == udp_client->GetEngineName()) { 136 if (engine == udp_client->GetEngineName()) {
126 return udp_client; 137 return udp_client;
127 } 138 }
@@ -194,9 +205,11 @@ struct InputSubsystem::Impl {
194 if (engine == mouse->GetEngineName()) { 205 if (engine == mouse->GetEngineName()) {
195 return true; 206 return true;
196 } 207 }
208#ifdef HAVE_LIBUSB
197 if (engine == gcadapter->GetEngineName()) { 209 if (engine == gcadapter->GetEngineName()) {
198 return true; 210 return true;
199 } 211 }
212#endif
200 if (engine == udp_client->GetEngineName()) { 213 if (engine == udp_client->GetEngineName()) {
201 return true; 214 return true;
202 } 215 }
@@ -217,7 +230,9 @@ struct InputSubsystem::Impl {
217 void BeginConfiguration() { 230 void BeginConfiguration() {
218 keyboard->BeginConfiguration(); 231 keyboard->BeginConfiguration();
219 mouse->BeginConfiguration(); 232 mouse->BeginConfiguration();
233#ifdef HAVE_LIBUSB
220 gcadapter->BeginConfiguration(); 234 gcadapter->BeginConfiguration();
235#endif
221 udp_client->BeginConfiguration(); 236 udp_client->BeginConfiguration();
222#ifdef HAVE_SDL2 237#ifdef HAVE_SDL2
223 sdl->BeginConfiguration(); 238 sdl->BeginConfiguration();
@@ -227,7 +242,9 @@ struct InputSubsystem::Impl {
227 void EndConfiguration() { 242 void EndConfiguration() {
228 keyboard->EndConfiguration(); 243 keyboard->EndConfiguration();
229 mouse->EndConfiguration(); 244 mouse->EndConfiguration();
245#ifdef HAVE_LIBUSB
230 gcadapter->EndConfiguration(); 246 gcadapter->EndConfiguration();
247#endif
231 udp_client->EndConfiguration(); 248 udp_client->EndConfiguration();
232#ifdef HAVE_SDL2 249#ifdef HAVE_SDL2
233 sdl->EndConfiguration(); 250 sdl->EndConfiguration();
@@ -248,7 +265,6 @@ struct InputSubsystem::Impl {
248 265
249 std::shared_ptr<Keyboard> keyboard; 266 std::shared_ptr<Keyboard> keyboard;
250 std::shared_ptr<Mouse> mouse; 267 std::shared_ptr<Mouse> mouse;
251 std::shared_ptr<GCAdapter> gcadapter;
252 std::shared_ptr<TouchScreen> touch_screen; 268 std::shared_ptr<TouchScreen> touch_screen;
253 std::shared_ptr<TasInput::Tas> tas_input; 269 std::shared_ptr<TasInput::Tas> tas_input;
254 std::shared_ptr<CemuhookUDP::UDPClient> udp_client; 270 std::shared_ptr<CemuhookUDP::UDPClient> udp_client;
@@ -256,6 +272,10 @@ struct InputSubsystem::Impl {
256 std::shared_ptr<VirtualAmiibo> virtual_amiibo; 272 std::shared_ptr<VirtualAmiibo> virtual_amiibo;
257 std::shared_ptr<VirtualGamepad> virtual_gamepad; 273 std::shared_ptr<VirtualGamepad> virtual_gamepad;
258 274
275#ifdef HAVE_LIBUSB
276 std::shared_ptr<GCAdapter> gcadapter;
277#endif
278
259#ifdef HAVE_SDL2 279#ifdef HAVE_SDL2
260 std::shared_ptr<SDLDriver> sdl; 280 std::shared_ptr<SDLDriver> sdl;
261#endif 281#endif