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
8 CMakeLists.txt | 16 ++++++++--------
9 1 file changed, 8 insertions(+), 8 deletions(-)
11 diff --git a/CMakeLists.txt b/CMakeLists.txt
12 index be88967a..e628611c 100644
15 @@ -27,19 +27,19 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Module
19 -option(BUILD_WITH_QT4 "Build liblastfm with Qt4 no matter if Qt5 was found" OFF)
20 +option(BUILD_WITH_QT4 "Build liblastfm with Qt4" OFF)
22 -if( NOT BUILD_WITH_QT4 )
23 - # try Qt5 first, and prefer that if found
24 - find_package(Qt5Core QUIET)
26 +if(NOT BUILD_WITH_QT4)
27 + find_package(Qt5 REQUIRED COMPONENTS Core Network Xml CONFIG)
29 + if(BUILD_FINGERPRINT)
30 + find_package(Qt5Sql REQUIRED CONFIG)
34 set(LASTFM_LIB_VERSION_SUFFIX 5)
35 - message(STATUS "Found Qt5! Please keep in mind, this is highly experimental and not our main development target..")
36 include_directories(${Qt5Core_INCLUDE_DIRS})
37 if(UNIX AND NOT APPLE)
38 - find_package(Qt5DBus REQUIRED)
39 + find_package(Qt5DBus REQUIRED CONFIG)
44 From ff32d56e5e1bd8b1f86a8e9840c778249ff19118 Mon Sep 17 00:00:00 2001
45 From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
46 Date: Sun, 1 Apr 2018 11:56:48 +0200
47 Subject: [PATCH 2/4] Make use of FeatureSummary
50 CMakeLists.txt | 3 +++
51 1 file changed, 3 insertions(+)
53 diff --git a/CMakeLists.txt b/CMakeLists.txt
54 index e628611c..dcdfd91d 100644
57 @@ -20,6 +20,7 @@ option(BUILD_TESTS "Build liblastfm tests" ON)
60 include(GNUInstallDirs)
61 +include(FeatureSummary)
64 set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Modules")
65 @@ -97,3 +98,5 @@ if(BUILD_TESTS)
67 add_subdirectory(tests)
70 +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
72 From 5762278b29c1ab6559dcca7a1e8fbad1d75134da Mon Sep 17 00:00:00 2001
73 From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
74 Date: Sun, 1 Apr 2018 12:06:48 +0200
75 Subject: [PATCH 3/4] Cleanup include dirs
79 1 file changed, 1 insertion(+), 1 deletion(-)
81 diff --git a/CMakeLists.txt b/CMakeLists.txt
82 index dcdfd91d..52589b50 100644
85 @@ -38,10 +38,10 @@ if(NOT BUILD_WITH_QT4)
88 set(LASTFM_LIB_VERSION_SUFFIX 5)
89 - include_directories(${Qt5Core_INCLUDE_DIRS})
90 if(UNIX AND NOT APPLE)
91 find_package(Qt5DBus REQUIRED CONFIG)
93 + include_directories(Qt5::Core Qt5::Network Qt5::Xml)
96 # qt5_wrap_ui(${ARGN})
98 From aeb0cbc56376021444a56a984613faacefedfea9 Mon Sep 17 00:00:00 2001
99 From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
100 Date: Sun, 15 Apr 2018 21:31:14 +0200
101 Subject: [PATCH 4/4] Fix build with Qt 5.11_beta3 (drop qt5_use_modules)
104 CMakeLists.txt | 3 --
105 src/CMakeLists.txt | 63 +++++++++++++++++++++++-------------------
106 src/fingerprint/CMakeLists.txt | 20 ++++++++------
107 tests/lastfm_add_test.cmake | 16 ++++++-----
108 4 files changed, 55 insertions(+), 47 deletions(-)
110 diff --git a/CMakeLists.txt b/CMakeLists.txt
111 index 52589b50..c8bc89d9 100644
114 @@ -57,9 +57,6 @@ if(NOT BUILD_WITH_QT4)
117 find_package(Qt4 COMPONENTS QtCore QtNetwork QtXml REQUIRED)
119 - macro(qt5_use_modules)
124 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
125 index 0f872fbd..22ce506c 100644
126 --- a/src/CMakeLists.txt
127 +++ b/src/CMakeLists.txt
128 @@ -3,16 +3,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/global.h.in ${CMAKE_CURRENT_BINARY_DI
130 add_definitions(${QT_DEFINITIONS})
131 include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
132 -set(liblastfm_LIBRARIES
133 - ${QT_QTCORE_LIBRARY}
134 - ${QT_QTNETWORK_LIBRARY}
135 - ${QT_QTXML_LIBRARY}
138 -list(APPEND liblastfm_QT5_MODULES
143 set(liblastfm_SOURCES
145 @@ -49,15 +39,11 @@ if(WIN32)
147 add_definitions("-D_ATL_DLL -D_CRT_SECURE_NO_WARNINGS")
149 - list(APPEND liblastfm_SOURCES
150 + set(liblastfm_SOURCES ${liblastfm_SOURCES}
151 win/WNetworkConnectionMonitor_win.cpp
155 - list(APPEND liblastfm_LIBRARIES
162 @@ -67,30 +53,51 @@ if(APPLE)
163 #set(CMAKE_OSX_DEPLOYMENT_TARGET 10.5)
164 #set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}.sdk")
166 - list(APPEND liblastfm_SOURCES
167 + set(liblastfm_SOURCES ${liblastfm_SOURCES}
168 mac/MNetworkConnectionMonitor_mac.cpp
171 - find_library(SYSTEMCONFIGURATION_LIBRARY SystemConfiguration)
172 - find_library(COREFOUNDATION_LIBRARY CoreFoundation)
173 - list(APPEND liblastfm_LIBRARIES
174 - ${COREFOUNDATION_LIBRARY}
175 - ${SYSTEMCONFIGURATION_LIBRARY}
179 if(UNIX AND NOT APPLE)
180 - list(APPEND liblastfm_SOURCES
181 + set(liblastfm_SOURCES ${liblastfm_SOURCES}
182 linux/LNetworkConnectionMonitor_linux.cpp
184 - list(APPEND liblastfm_LIBRARIES ${QT_QTDBUS_LIBRARY})
185 - list(APPEND liblastfm_QT5_MODULES DBus)
188 add_library(${LASTFM_LIB_TARGET_NAME} SHARED ${liblastfm_SOURCES})
189 -qt5_use_modules(${LASTFM_LIB_TARGET_NAME} ${liblastfm_QT5_MODULES})
191 -target_link_libraries(${LASTFM_LIB_TARGET_NAME} ${liblastfm_LIBRARIES})
193 + target_link_libraries(${LASTFM_LIB_TARGET_NAME} Qt5::Network Qt5::Xml)
194 + if(UNIX AND NOT APPLE)
195 + target_link_libraries(${LASTFM_LIB_TARGET_NAME} Qt5::DBus)
198 + target_link_libraries(${LASTFM_LIB_TARGET_NAME}
199 + ${QT_QTCORE_LIBRARY}
200 + ${QT_QTNETWORK_LIBRARY}
201 + ${QT_QTXML_LIBRARY}
203 + if(UNIX AND NOT APPLE)
204 + target_link_libraries(${LASTFM_LIB_TARGET_NAME} ${QT_QTDBUS_LIBRARY})
208 +if(WIN32 AND NOT MINGW)
209 + target_link_libraries(${LASTFM_LIB_TARGET_NAME}
216 + find_library(SYSTEMCONFIGURATION_LIBRARY SystemConfiguration)
217 + find_library(COREFOUNDATION_LIBRARY CoreFoundation)
218 + target_link_libraries(${LASTFM_LIB_TARGET_NAME}
219 + ${COREFOUNDATION_LIBRARY}
220 + ${SYSTEMCONFIGURATION_LIBRARY}
224 set_target_properties(${LASTFM_LIB_TARGET_NAME} PROPERTIES
225 VERSION ${LASTFM_VERSION_STRING}
226 SOVERSION ${LASTFM_SOVERSION}
227 diff --git a/src/fingerprint/CMakeLists.txt b/src/fingerprint/CMakeLists.txt
228 index 126f8d90..4a74e0dc 100644
229 --- a/src/fingerprint/CMakeLists.txt
230 +++ b/src/fingerprint/CMakeLists.txt
231 @@ -26,21 +26,23 @@ set(lastfm_fingerprint_HEADERS
233 add_library(${FINGERPRINT_LIB_TARGET_NAME} SHARED ${lastfm_fingerprint_SOURCES})
235 -target_link_libraries(${FINGERPRINT_LIB_TARGET_NAME}
236 - ${LASTFM_LIB_TARGET_NAME}
237 - ${QT_QTSQL_LIBRARY}
238 - ${QT_QTCORE_LIBRARY}
239 - ${LIBSAMPLERATE_LIBRARY}
240 - ${LIBFFTW3_LIBRARY}
243 set_target_properties(${FINGERPRINT_LIB_TARGET_NAME} PROPERTIES
244 COMPILE_DEFINITIONS LASTFM_FINGERPRINT_LIB
245 VERSION ${LASTFM_VERSION_STRING}
246 SOVERSION ${LASTFM_SOVERSION}
249 -qt5_use_modules(${FINGERPRINT_LIB_TARGET_NAME} Network Sql Xml)
250 +target_link_libraries(${FINGERPRINT_LIB_TARGET_NAME}
251 + ${LASTFM_LIB_TARGET_NAME}
252 + ${LIBSAMPLERATE_LIBRARY}
253 + ${LIBFFTW3_LIBRARY}
257 + target_link_libraries(${FINGERPRINT_LIB_TARGET_NAME} Qt5::Network Qt5::Sql Qt5::Xml)
259 + target_link_libraries(${FINGERPRINT_LIB_TARGET_NAME} ${QT_QTCORE_LIBRARY} ${QT_QTSQL_LIBRARY})
262 install(TARGETS ${FINGERPRINT_LIB_TARGET_NAME}
263 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
264 diff --git a/tests/lastfm_add_test.cmake b/tests/lastfm_add_test.cmake
265 index a4a16864..2f0664d9 100644
266 --- a/tests/lastfm_add_test.cmake
267 +++ b/tests/lastfm_add_test.cmake
268 @@ -6,13 +6,15 @@ macro(lastfm_add_test test_class)
269 configure_file(Test${LASTFM_TEST_CLASS}.h Test${LASTFM_TEST_CLASS}.h)
270 add_executable(${LASTFM_TEST_CLASS}Test Test${LASTFM_TEST_CLASS}.cpp)
272 - qt5_use_modules(${LASTFM_TEST_CLASS}Test Core Test Xml Network)
274 - target_link_libraries(${LASTFM_TEST_CLASS}Test
275 - ${LASTFM_LIB_TARGET_NAME}
276 - ${QT_QTTEST_LIBRARY}
277 - ${QT_QTCORE_LIBRARY}
280 + target_link_libraries(${LASTFM_TEST_CLASS}Test Qt5::Core Qt5::Test Qt5::Xml Qt5::Network
281 + ${LASTFM_LIB_TARGET_NAME}
284 + target_link_libraries(${LASTFM_TEST_CLASS}Test ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY}
285 + ${LASTFM_LIB_TARGET_NAME}
289 add_test(NAME ${LASTFM_TEST_CLASS}Test COMMAND ${LASTFM_TEST_CLASS}Test)