Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CMakeLists.txt « src - github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5de879e2a0b192ab92f507b26c16a5ca25527651 (plain)
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})

qt_add_resources(MIRALL_RC_SRC ../mirall.qrc)
if ( IS_DIRECTORY ${OEM_THEME_DIR} )
    qt_add_resources(MIRALL_RC_SRC ${OEM_THEME_DIR}/theme.qrc)
    set(theme_dir ${OEM_THEME_DIR}/theme)
else()
    qt_add_resources(MIRALL_RC_SRC ../theme.qrc)
    set(theme_dir ${CMAKE_CURRENT_SOURCE_DIR}/../theme)
endif()

set(synclib_NAME ${APPLICATION_EXECUTABLE}sync)

set(3rdparty_SRC
3rdparty/qtsingleapplication/qtsingleapplication.cpp
3rdparty/qtsingleapplication/qtlocalpeer.cpp
3rdparty/qtsingleapplication/qtsinglecoreapplication.cpp
3rdparty/qtlockedfile/qtlockedfile.cpp
3rdparty/fancylineedit/fancylineedit.cpp
3rdparty/QProgressIndicator/QProgressIndicator.cpp
)

set(3rdparty_HEADER
3rdparty/qtsingleapplication/qtlocalpeer.h
3rdparty/qtsingleapplication/qtsingleapplication.h
3rdparty/qtsingleapplication/qtsinglecoreapplication.h
3rdparty/fancylineedit/fancylineedit.h
3rdparty/QProgressIndicator/QProgressIndicator.h
)
qt_wrap_cpp(3rdparty_MOC ${3rdparty_HEADER})

if(NOT WIN32) 
	list(APPEND 3rdparty_SRC 3rdparty/qtlockedfile/qtlockedfile_unix.cpp)
else()
	list(APPEND 3rdparty_SRC 3rdparty/qtlockedfile/qtlockedfile_win.cpp )
endif()

set(3rdparty_INC
    ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/qtlockedfile
    ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/qtsingleapplication
    ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/QProgressIndicator
    ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/fancylineedit
    )

set(libsync_SRCS
    mirall/folderman.cpp
    mirall/folder.cpp
    mirall/folderwatcher.cpp
    mirall/syncresult.cpp
    mirall/networklocation.cpp
    mirall/mirallconfigfile.cpp
    mirall/csyncthread.cpp
    mirall/fileutils.cpp
    mirall/theme.cpp
    mirall/owncloudtheme.cpp
    mirall/owncloudinfo.cpp
    mirall/logger.cpp
    mirall/utility.cpp
    mirall/connectionvalidator.cpp
    mirall/progressdispatcher.cpp
    mirall/mirallaccessmanager.cpp
    creds/dummycredentials.cpp
    creds/httpcredentials.cpp
    creds/credentialsfactory.cpp
    creds/http/credentialstore.cpp
    creds/http/httpconfigfile.cpp
    creds/shibbolethcredentials.cpp
    creds/shibboleth/shibbolethaccessmanager.cpp
    creds/shibboleth/shibbolethcookiejar.cpp
    creds/shibboleth/shibbolethwebview.cpp
    creds/shibboleth/shibbolethrefresher.cpp
    creds/shibboleth/shibbolethconfigfile.cpp
    creds/credentialscommon.cpp
)

set(libsync_HEADERS
    mirall/folderman.h
    mirall/folder.h
    mirall/folderwatcher.h
    mirall/csyncthread.h
    mirall/theme.h
    mirall/owncloudtheme.h
    mirall/owncloudinfo.h
    mirall/logger.h
    mirall/connectionvalidator.h
    mirall/progressdispatcher.h
    mirall/mirallaccessmanager.h
    creds/abstractcredentials.h
    creds/dummycredentials.h
    creds/httpcredentials.h
    creds/credentialsfactory.h
    creds/http/credentialstore.h
    creds/http/httpconfigfile.h
    creds/shibbolethcredentials.h
    creds/shibboleth/shibbolethaccessmanager.h
    creds/shibboleth/shibbolethcookiejar.h
    creds/shibboleth/shibbolethwebview.h
    creds/shibboleth/shibbolethrefresher.h
    creds/shibboleth/shibbolethconfigfile.h
    creds/credentialscommon.h
)

IF( INOTIFY_FOUND )
    set(libsync_SRCS ${libsync_SRCS} mirall/inotify.cpp)
    set(libsync_SRCS ${libsync_SRCS} mirall/folderwatcher_inotify.cpp)
    set(libsync_HEADERS ${libsync_HEADERS} mirall/inotify.h)
    set(libsync_HEADERS ${libsync_HEADERS} mirall/folderwatcher_inotify.h)
