liblastfm-qt5.11.patch 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. From 62a08d490a1e75e3ef5d08f3fb37e65c1563e706 Mon Sep 17 00:00:00 2001
  2. From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
  3. Date: Sun, 1 Apr 2018 11:51:42 +0200
  4. Subject: [PATCH 1/4] Make Qt5 build default and simplify logic, add missing
  5. deps
  6. ---
  7. CMakeLists.txt | 16 ++++++++--------
  8. 1 file changed, 8 insertions(+), 8 deletions(-)
  9. diff --git a/CMakeLists.txt b/CMakeLists.txt
  10. index be88967a..e628611c 100644
  11. --- a/CMakeLists.txt
  12. +++ b/CMakeLists.txt
  13. @@ -27,19 +27,19 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Module
  14. # setup qt stuff
  15. set(CMAKE_AUTOMOC ON)
  16. -option(BUILD_WITH_QT4 "Build liblastfm with Qt4 no matter if Qt5 was found" OFF)
  17. +option(BUILD_WITH_QT4 "Build liblastfm with Qt4" OFF)
  18. -if( NOT BUILD_WITH_QT4 )
  19. - # try Qt5 first, and prefer that if found
  20. - find_package(Qt5Core QUIET)
  21. -endif()
  22. +if(NOT BUILD_WITH_QT4)
  23. + find_package(Qt5 REQUIRED COMPONENTS Core Network Xml CONFIG)
  24. +
  25. + if(BUILD_FINGERPRINT)
  26. + find_package(Qt5Sql REQUIRED CONFIG)
  27. + endif()
  28. -if(Qt5Core_DIR)
  29. set(LASTFM_LIB_VERSION_SUFFIX 5)
  30. - message(STATUS "Found Qt5! Please keep in mind, this is highly experimental and not our main development target..")
  31. include_directories(${Qt5Core_INCLUDE_DIRS})
  32. if(UNIX AND NOT APPLE)
  33. - find_package(Qt5DBus REQUIRED)
  34. + find_package(Qt5DBus REQUIRED CONFIG)
  35. endif()
  36. # macro(qt_wrap_ui)
  37. From ff32d56e5e1bd8b1f86a8e9840c778249ff19118 Mon Sep 17 00:00:00 2001
  38. From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
  39. Date: Sun, 1 Apr 2018 11:56:48 +0200
  40. Subject: [PATCH 2/4] Make use of FeatureSummary
  41. ---
  42. CMakeLists.txt | 3 +++
  43. 1 file changed, 3 insertions(+)
  44. diff --git a/CMakeLists.txt b/CMakeLists.txt
  45. index e628611c..dcdfd91d 100644
  46. --- a/CMakeLists.txt
  47. +++ b/CMakeLists.txt
  48. @@ -20,6 +20,7 @@ option(BUILD_TESTS "Build liblastfm tests" ON)
  49. # installation dirs
  50. include(GNUInstallDirs)
  51. +include(FeatureSummary)
  52. #cmake module path
  53. set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Modules")
  54. @@ -97,3 +98,5 @@ if(BUILD_TESTS)
  55. enable_testing()
  56. add_subdirectory(tests)
  57. endif()
  58. +
  59. +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
  60. From 5762278b29c1ab6559dcca7a1e8fbad1d75134da Mon Sep 17 00:00:00 2001
  61. From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
  62. Date: Sun, 1 Apr 2018 12:06:48 +0200
  63. Subject: [PATCH 3/4] Cleanup include dirs
  64. ---
  65. CMakeLists.txt | 2 +-
  66. 1 file changed, 1 insertion(+), 1 deletion(-)
  67. diff --git a/CMakeLists.txt b/CMakeLists.txt
  68. index dcdfd91d..52589b50 100644
  69. --- a/CMakeLists.txt
  70. +++ b/CMakeLists.txt
  71. @@ -38,10 +38,10 @@ if(NOT BUILD_WITH_QT4)
  72. endif()
  73. set(LASTFM_LIB_VERSION_SUFFIX 5)
  74. - include_directories(${Qt5Core_INCLUDE_DIRS})
  75. if(UNIX AND NOT APPLE)
  76. find_package(Qt5DBus REQUIRED CONFIG)
  77. endif()
  78. + include_directories(Qt5::Core Qt5::Network Qt5::Xml)
  79. # macro(qt_wrap_ui)
  80. # qt5_wrap_ui(${ARGN})
  81. From aeb0cbc56376021444a56a984613faacefedfea9 Mon Sep 17 00:00:00 2001
  82. From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
  83. Date: Sun, 15 Apr 2018 21:31:14 +0200
  84. Subject: [PATCH 4/4] Fix build with Qt 5.11_beta3 (drop qt5_use_modules)
  85. ---
  86. CMakeLists.txt | 3 --
  87. src/CMakeLists.txt | 63 +++++++++++++++++++++++-------------------
  88. src/fingerprint/CMakeLists.txt | 20 ++++++++------
  89. tests/lastfm_add_test.cmake | 16 ++++++-----
  90. 4 files changed, 55 insertions(+), 47 deletions(-)
  91. diff --git a/CMakeLists.txt b/CMakeLists.txt
  92. index 52589b50..c8bc89d9 100644
  93. --- a/CMakeLists.txt
  94. +++ b/CMakeLists.txt
  95. @@ -57,9 +57,6 @@ if(NOT BUILD_WITH_QT4)
  96. # endmacro()
  97. else()
  98. find_package(Qt4 COMPONENTS QtCore QtNetwork QtXml REQUIRED)
  99. -
  100. - macro(qt5_use_modules)
  101. - endmacro()
  102. endif()
  103. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
  104. index 0f872fbd..22ce506c 100644
  105. --- a/src/CMakeLists.txt
  106. +++ b/src/CMakeLists.txt
  107. @@ -3,16 +3,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/global.h.in ${CMAKE_CURRENT_BINARY_DI
  108. add_definitions(${QT_DEFINITIONS})
  109. include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
  110. -set(liblastfm_LIBRARIES
  111. - ${QT_QTCORE_LIBRARY}
  112. - ${QT_QTNETWORK_LIBRARY}
  113. - ${QT_QTXML_LIBRARY}
  114. -)
  115. -
  116. -list(APPEND liblastfm_QT5_MODULES
  117. - Xml
  118. - Network
  119. -)
  120. set(liblastfm_SOURCES
  121. ws.cpp
  122. @@ -49,15 +39,11 @@ if(WIN32)
  123. if(NOT MINGW)
  124. add_definitions("-D_ATL_DLL -D_CRT_SECURE_NO_WARNINGS")
  125. - list(APPEND liblastfm_SOURCES
  126. + set(liblastfm_SOURCES ${liblastfm_SOURCES}
  127. win/WNetworkConnectionMonitor_win.cpp
  128. win/WmiSink.cpp
  129. win/NdisEvents.cpp
  130. )
  131. - list(APPEND liblastfm_LIBRARIES
  132. - winhttp
  133. - wbemuuid
  134. - )
  135. endif()
  136. endif()
  137. @@ -67,30 +53,51 @@ if(APPLE)
  138. #set(CMAKE_OSX_DEPLOYMENT_TARGET 10.5)
  139. #set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}.sdk")
  140. - list(APPEND liblastfm_SOURCES
  141. + set(liblastfm_SOURCES ${liblastfm_SOURCES}
  142. mac/MNetworkConnectionMonitor_mac.cpp
  143. )
  144. -
  145. - find_library(SYSTEMCONFIGURATION_LIBRARY SystemConfiguration)
  146. - find_library(COREFOUNDATION_LIBRARY CoreFoundation)
  147. - list(APPEND liblastfm_LIBRARIES
  148. - ${COREFOUNDATION_LIBRARY}
  149. - ${SYSTEMCONFIGURATION_LIBRARY}
  150. - )
  151. endif()
  152. if(UNIX AND NOT APPLE)
  153. - list(APPEND liblastfm_SOURCES
  154. + set(liblastfm_SOURCES ${liblastfm_SOURCES}
  155. linux/LNetworkConnectionMonitor_linux.cpp
  156. )
  157. - list(APPEND liblastfm_LIBRARIES ${QT_QTDBUS_LIBRARY})
  158. - list(APPEND liblastfm_QT5_MODULES DBus)
  159. endif()
  160. add_library(${LASTFM_LIB_TARGET_NAME} SHARED ${liblastfm_SOURCES})
  161. -qt5_use_modules(${LASTFM_LIB_TARGET_NAME} ${liblastfm_QT5_MODULES})
  162. -target_link_libraries(${LASTFM_LIB_TARGET_NAME} ${liblastfm_LIBRARIES})
  163. +if(Qt5Core_DIR)
  164. + target_link_libraries(${LASTFM_LIB_TARGET_NAME} Qt5::Network Qt5::Xml)
  165. + if(UNIX AND NOT APPLE)
  166. + target_link_libraries(${LASTFM_LIB_TARGET_NAME} Qt5::DBus)
  167. + endif()
  168. +else()
  169. + target_link_libraries(${LASTFM_LIB_TARGET_NAME}
  170. + ${QT_QTCORE_LIBRARY}
  171. + ${QT_QTNETWORK_LIBRARY}
  172. + ${QT_QTXML_LIBRARY}
  173. + )
  174. + if(UNIX AND NOT APPLE)
  175. + target_link_libraries(${LASTFM_LIB_TARGET_NAME} ${QT_QTDBUS_LIBRARY})
  176. + endif()
  177. +endif()
  178. +
  179. +if(WIN32 AND NOT MINGW)
  180. + target_link_libraries(${LASTFM_LIB_TARGET_NAME}
  181. + winhttp
  182. + wbemuuid
  183. + )
  184. +endif()
  185. +
  186. +if(APPLE)
  187. + find_library(SYSTEMCONFIGURATION_LIBRARY SystemConfiguration)
  188. + find_library(COREFOUNDATION_LIBRARY CoreFoundation)
  189. + target_link_libraries(${LASTFM_LIB_TARGET_NAME}
  190. + ${COREFOUNDATION_LIBRARY}
  191. + ${SYSTEMCONFIGURATION_LIBRARY}
  192. + )
  193. +endif()
  194. +
  195. set_target_properties(${LASTFM_LIB_TARGET_NAME} PROPERTIES
  196. VERSION ${LASTFM_VERSION_STRING}
  197. SOVERSION ${LASTFM_SOVERSION}
  198. diff --git a/src/fingerprint/CMakeLists.txt b/src/fingerprint/CMakeLists.txt
  199. index 126f8d90..4a74e0dc 100644
  200. --- a/src/fingerprint/CMakeLists.txt
  201. +++ b/src/fingerprint/CMakeLists.txt
  202. @@ -26,21 +26,23 @@ set(lastfm_fingerprint_HEADERS
  203. add_library(${FINGERPRINT_LIB_TARGET_NAME} SHARED ${lastfm_fingerprint_SOURCES})
  204. -target_link_libraries(${FINGERPRINT_LIB_TARGET_NAME}
  205. - ${LASTFM_LIB_TARGET_NAME}
  206. - ${QT_QTSQL_LIBRARY}
  207. - ${QT_QTCORE_LIBRARY}
  208. - ${LIBSAMPLERATE_LIBRARY}
  209. - ${LIBFFTW3_LIBRARY}
  210. -)
  211. -
  212. set_target_properties(${FINGERPRINT_LIB_TARGET_NAME} PROPERTIES
  213. COMPILE_DEFINITIONS LASTFM_FINGERPRINT_LIB
  214. VERSION ${LASTFM_VERSION_STRING}
  215. SOVERSION ${LASTFM_SOVERSION}
  216. )
  217. -qt5_use_modules(${FINGERPRINT_LIB_TARGET_NAME} Network Sql Xml)
  218. +target_link_libraries(${FINGERPRINT_LIB_TARGET_NAME}
  219. + ${LASTFM_LIB_TARGET_NAME}
  220. + ${LIBSAMPLERATE_LIBRARY}
  221. + ${LIBFFTW3_LIBRARY}
  222. +)
  223. +
  224. +if(Qt5Core_DIR)
  225. + target_link_libraries(${FINGERPRINT_LIB_TARGET_NAME} Qt5::Network Qt5::Sql Qt5::Xml)
  226. +else()
  227. + target_link_libraries(${FINGERPRINT_LIB_TARGET_NAME} ${QT_QTCORE_LIBRARY} ${QT_QTSQL_LIBRARY})
  228. +endif()
  229. install(TARGETS ${FINGERPRINT_LIB_TARGET_NAME}
  230. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  231. diff --git a/tests/lastfm_add_test.cmake b/tests/lastfm_add_test.cmake
  232. index a4a16864..2f0664d9 100644
  233. --- a/tests/lastfm_add_test.cmake
  234. +++ b/tests/lastfm_add_test.cmake
  235. @@ -6,13 +6,15 @@ macro(lastfm_add_test test_class)
  236. configure_file(Test${LASTFM_TEST_CLASS}.h Test${LASTFM_TEST_CLASS}.h)
  237. add_executable(${LASTFM_TEST_CLASS}Test Test${LASTFM_TEST_CLASS}.cpp)
  238. - qt5_use_modules(${LASTFM_TEST_CLASS}Test Core Test Xml Network)
  239. -
  240. - target_link_libraries(${LASTFM_TEST_CLASS}Test
  241. - ${LASTFM_LIB_TARGET_NAME}
  242. - ${QT_QTTEST_LIBRARY}
  243. - ${QT_QTCORE_LIBRARY}
  244. - )
  245. + if(Qt5Core_DIR)
  246. + target_link_libraries(${LASTFM_TEST_CLASS}Test Qt5::Core Qt5::Test Qt5::Xml Qt5::Network
  247. + ${LASTFM_LIB_TARGET_NAME}
  248. + )
  249. + else()
  250. + target_link_libraries(${LASTFM_TEST_CLASS}Test ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY}
  251. + ${LASTFM_LIB_TARGET_NAME}
  252. + )
  253. + endif()
  254. add_test(NAME ${LASTFM_TEST_CLASS}Test COMMAND ${LASTFM_TEST_CLASS}Test)
  255. endmacro()