Move library aggregation into common CMakeLists.txt; add missing libs to DolphinQt.

Fixes DolphinQt build (on OS X, anyway) when libav is enabled.
This commit is contained in:
comex 2014-11-19 19:55:52 -05:00
parent 688b1e537e
commit ba4a763410
3 changed files with 43 additions and 47 deletions

View File

@ -48,6 +48,8 @@ endif()
project(dolphin-emu)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests)
set(DOLPHIN_IS_STABLE FALSE)
# Libraries to link
set(LIBS)
# Set up paths
if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
@ -411,6 +413,7 @@ if(NOT ANDROID)
set(HAS_LLVM 1)
include_directories(${LLVM_INCLUDE_DIRS})
list(APPEND LIBS ${LLVM_LIBRARIES})
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
endif()
@ -456,6 +459,10 @@ if(NOT ANDROID)
endif()
if(ENCODE_FRAMEDUMPS)
check_libav()
if(LIBAV_FOUND)
LIST(APPEND LIBS ${LIBAV_LIBRARIES})
endif()
endif()
set(CMAKE_REQUIRED_LIBRARIES portaudio)
@ -535,6 +542,7 @@ else()
include_directories(Externals/LZO)
set(LZO lzo2)
endif()
list(APPEND LIBS ${LZO})
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
check_lib(PNG png png.h QUIET)
@ -619,6 +627,7 @@ if(USE_UPNP)
include_directories(Externals/miniupnpc/src)
endif()
add_definitions(-DUSE_UPNP)
list(APPEND LIBS miniupnpc)
endif()
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
@ -649,6 +658,12 @@ if (ANDROID)
message("Using static iconv from Externals")
include_directories(Externals/libiconv-1.14/include)
add_subdirectory(Externals/libiconv-1.14)
list(APPEND LIBS iconv)
else()
find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c)
find_path(ICONV_INCLUDE_DIR NAMES iconv.h)
list(APPEND LIBS ${ICONV_LIBRARIES})
mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARIES)
endif()
if(ENABLE_QT)
@ -695,6 +710,7 @@ if(NOT DISABLE_WX AND NOT ANDROID)
include(FindGTK2)
if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS})
list(APPEND LIBS ${GTK2_LIBRARIES})
else()
message(FATAL_ERROR "GTK is required to build the WX UI. Please install the GTK development libraries.")
endif()
@ -733,6 +749,23 @@ if(NOT DISABLE_WX AND NOT ANDROID)
add_definitions(-DHAVE_WX=1)
endif(NOT DISABLE_WX AND NOT ANDROID)
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
set(LIBS ${LIBS} usbhid)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Link against OS X system frameworks.
list(APPEND LIBS
${APPKIT_LIBRARY}
${AU_LIBRARY}
${COREAUDIO_LIBRARY}
${COREFUND_LIBRARY}
${CORESERV_LIBRARY}
${IOK_LIBRARY}
${FORCEFEEDBACK}
)
endif()
########################################
# Pre-build events: Define configuration variables and write SCM info header

View File

@ -23,19 +23,9 @@ set(UIS
SystemInfo.ui
)
set(LIBS core uicommon)
list(APPEND LIBS core uicommon)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Link against OS X system frameworks.
list(APPEND LIBS
${APPKIT_LIBRARY}
${AU_LIBRARY}
${COREAUDIO_LIBRARY}
${COREFUND_LIBRARY}
${CORESERV_LIBRARY}
${IOK_LIBRARY}
${FORCEFEEDBACK}
)
set(DOLPHINQT_BINARY DolphinQt)
else()
set(DOLPHINQT_BINARY dolphin-emu-qt)

View File

@ -1,18 +1,3 @@
set(LIBS core
uicommon
${LZO}
${GTK2_LIBRARIES})
if(NOT ANDROID)
link_directories(${CMAKE_PREFIX_PATH}/lib)
else()
set(LIBS ${LIBS} png iconv)
endif()
if(LIBAV_FOUND)
set(LIBS ${LIBS} ${LIBAV_LIBRARIES})
endif()
set(GUI_SRCS
ARCodeAddEdit.cpp
AboutDolphin.cpp
@ -65,24 +50,21 @@ set(GUI_SRCS
set(WXLIBS ${wxWidgets_LIBRARIES} dl)
list(APPEND LIBS core uicommon)
if(ANDROID)
list(APPEND LIBS png)
endif()
set(ANDROID_SRCS Android/ButtonManager.cpp
MainAndroid.cpp)
set(NOGUI_SRCS MainNoGUI.cpp)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Link against OS X system frameworks.
list(APPEND LIBS
${APPKIT_LIBRARY}
${AU_LIBRARY}
${COREAUDIO_LIBRARY}
${COREFUND_LIBRARY}
${CORESERV_LIBRARY}
${IOK_LIBRARY}
${FORCEFEEDBACK}
)
if(wxWidgets_FOUND)
list(APPEND LIBS
list(APPEND WXLIBS
${APPSERV_LIBRARY}
${COCOA_LIBRARY}
)
@ -94,11 +76,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
MACOSX_PACKAGE_LOCATION Resources)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
set(LIBS ${LIBS} usbhid)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(DOLPHIN_EXE_BASE Dolphin)
else()
@ -107,10 +84,6 @@ endif()
set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE})
if(USE_UPNP)
set(LIBS ${LIBS} miniupnpc)
endif()
include(FindGettext)
if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE AND wxWidgets_FOUND)
file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po)
@ -145,7 +118,7 @@ if(ANDROID)
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE})
elseif(wxWidgets_FOUND)
add_executable(${DOLPHIN_EXE} ${SRCS} ${GUI_SRCS})
target_link_libraries(${DOLPHIN_EXE} ${LIBS} ${WXLIBS} ${LLVM_LIBRARIES})
target_link_libraries(${DOLPHIN_EXE} ${LIBS} ${WXLIBS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include(BundleUtilities)
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app)