ENDIF()
IF( WIN32 ) 
    set(libsync_SRCS ${libsync_SRCS} mirall/folderwatcher_win.cpp)
    set(libsync_HEADERS ${libsync_HEADERS} mirall/folderwatcher_win.h)
ENDIF()
IF( APPLE )
    set(libsync_SRCS ${libsync_SRCS} mirall/folderwatcher_mac.cpp)
ENDIF()


qt_wrap_cpp(syncMoc ${libsync_HEADERS})

list(APPEND libsync_LINK_TARGETS
    ${QT_LIBRARIES}
    ${CSYNC_LIBRARY}
    dl
)

if(QTKEYCHAIN_FOUND)
    list(APPEND libsync_LINK_TARGETS ${QTKEYCHAIN_LIBRARY})
    include_directories(${QTKEYCHAIN_INCLUDE_DIR})
endif()

add_library(${synclib_NAME} SHARED ${libsync_SRCS} ${syncMoc})

qt5_use_modules(${synclib_NAME} Widgets Network Xml Quick WebKitWidgets)

set_target_properties( ${synclib_NAME}  PROPERTIES
	VERSION ${VERSION}
	SOVERSION ${SOVERSION}
)

target_link_libraries(${synclib_NAME} ${libsync_LINK_TARGETS} )

if ( APPLE )
    target_link_libraries(${synclib_NAME} /System/Library/Frameworks/CoreServices.framework)
endif()

if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
    install(TARGETS ${synclib_NAME}
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
    )
    if(NOT WIN32)
        configure_file(${CMAKE_SOURCE_DIR}/mirall.desktop.in
		${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_EXECUTABLE}.desktop)
        install(FILES  ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_EXECUTABLE}.desktop DESTINATION share/applications )
    endif()
else()
    install(TARGETS ${synclib_NAME} DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS)
endif()

set(mirall_UI
mirall/folderwizardsourcepage.ui
mirall/folderwizardtargetpage.ui
mirall/sslerrordialog.ui
mirall/settingsdialog.ui
mirall/generalsettings.ui
mirall/networksettings.ui
mirall/accountsettings.ui
mirall/ignorelisteditor.ui
mirall/itemprogressdialog.ui
wizard/owncloudsetupnocredspage.ui
wizard/owncloudhttpcredspage.ui
wizard/owncloudwizardresultpage.ui
wizard/owncloudadvancedsetuppage.ui
)

qt_wrap_ui(mirall_UI_SRCS ${mirall_UI})

set(mirall_SRCS
    mirall/application.cpp
    mirall/systray.cpp
    mirall/folderwizard.cpp
    mirall/folderstatusmodel.cpp
    wizard/owncloudwizard.cpp
    wizard/owncloudsetuppage.cpp
    wizard/owncloudhttpcredspage.cpp
    wizard/owncloudwizardresultpage.cpp
    wizard/owncloudwizardcommon.cpp
    wizard/owncloudshibbolethcredspage.cpp
    wizard/owncloudadvancedsetuppage.cpp
    mirall/owncloudsetupwizard.cpp
    mirall/updatedetector.cpp
    mirall/occinfo.cpp
    mirall/sslerrordialog.cpp
    mirall/logbrowser.cpp
    mirall/settingsdialog.cpp
    mirall/generalsettings.cpp
    mirall/networksettings.cpp
    mirall/accountsettings.cpp
    mirall/ignorelisteditor.cpp
    mirall/itemprogressdialog.cpp
)

set(mirall_HEADERS
    mirall/application.h
    mirall/systray.h
    mirall/folderwizard.h
    mirall/owncloudsetupwizard.h
    wizard/owncloudwizard.h
    wizard/owncloudsetuppage.h
    wizard/owncloudhttpcredspage.h
    wizard/owncloudwizardresultpage.h
    wizard/owncloudwizardcommon.h
    wizard/owncloudshibbolethcredspage.h
    wizard/owncloudadvancedsetuppage.h
    mirall/folderstatusmodel.h
    mirall/updatedetector.h
    mirall/sslerrordialog.h
    mirall/logbrowser.h
    mirall/settingsdialog.h
    mirall/generalsettings.h
    mirall/networksettings.h
    mirall/accountsettings.h
    mirall/ignorelisteditor.h
    mirall/itemprogressdialog.h
)

if( UNIX AND NOT APPLE)
    if(NOT DEFINED USE_INOTIFY)
        set(USE_INOTIFY ON)
    endif()
endif()

# csync is required.
include_directories(${CSYNC_INCLUDE_DIR}/csync ${CSYNC_INCLUDE_DIR} ${CSYNC_BUILD_PATH}/src)
include_directories(${3rdparty_INC})

qt_wrap_cpp(mirallMoc ${mirall_HEADERS})

qt_add_translation(mirall_I18N ${TRANSLATIONS})

