Merge pull request #6514 from lioncash/inputcommon-cmake

InputCommon/CMakeLists: Migrate off add_dolphin_library
This commit is contained in:
Léo Lam 2018-03-26 21:25:27 +02:00 committed by GitHub
commit d3f432946f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 20 deletions

View File

@ -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}")