From 01308330d996c373a10f1bdc89dd4baed11beac6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 24 Mar 2018 14:13:48 -0400 Subject: [PATCH] InputCommon/CMakeLists: Migrate off add_dolphin_library Continues the migration work started in 3a4c3bbe01e7a44ec997f4fbf0b678fba6f2d46c --- Source/Core/InputCommon/CMakeLists.txt | 56 +++++++++++++++++--------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/Source/Core/InputCommon/CMakeLists.txt b/Source/Core/InputCommon/CMakeLists.txt index 7488871511..0efa0e6562 100644 --- a/Source/Core/InputCommon/CMakeLists.txt +++ b/Source/Core/InputCommon/CMakeLists.txt @@ -1,4 +1,5 @@ -set(SRCS InputConfig.cpp +add_library(inputcommon + InputConfig.cpp ControllerEmu/ControllerEmu.cpp ControllerEmu/Control/Control.cpp ControllerEmu/Control/Input.cpp @@ -21,10 +22,13 @@ set(SRCS InputConfig.cpp ControlReference/ControlReference.cpp ControlReference/ExpressionParser.cpp ) -set(LIBS common) + +target_link_libraries(inputcommon PUBLIC + common +) if(WIN32) - set(SRCS ${SRCS} + target_sources(inputcommon PRIVATE ControllerInterface/DInput/DInput.cpp ControllerInterface/DInput/DInputJoystick.cpp ControllerInterface/DInput/DInputKeyboardMouse.cpp @@ -36,40 +40,54 @@ elseif(APPLE) find_library(COREFOUNDATION_LIBRARY CoreFoundation) find_library(CARBON_LIBRARY Carbon) find_library(COCOA_LIBRARY Cocoa) - set(SRCS ${SRCS} + target_sources(inputcommon PRIVATE ControllerInterface/OSX/OSX.mm ControllerInterface/OSX/OSXJoystick.mm ControllerInterface/Quartz/Quartz.mm ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp ) - set(LIBS ${LIBS} ${COREFOUNDATION_LIBRARY} ${CARBON_LIBRARY} ${COCOA_LIBRARY}) + target_link_libraries(inputcommon PUBLIC + ${COREFOUNDATION_LIBRARY} + ${CARBON_LIBRARY} + ${COCOA_LIBRARY} + ) elseif(X11_FOUND) - set(SRCS ${SRCS} + target_sources(inputcommon PRIVATE ControllerInterface/Xlib/XInput2.cpp ) - set(LIBS ${LIBS} ${X11_LIBRARIES} ${X11_INPUT_LIBRARIES}) + target_link_libraries(inputcommon PUBLIC + ${X11_LIBRARIES} + ${X11_INPUT_LIBRARIES} + ) elseif(ANDROID) - add_definitions(-DCIFACE_USE_ANDROID) - set(SRCS ${SRCS} + target_compile_definitions(inputcommon PRIVATE -DCIFACE_USE_ANDROID) + target_sources(inputcommon PRIVATE ControllerInterface/Android/Android.cpp ) endif() if(ANDROID) - set(SRCS ${SRCS} GCAdapter_Android.cpp) + target_sources(inputcommon PRIVATE GCAdapter_Android.cpp) else() - set(SRCS ${SRCS} GCAdapter.cpp) - set(LIBS ${LIBS} ${LIBUSB_LIBRARIES}) + target_sources(inputcommon PRIVATE GCAdapter.cpp) + target_link_libraries(inputcommon PUBLIC ${LIBUSB_LIBRARIES}) endif() if(LIBEVDEV_FOUND AND LIBUDEV_FOUND) - set(SRCS ${SRCS} ControllerInterface/evdev/evdev.cpp) - set(LIBS ${LIBS} ${LIBEVDEV_LIBRARY} ${LIBUDEV_LIBRARY}) + target_sources(inputcommon PRIVATE + ControllerInterface/evdev/evdev.cpp + ) + target_link_libraries(inputcommon PUBLIC + ${LIBEVDEV_LIBRARY} + ${LIBUDEV_LIBRARY} + ) endif() if(UNIX) - set(SRCS ${SRCS} ControllerInterface/Pipes/Pipes.cpp) + target_sources(inputcommon PRIVATE + ControllerInterface/Pipes/Pipes.cpp + ) endif() if(ENABLE_SDL) @@ -89,12 +107,10 @@ if(ENABLE_SDL) endif() endif() if(SDL_TARGET AND TARGET ${SDL_TARGET}) - set(SRCS ${SRCS} ControllerInterface/SDL/SDL.cpp) - set(LIBS ${LIBS} ${SDL_TARGET}) - add_definitions(-DHAVE_SDL=1) + target_sources(inputcommon PRIVATE ControllerInterface/SDL/SDL.cpp) + target_link_libraries(inputcommon PUBLIC ${SDL_TARGET}) + target_compile_definitions(inputcommon PRIVATE -DHAVE_SDL=1) else() message(STATUS "SDL NOT found, disabling SDL input") endif() endif() - -add_dolphin_library(inputcommon "${SRCS}" "${LIBS}")