From 453270c8b5015f39a44fd34c659e811c6b8048cf Mon Sep 17 00:00:00 2001 From: John Maguire Date: Wed, 5 Dec 2018 18:16:34 +0100 Subject: [PATCH] Fixes for compiling against qt5 on mac --- 3rdparty/libmygpo-qt5/src/CMakeLists.txt | 3 +-- 3rdparty/qocoa/CMakeLists.txt | 2 +- CMakeLists.txt | 6 ------ dist/macdeploy.py | 23 ++++++++++++++++------- ext/clementine-tagreader/CMakeLists.txt | 4 ++-- ext/libclementine-common/CMakeLists.txt | 5 ++--- src/CMakeLists.txt | 15 ++++++++++++--- 7 files changed, 34 insertions(+), 24 deletions(-) diff --git a/3rdparty/libmygpo-qt5/src/CMakeLists.txt b/3rdparty/libmygpo-qt5/src/CMakeLists.txt index c15771c3e..5098160aa 100644 --- a/3rdparty/libmygpo-qt5/src/CMakeLists.txt +++ b/3rdparty/libmygpo-qt5/src/CMakeLists.txt @@ -84,5 +84,4 @@ QT_WRAP_CPP(LIBMYGPO_QT_MOC_SRC ${LIBMYGPO_QT_MOC_H} ) add_library( ${MYGPO_QT_TARGET_NAME} STATIC ${LIBMYGPO_QT_SRC} ${LIBMYGPO_QT_MOC_SRC} ) -target_link_libraries( ${MYGPO_QT_TARGET_NAME} ${QJSON_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ) -target_link_libraries( ${MYGPO_QT_TARGET_NAME} Qt5::Core Qt5::Network ) +target_link_libraries( ${MYGPO_QT_TARGET_NAME} ${QJSON_LIBRARIES} Qt5::Core Qt5::Network ) diff --git a/3rdparty/qocoa/CMakeLists.txt b/3rdparty/qocoa/CMakeLists.txt index b3b7fa4aa..a52ee2e24 100644 --- a/3rdparty/qocoa/CMakeLists.txt +++ b/3rdparty/qocoa/CMakeLists.txt @@ -29,4 +29,4 @@ endif() add_library(Qocoa STATIC ${SOURCES} ${MOC_SOURCES} ${RESOURCES_SOURCES} ) -target_link_libraries(Qocoa ${QT_LIBRARIES}) +target_link_libraries(Qocoa Qt5::Widgets Qt5::MacExtras) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbc2c96e0..c8130577e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,12 +35,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") set(FREEBSD ON) endif() -if(APPLE) - if(NOT QT_MAC_USE_COCOA) - message(FATAL_ERROR "Cocoa support is required") - endif(NOT QT_MAC_USE_COCOA) -endif(APPLE) - set(OpenGL_GL_PREFERENCE LEGACY) find_package(OpenGL) if(OPENGL_FOUND) diff --git a/dist/macdeploy.py b/dist/macdeploy.py index 3371eaed7..08fa5ca7e 100755 --- a/dist/macdeploy.py +++ b/dist/macdeploy.py @@ -30,6 +30,11 @@ FRAMEWORK_SEARCH_PATH = [ os.path.join(os.environ['HOME'], 'Library/Frameworks') ] +STRIP_PREFIX = [ + '@@HOMEBREW_PREFIX@@/opt/qt5/lib/', + '@@HOMEBREW_CELLAR@@/qt5/5.8.0_1/lib/', +] + LIBRARY_SEARCH_PATH = ['/target', '/target/lib', '/usr/local/lib', '/sw/lib'] GSTREAMER_PLUGINS = [ @@ -54,7 +59,7 @@ GSTREAMER_PLUGINS = [ 'libgstapetag.so', 'libgstasf.so', 'libgstaudioparsers.so', - 'libgstfaac.so', + #'libgstfaac.so', 'libgstfaad.so', 'libgstflac.so', 'libgstid3demux.so', @@ -94,16 +99,16 @@ GSTREAMER_SEARCH_PATH = [ ] QT_PLUGINS = [ - 'accessible/libqtaccessiblewidgets.dylib', - 'codecs/libqcncodecs.dylib', - 'codecs/libqjpcodecs.dylib', - 'codecs/libqkrcodecs.dylib', - 'codecs/libqtwcodecs.dylib', + #'accessible/libqtaccessiblewidgets.dylib', + #'codecs/libqcncodecs.dylib', + #'codecs/libqjpcodecs.dylib', + #'codecs/libqkrcodecs.dylib', + #'codecs/libqtwcodecs.dylib', 'iconengines/libqsvgicon.dylib', 'imageformats/libqgif.dylib', 'imageformats/libqico.dylib', 'imageformats/libqjpeg.dylib', - 'imageformats/libqmng.dylib', + #'imageformats/libqmng.dylib', 'imageformats/libqsvg.dylib', ] QT_PLUGINS_SEARCH_PATH = [ @@ -206,6 +211,10 @@ def GetBrokenLibraries(binary): def FindFramework(path): + for prefix in STRIP_PREFIX: + if path.startswith(prefix): + path = path[len(prefix):] + break for search_path in FRAMEWORK_SEARCH_PATH: abs_path = os.path.join(search_path, path) if os.path.exists(abs_path): diff --git a/ext/clementine-tagreader/CMakeLists.txt b/ext/clementine-tagreader/CMakeLists.txt index d846efecd..855e390cf 100644 --- a/ext/clementine-tagreader/CMakeLists.txt +++ b/ext/clementine-tagreader/CMakeLists.txt @@ -29,8 +29,8 @@ target_link_libraries(clementine-tagreader ${TAGLIB_LIBRARIES} libclementine-common libclementine-tagreader - ${QT_QTCORE_LIBRARY} - ${QT_QTNETWORK_LIBRARY} + Qt5::Core + Qt5::Network z ) diff --git a/ext/libclementine-common/CMakeLists.txt b/ext/libclementine-common/CMakeLists.txt index 200f73c96..694836c9e 100644 --- a/ext/libclementine-common/CMakeLists.txt +++ b/ext/libclementine-common/CMakeLists.txt @@ -35,9 +35,8 @@ add_library(libclementine-common STATIC ) target_link_libraries(libclementine-common - ${QT_LIBRARIES} + Qt5::Core + Qt5::Network ${TAGLIB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) - -target_link_libraries(libclementine-common Qt5::Core Qt5::Network) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 76654a4c3..88dff3c20 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1244,13 +1244,22 @@ target_link_libraries(clementine_lib libclementine-common libclementine-tagreader libclementine-remote + + Qt5::Concurrent + Qt5::Core + Qt5::Network + Qt5::OpenGL + Qt5::OpenGL + Qt5::Sql + Qt5::Widgets + Qt5::Xml + ${TAGLIB_LIBRARIES} ${MYGPOQT5_LIBRARIES} ${CHROMAPRINT_LIBRARIES} ${GOBJECT_LIBRARIES} ${GLIB_LIBRARIES} ${GIO_LIBRARIES} - ${QT_LIBRARIES} ${GSTREAMER_BASE_LIBRARIES} ${GSTREAMER_LIBRARIES} ${GSTREAMER_APP_LIBRARIES} @@ -1261,8 +1270,9 @@ target_link_libraries(clementine_lib ${QTIOCOMPRESSOR_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${SQLITE_LIBRARIES} - z + Qocoa + z ) if(HAVE_VISUALISATIONS) @@ -1352,7 +1362,6 @@ if (WIN32) ${QTSPARKLE_LIBRARIES} tinysvcmdns dsound - ${QT_QTGUI_LIBRARY} ) endif (WIN32)