Merge pull request #6566 from lioncash/maclibs

CMakeLists: Link in system framework libraries explicitly on macOS
This commit is contained in:
Léo Lam 2018-03-31 11:45:01 +02:00 committed by GitHub
commit 127c2ce394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 18 deletions

View File

@ -282,26 +282,15 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
find_library(APPKIT_LIBRARY AppKit) find_library(APPKIT_LIBRARY AppKit)
find_library(APPSERV_LIBRARY ApplicationServices) find_library(APPSERV_LIBRARY ApplicationServices)
find_library(AU_LIBRARY AudioUnit)
find_library(CARBON_LIBRARY Carbon) find_library(CARBON_LIBRARY Carbon)
find_library(COCOA_LIBRARY Cocoa) find_library(COCOA_LIBRARY Cocoa)
find_library(COREAUDIO_LIBRARY CoreAudio) find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(COREFUND_LIBRARY CoreFoundation)
find_library(CORESERV_LIBRARY CoreServices) find_library(CORESERV_LIBRARY CoreServices)
find_library(FORCEFEEDBACK_LIBRARY ForceFeedback)
find_library(FOUNDATION_LIBRARY Foundation) find_library(FOUNDATION_LIBRARY Foundation)
find_library(IOB_LIBRARY IOBluetooth) find_library(IOB_LIBRARY IOBluetooth)
find_library(IOK_LIBRARY IOKit) find_library(IOK_LIBRARY IOKit)
find_library(OPENGL_LIBRARY OpenGL) find_library(OPENGL_LIBRARY OpenGL)
# Link against OS X system frameworks.
list(APPEND LIBS
${APPKIT_LIBRARY}
${AU_LIBRARY}
${COREAUDIO_LIBRARY}
${COREFUND_LIBRARY}
${CORESERV_LIBRARY}
${IOK_LIBRARY}
)
endif() endif()
if(ENABLE_LTO) if(ENABLE_LTO)

View File

@ -52,6 +52,15 @@ target_link_libraries(common PUBLIC
${VTUNE_LIBRARIES} ${VTUNE_LIBRARIES}
) )
if (APPLE)
target_link_libraries(common
PRIVATE
${APPKIT_LIBRARY}
${COREFOUNDATION_LIBRARY}
${IOK_LIBRARY}
)
endif()
if(ANDROID) if(ANDROID)
target_sources(common PRIVATE target_sources(common PRIVATE
Logging/ConsoleListenerDroid.cpp Logging/ConsoleListenerDroid.cpp

View File

@ -291,6 +291,15 @@ PUBLIC
z z
) )
if (APPLE)
target_link_libraries(core
PRIVATE
${CORESERV_LIBRARY}
${IOB_LIBRARY}
${IOK_LIBRARY}
)
endif()
if(LIBUSB_FOUND) if(LIBUSB_FOUND)
# Using shared LibUSB # Using shared LibUSB
target_link_libraries(core PUBLIC ${LIBUSB_LIBRARIES}) target_link_libraries(core PUBLIC ${LIBUSB_LIBRARIES})

View File

@ -37,10 +37,6 @@ if(WIN32)
ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp
) )
elseif(APPLE) elseif(APPLE)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(CARBON_LIBRARY Carbon)
find_library(COCOA_LIBRARY Cocoa)
find_library(FORCEFEEDBACK_LIBRARY ForceFeedback)
target_sources(inputcommon PRIVATE target_sources(inputcommon PRIVATE
ControllerInterface/OSX/OSX.mm ControllerInterface/OSX/OSX.mm
ControllerInterface/OSX/OSXJoystick.mm ControllerInterface/OSX/OSXJoystick.mm
@ -53,6 +49,7 @@ elseif(APPLE)
${CARBON_LIBRARY} ${CARBON_LIBRARY}
${COCOA_LIBRARY} ${COCOA_LIBRARY}
${FORCEFEEDBACK_LIBRARY} ${FORCEFEEDBACK_LIBRARY}
${IOK_LIBRARY}
) )
elseif(X11_FOUND) elseif(X11_FOUND)
target_sources(inputcommon PRIVATE target_sources(inputcommon PRIVATE

View File

@ -9,9 +9,13 @@ add_library(uicommon
VideoUtils.cpp VideoUtils.cpp
) )
target_link_libraries(uicommon PUBLIC target_link_libraries(uicommon
PUBLIC
common common
cpp-optparse cpp-optparse
PRIVATE
$<$<BOOL:APPLE>:${IOK_LIBRARY}>
) )
if(USE_X11) if(USE_X11)