forked from Greedysky/TTKMusicPlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
219 lines (186 loc) · 7.18 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
cmake_minimum_required(VERSION 2.8.11)
add_definitions(-DMUSIC_LIBRARY)
set(TTK_VERSION "2.7.0.0")
# Find includes in the build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Turn on automatic invocation of the MOC
set(CMAKE_AUTOMOC OFF)
# Add a compiler flag
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -pthread -fopenmp -Wall")
# Build Type
set(CMAKE_BUILD_TYPE Release CACHE STRING "set build type to Release")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release Debug)
option(TTK_BUILD_SHARED "TTK BUILD SHARED LIBS" ON)
if(TTK_BUILD_SHARED)
message(STATUS "Message TTK build by shared link")
else()
message(STATUS "Message TTK build by static link")
endif()
set(MUSIC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(MUSIC_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/TTKModule")
set(MUSIC_LIB_CORE_DIR "${MUSIC_LIB_DIR}/TTKCore")
set(MUSIC_LIB_WIDGET_DIR "${MUSIC_LIB_DIR}/TTKWidget")
include_directories(
${MUSIC_DIR}
${MUSIC_LIB_DIR}
)
set(MUSIC_CORE_DIR "${MUSIC_LIB_CORE_DIR}/musicCoreKits")
set(MUSIC_CORE_LRCMANAGER_DIR "${MUSIC_LIB_CORE_DIR}/musicLrcKits")
set(MUSIC_CORE_NETWORK_DIR "${MUSIC_LIB_CORE_DIR}/musicNetworkKits")
set(MUSIC_CORE_LOCALSEARCH_DIR "${MUSIC_LIB_CORE_DIR}/musicSearchKits")
set(MUSIC_CORE_TOOLSWIDGET_DIR "${MUSIC_LIB_CORE_DIR}/musicToolsKits")
set(MUSIC_CORE_TOOLSETSWIDGET_DIR "${MUSIC_LIB_CORE_DIR}/musicToolsSetsKits")
set(MUSIC_CORE_USERMANAGER_DIR "${MUSIC_LIB_CORE_DIR}/musicUserKits")
set(MUSIC_CORE_UTILS_DIR "${MUSIC_LIB_CORE_DIR}/musicUtilsKits")
set(MUSIC_CORE_VIDEOKITS_DIR "${MUSIC_LIB_CORE_DIR}/musicVideoKits")
include_directories(
${MUSIC_CORE_DIR}
${MUSIC_CORE_LRCMANAGER_DIR}
${MUSIC_CORE_NETWORK_DIR}
${MUSIC_CORE_NETWORK_DIR}/bd
${MUSIC_CORE_NETWORK_DIR}/kg
${MUSIC_CORE_NETWORK_DIR}/kw
${MUSIC_CORE_NETWORK_DIR}/nr
${MUSIC_CORE_NETWORK_DIR}/qq
${MUSIC_CORE_NETWORK_DIR}/radio
${MUSIC_CORE_NETWORK_DIR}/radio/dj
${MUSIC_CORE_NETWORK_DIR}/radio/mv
${MUSIC_CORE_NETWORK_DIR}/radio/fm
${MUSIC_CORE_NETWORK_DIR}/wy
${MUSIC_CORE_NETWORK_DIR}/xm
${MUSIC_CORE_NETWORK_DIR}/yyt
${MUSIC_CORE_NETWORK_DIR}/ztl
${MUSIC_CORE_LOCALSEARCH_DIR}
${MUSIC_CORE_TOOLSWIDGET_DIR}
${MUSIC_CORE_TOOLSETSWIDGET_DIR}
${MUSIC_CORE_USERMANAGER_DIR}
${MUSIC_CORE_UTILS_DIR}
${MUSIC_CORE_VIDEOKITS_DIR}
)
set(MUSIC_WIDGET_DIR "${MUSIC_LIB_WIDGET_DIR}/musicWidgetKits")
set(MUSIC_WIDGET_CORE_DIR "${MUSIC_LIB_WIDGET_DIR}/musicWidgetCoreKits")
set(MUSIC_WIDGET_LRCMANAGER_DIR "${MUSIC_LIB_WIDGET_DIR}/musicLrcKits")
set(MUSIC_WIDGET_REMOTEWIDGET_DIR "${MUSIC_LIB_WIDGET_DIR}/musicRemoteKits")
set(MUSIC_WIDGET_LOCALSEARCH_DIR "${MUSIC_LIB_WIDGET_DIR}/musicSearchKits")
set(MUSIC_WIDGET_TOOLSWIDGET_DIR "${MUSIC_LIB_WIDGET_DIR}/musicToolsKits")
set(MUSIC_WIDGET_TOOLSETSWIDGET_DIR "${MUSIC_LIB_WIDGET_DIR}/musicToolsSetsKits")
set(MUSIC_WIDGET_UI_DIR "${MUSIC_LIB_WIDGET_DIR}/musicUiKits")
set(MUSIC_WIDGET_USERMANAGER_DIR "${MUSIC_LIB_WIDGET_DIR}/musicUserKits")
set(MUSIC_WIDGET_VIDEOKITS_DIR "${MUSIC_LIB_WIDGET_DIR}/musicVideoKits")
include_directories(
${MUSIC_WIDGET_DIR}
${MUSIC_WIDGET_CORE_DIR}
${MUSIC_WIDGET_LRCMANAGER_DIR}
${MUSIC_WIDGET_REMOTEWIDGET_DIR}
${MUSIC_WIDGET_LOCALSEARCH_DIR}
${MUSIC_WIDGET_TOOLSWIDGET_DIR}
${MUSIC_WIDGET_TOOLSETSWIDGET_DIR}
${MUSIC_WIDGET_UI_DIR}
${MUSIC_WIDGET_USERMANAGER_DIR}
${MUSIC_WIDGET_VIDEOKITS_DIR}
)
set(MUSIC_SCRIPT_DIR "${MUSIC_DIR}/TTKScript")
set(MUSIC_QRC_DIR "${MUSIC_DIR}/TTKQrc")
set(MUSIC_LANGUAGE_DIR "${MUSIC_DIR}/TTKLanguage")
set(MUSIC_RESOURCE_DIR "${MUSIC_DIR}/TTKResource")
set(MUSIC_THIRDPARTY_DIR "${MUSIC_DIR}/TTKThirdParty")
set(MUSIC_TTKSERVICE_DIR "${MUSIC_DIR}/TTKService")
include_directories(
${MUSIC_THIRDPARTY_DIR}
${MUSIC_THIRDPARTY_DIR}/Zlib
${MUSIC_THIRDPARTY_DIR}/TTKWatcher
${MUSIC_THIRDPARTY_DIR}/TTKDumper
${MUSIC_THIRDPARTY_DIR}/TTKExtras
)
if(WIN32)
set(MUSIC_INSTALL_DIR "${CMAKE_CACHEFILE_DIR}/bin")
else(UNIX)
set(MUSIC_INSTALL_DIR "${CMAKE_CACHEFILE_DIR}/lib")
endif()
set(LIBRARY_OUTPUT_PATH ${MUSIC_INSTALL_DIR}/${TTK_VERSION})
set(EXECUTABLE_OUTPUT_PATH ${MUSIC_INSTALL_DIR}/${TTK_VERSION})
set(OPENSSL_DIR "" CACHE PATH "Openssl install path")
set(TTK_QT_VERSION "0" CACHE STRING "Expected Qt version")
set_property(CACHE TTK_QT_VERSION PROPERTY STRINGS 4 5)
if(NOT (TTK_QT_VERSION STREQUAL "4" OR TTK_QT_VERSION STREQUAL "5"))
message(FATAL_ERROR "Message Expected value for TTK_QT_VERSION is either '4' or '5'")
endif()
set(CMAKE_PREFIX_PATH ${QT_INSTALL_DIR} CACHE PATH "Qt install path")
find_program(QT_QMAKE_EXECUTABLE qmake ${QT_INSTALL_BINS})
if(QT_QMAKE_EXECUTABLE)
message(STATUS "Message Found qmake executable: " ${QT_QMAKE_EXECUTABLE})
else()
message(FATAL_ERROR "Message Could NOT find qmake executable")
endif()
if(TTK_QT_VERSION VERSION_GREATER "4")
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Sql REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Multimedia REQUIRED)
find_package(Qt5MultimediaWidgets REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Xml REQUIRED)
if(WIN32)
find_package(Qt5WinExtras REQUIRED)
else(UNIX)
find_package(Qt5X11Extras REQUIRED)
endif()
else()
set(minimum_required_qt_version "4.8")
find_package(Qt4 REQUIRED)
if(QT4_FOUND)
if("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" VERSION_LESS "${minimum_required_qt_version}")
message(FATAL_ERROR "Message error: TTK requires Qt >= ${minimum_required_qt_version} -- you cannot use Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}.")
endif()
set(QT_USE_QTCORE ON)
set(QT_USE_QTGUI ON)
if(WIN32)
set(QT_USE_QTMULTIMEDIA ON)
endif()
set(QT_USE_QTXML ON)
set(QT_USE_QTNETWORK ON)
set(QT_USE_QTSQL ON)
set(QT_USE_QTXML ON)
include(${QT_USE_FILE})
if(WIN32)
get_filename_component(${QT_LIBRARY_DIR} ${QT_QMAKE_EXECUTABLE} PATH)
endif()
else()
message(FATAL_ERROR "Message error: Qt4 was not found on your system. You probably need to set the QT_QMAKE_EXECUTABLE variable")
endif()
endif()
find_program(QT_LRELEASE_EXECUTABLE lrelease ${QT_INSTALL_BINS})
if(QT_LRELEASE_EXECUTABLE)
message(STATUS "Message Found lrelease executable: " ${QT_LRELEASE_EXECUTABLE})
if(WIN32)
execute_process(COMMAND ${MUSIC_SCRIPT_DIR}/win.bat ${QT_LRELEASE_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH})
else(UNIX)
execute_process(COMMAND ${MUSIC_SCRIPT_DIR}/linux.sh ${QT_LRELEASE_EXECUTABLE} ${MUSIC_DIR} ${EXECUTABLE_OUTPUT_PATH})
endif()
else()
message(FATAL_ERROR "Message Could NOT find lrelease executable")
endif()
find_library(QMMP_LIBRARY
NAMES qmmp1
PATHS ${LIBRARY_OUTPUT_PATH}
)
# qmmp include
if(TTK_QT_VERSION VERSION_GREATER "4")
include_directories(${MUSIC_DIR}/TTKExtra/Qt5)
else()
include_directories(${MUSIC_DIR}/TTKExtra/Qt4)
if(UNIX)
include_directories(
/usr/include/QtMultimediaKit
/usr/include/QtMobility
)
endif()
endif()
add_subdirectory(TTKQrc)
add_subdirectory(TTKThirdParty)
add_subdirectory(TTKModule)
add_subdirectory(TTKService)
add_subdirectory(TTKRun)
add_subdirectory(TTKTest)
install(FILES "${MUSIC_SCRIPT_DIR}/deploy/ttkmusicplayer.appdata.xml" DESTINATION "${MUSIC_INSTALL_DIR}/metainfo")