set( final_src
    ${mirall_HEADERS}
    ${MIRALL_RC_SRC}
    ${mirall_SRCS}
    ${mirall_UI_SRCS}
    ${mirallMoc}
    ${mirall_HEADERS}
    ${mirall_I18N}
    ${3rdparty_SRC}
    ${3rdparty_MOC}
)

# add executable icon on windows and osx
include( AddAppIconMacro )
set(ownCloud_old ${ownCloud})

kde4_add_app_icon( ownCloud "${theme_dir}/colored/${APPLICATION_EXECUTABLE}-icon*.png")
list(APPEND final_src ${ownCloud})
set(ownCloud ${ownCloud_old})

if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
    set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

if(NOT WIN32)
    file( GLOB _icons "${theme_dir}/colored/${APPLICATION_EXECUTABLE}-icon-*.png" )
    foreach( _file ${_icons} )
        string( REPLACE "${theme_dir}/colored/${APPLICATION_EXECUTABLE}-icon-" "" _res ${_file} )
        string( REPLACE ".png" "" _res ${_res} )
        install( FILES ${_file} RENAME ${APPLICATION_EXECUTABLE}.png DESTINATION ${DATADIR}/icons/hicolor/${_res}x${_res}/apps )
    endforeach( _file )
endif(NOT WIN32)

    install(FILES ${mirall_I18N} DESTINATION share/${APPLICATION_EXECUTABLE}/i18n)

    # we may not add MACOSX_BUNDLE here, if not building one

    # add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src})
    add_executable( ${APPLICATION_EXECUTABLE} WIN32 main.cpp ${final_src})
    qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml DBus)
else()
    set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
    include(DeployQt4)

    set(CMAKE_INSTALL_PREFIX ".") # Examples use /Applications. hurmpf.
    set(MACOSX_BUNDLE_ICON_FILE "ownCloud.icns")

    # we must add MACOSX_BUNDLE only if building a bundle
    add_executable( ${APPLICATION_EXECUTABLE} WIN32 MACOSX_BUNDLE main.cpp ${final_src})
    qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml DBus)

    #FIXME: hardcoded path
    if ( EXISTS ${CSYNC_BINARY_DIR}/modules/ocsync_owncloud.so )
        install(FILES ${CSYNC_BINARY_DIR}/modules/ocsync_owncloud.so DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Plugins)
    else()
        install(FILES /usr/local/lib/ocsync-0/ocsync_owncloud.so DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Plugins)
    endif()

    set (QM_DIR ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/Translations)
    install(FILES ${mirall_I18N} DESTINATION ${QM_DIR})
    file(GLOB qt_I18N ${QT_TRANSLATIONS_DIR}/qt_??.qm ${QT_TRANSLATIONS_DIR}/qt_??_??.qm)
    install(FILES ${qt_I18N} DESTINATION ${QM_DIR})
    file(GLOB qtkeychain_I18N ${QT_TRANSLATIONS_DIR}/qtkeychain*.qm)
    install(FILES ${qtkeychain_I18N} DESTINATION ${QM_DIR})
    list(APPEND dirs "/usr/local/lib")
endif()


set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
        RUNTIME_OUTPUT_DIRECTORY  ${BIN_OUTPUT_DIRECTORY}
)
target_link_libraries( ${APPLICATION_EXECUTABLE} ${QT_LIBRARIES} )
target_link_libraries( ${APPLICATION_EXECUTABLE} ${synclib_NAME} )
target_link_libraries( ${APPLICATION_EXECUTABLE} ${CSYNC_LIBRARY} )

install(TARGETS ${APPLICATION_EXECUTABLE}
        RUNTIME DESTINATION bin
        LIBRARY DESTINATION lib
        ARCHIVE DESTINATION lib
        BUNDLE  DESTINATION "."
)

#FIXME: find a nice solution to make the second if(BUILD_OWNCLOUD_OSX_BUNDLE) unnecessary
# currently it needs to be done because the code right above needs to be executed no matter
# if building a bundle or not and the install_qt4_executable needs to be called afterwards
if(BUILD_OWNCLOUD_OSX_BUNDLE)
    install_qt4_executable(${OWNCLOUD_OSX_BUNDLE} "" "${OWNCLOUD_OSX_BUNDLE}/Contents/Plugins/ocsync_owncloud.so" ${dirs})
endif()

find_program(KRAZY2_EXECUTABLE krazy2)
if(KRAZY2_EXECUTABLE)
    # s/y k/y ALL k/ for building this target always
    add_custom_target( krazy krazy2 --check-sets c++,qt4,foss
                       ${PROJECT_SOURCE_DIR}/src/mirall/*.ui
                       ${PROJECT_SOURCE_DIR}/src/mirall/*.h
                       ${PROJECT_SOURCE_DIR}/src/mirall/*.cpp
)
endif()