-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
194 lines (173 loc) · 5.3 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
project(microtube CXX)
cmake_minimum_required(VERSION 3.5)
include(CMakeDependentOption)
find_package(PkgConfig)
pkg_search_module(SAILFISH sailfishapp)
cmake_dependent_option(TARGET_SAILFISH "Is target SailfishOS" ON "SAILFISH_FOUND" OFF)
if (TARGET_SAILFISH)
message(STATUS "Building for SailfishOS")
else()
message(STATUS "Building for linux")
endif()
if (TARGET_SAILFISH)
find_package(Qt5 COMPONENTS Core Network Qml Gui Quick DBus Sql OpenGL OpenGLExtensions LinguistTools REQUIRED)
else()
find_package(Qt6 COMPONENTS Core Network Qml Gui Quick DBus Sql OpenGL OpenGLExtensions LinguistTools REQUIRED)
endif()
find_package(DBus1 REQUIRED)
pkg_search_module(GLIB glib-2.0 REQUIRED)
pkg_search_module(DBUSGLIB dbus-glib-1 REQUIRED)
pkg_search_module(GSTREAMER gstreamer-1.0 REQUIRED)
pkg_search_module(GSTREAMER_PLAYER gstreamer-player-1.0 REQUIRED)
pkg_search_module(GSTREAMER_VIDEO gstreamer-video-1.0 REQUIRED)
pkg_search_module(EGL egl REQUIRED)
pkg_search_module(OPENGL_EXTENSIONS Qt5OpenGLExtensions REQUIRED)
if (TARGET_SAILFISH)
pkg_search_module(AUDIORESOURCE audioresource-qt REQUIRED)
pkg_search_module(NEMO_GSTREAMER_INTERFACES nemo-gstreamer-interfaces-1.0 REQUIRED)
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(o2_SOURCE vendor/o2/src)
add_subdirectory(vendor/SortFilterProxyModel)
set( o2_SOURCES
${o2_SOURCE}/o2.cpp
${o2_SOURCE}/o2pollserver.cpp
${o2_SOURCE}/o2reply.cpp
${o2_SOURCE}/o2replyserver.cpp
${o2_SOURCE}/o2requestor.cpp
${o2_SOURCE}/o2simplecrypt.cpp
${o2_SOURCE}/o0jsonresponse.cpp
${o2_SOURCE}/o0settingsstore.cpp
${o2_SOURCE}/o0baseauth.cpp
${o2_SOURCE}/o2gft.cpp
${o2_SOURCE}/o2google.cpp
${o2_SOURCE}/o2googledevice.cpp
)
set( o2_HEADERS
${o2_SOURCE}/o2.h
${o2_SOURCE}/o2pollserver.h
${o2_SOURCE}/o2reply.h
${o2_SOURCE}/o2replyserver.h
${o2_SOURCE}/o2requestor.h
${o2_SOURCE}/o0abstractstore.h
${o2_SOURCE}/o0baseauth.h
${o2_SOURCE}/o0export.h
${o2_SOURCE}/o0globals.h
${o2_SOURCE}/o0jsonresponse.h
${o2_SOURCE}/o0requestparameter.h
${o2_SOURCE}/o0settingsstore.h
${o2_SOURCE}/o0simplecrypt.h
${o2_SOURCE}/o2gft.h
${o2_SOURCE}/o2google.h
${o2_SOURCE}/o2googledevice.h
)
file(GLOB TsFiles "translations/*.ts")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/translations)
set_source_files_properties(${TsFiles} PROPERTIES OUTPUT_LOCATION "translations/")
qt5_create_translation(QM_FILES ${TsFiles})
file( GLOB_RECURSE SOURCES src/*.cpp )
file( GLOB_RECURSE HEADERS src/*.h )
add_executable(microtube
${SOURCES}
${HEADERS}
$<TARGET_OBJECTS:SortFilterProxyModel>
${o2_SOURCES}
${o2_HEADERS}
qml/resources/resources.qrc
${QM_FILES}
)
target_compile_definitions(microtube PRIVATE
$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>
)
target_include_directories(microtube PRIVATE
$<BUILD_INTERFACE:
src
${GLIB_INCLUDE_DIRS}
${DBUSGLIB_INCLUDE_DIRS}
${SAILFISH_INCLUDE_DIRS}
${AUDIORESOURCE_INCLUDE_DIRS}
${GSTREAMER_INCLUDE_DIRS}
${GSTREAMER_PLAYER_INCLUDE_DIRS}
${GSTREAMER_VIDEO_INCLUDE_DIRS}
${EGL_INCLUDE_DIRS}
${o2_SOURCE}
>)
target_link_libraries(microtube
Qt5::Quick
Qt5::DBus
Qt5::Sql
Qt5::OpenGL
Qt5::OpenGLExtensions
${DBus1_LDFLAGS}
${GLIB_LDFLAGS}
${DBUSGLIB_LDFLAGS}
${SAILFISH_LDFLAGS}
${AUDIORESOURCE_LDFLAGS}
${GSTREAMER_LDFLAGS}
${GSTREAMER_PLAYER_LDFLAGS}
${GSTREAMER_VIDEO_LDFLAGS}
${EGL_LDFLAGS}
${OPENGL_EXTENSIONS_STATIC_LDFLAGS}
${NEMO_GSTREAMER_INTERFACES_LDFLAGS}
)
target_compile_options(microtube PUBLIC
${EGL_CFLAGS_OTHER}
)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} -O3 -DQT_NO_DEBUG_OUTPUT")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_DEBUG} -O3 -DQT_NO_DEBUG_OUTPUT")
install(TARGETS microtube
RUNTIME DESTINATION bin
)
install(DIRECTORY qml
DESTINATION share/microtube
)
install(DIRECTORY js
DESTINATION share/microtube
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/translations
DESTINATION share/microtube
FILES_MATCHING PATTERN "*.qm"
)
install(FILES microtube.desktop microtube-url.desktop
DESTINATION share/applications
)
install(FILES icons/86x86/microtube.png
DESTINATION share/icons/hicolor/86x86/apps
)
install(FILES icons/108x108/microtube.png
DESTINATION share/icons/hicolor/108x108/apps
)
install(FILES icons/128x128/microtube.png
DESTINATION share/icons/hicolor/128x128/apps
)
install(FILES icons/172x172/microtube.png
DESTINATION share/icons/hicolor/172x172/apps
)
file(GLOB_RECURSE QML_FILES qml/*.qml)
file(GLOB_RECURSE JS_FILES qml/*.js)
add_custom_target(distfiles
SOURCES
microtube.desktop
qml/microtube.qml
js/channelInfo.js
js/videoInfo.js
js/basicVideoInfo.js
js/comments.js
js/commentReplies.js
js/unified.js
js/package.json
microtube-url.desktop
rpm/microtube.spec
${JS_FILES}
${QML_FILES}
${TsFiles})
file(WRITE "${CMAKE_BINARY_DIR}/QtCreatorDeployment.txt"
"${CMAKE_INSTALL_PREFIX}
${CMAKE_BINARY_DIR}/microtube:bin
")