CMakeLists.txt 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. project(gui)
  2. find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2)
  3. if(CMAKE_BUILD_TYPE MATCHES Debug)
  4. add_definitions(-DQT_QML_DEBUG)
  5. endif()
  6. IF(BUILD_UPDATER)
  7. add_subdirectory(updater)
  8. endif()
  9. configure_file(${CMAKE_SOURCE_DIR}/theme.qrc.in ${CMAKE_SOURCE_DIR}/theme.qrc)
  10. set(MIRALL_RC_SRC ../../resources.qrc)
  11. list(APPEND MIRALL_RC_SRC ${CMAKE_SOURCE_DIR}/theme.qrc)
  12. set(theme_dir ${CMAKE_SOURCE_DIR}/theme)
  13. set(client_UI_SRCS
  14. accountsettings.ui
  15. conflictdialog.ui
  16. invalidfilenamedialog.ui
  17. foldercreationdialog.ui
  18. folderwizardsourcepage.ui
  19. folderwizardtargetpage.ui
  20. generalsettings.ui
  21. legalnotice.ui
  22. ignorelisteditor.ui
  23. ignorelisttablewidget.ui
  24. networksettings.ui
  25. settingsdialog.ui
  26. sharedialog.ui
  27. sharelinkwidget.ui
  28. shareusergroupwidget.ui
  29. shareuserline.ui
  30. sslerrordialog.ui
  31. addcertificatedialog.ui
  32. proxyauthdialog.ui
  33. mnemonicdialog.ui
  34. UserStatusSelector.qml
  35. UserStatusSelectorDialog.qml
  36. tray/ActivityActionButton.qml
  37. tray/ActivityItem.qml
  38. tray/ActivityList.qml
  39. tray/Window.qml
  40. tray/UserLine.qml
  41. wizard/flow2authwidget.ui
  42. wizard/owncloudadvancedsetuppage.ui
  43. wizard/owncloudconnectionmethoddialog.ui
  44. wizard/owncloudhttpcredspage.ui
  45. wizard/owncloudoauthcredspage.ui
  46. wizard/owncloudsetupnocredspage.ui
  47. wizard/webview.ui
  48. wizard/welcomepage.ui
  49. )
  50. set(client_SRCS
  51. accountmanager.cpp
  52. accountsettings.cpp
  53. application.cpp
  54. invalidfilenamedialog.cpp
  55. conflictdialog.cpp
  56. conflictsolver.cpp
  57. connectionvalidator.cpp
  58. folder.cpp
  59. foldercreationdialog.cpp
  60. folderman.cpp
  61. folderstatusmodel.cpp
  62. folderstatusdelegate.cpp
  63. folderstatusview.cpp
  64. folderwatcher.cpp
  65. folderwizard.cpp
  66. generalsettings.cpp
  67. legalnotice.cpp
  68. ignorelisteditor.cpp
  69. ignorelisttablewidget.cpp
  70. lockwatcher.cpp
  71. logbrowser.cpp
  72. navigationpanehelper.cpp
  73. networksettings.cpp
  74. ocsnavigationappsjob.cpp
  75. ocsjob.cpp
  76. ocssharejob.cpp
  77. ocsshareejob.cpp
  78. openfilemanager.cpp
  79. owncloudgui.cpp
  80. owncloudsetupwizard.cpp
  81. selectivesyncdialog.cpp
  82. settingsdialog.cpp
  83. sharedialog.cpp
  84. sharelinkwidget.cpp
  85. sharemanager.cpp
  86. shareusergroupwidget.cpp
  87. sharee.cpp
  88. sslbutton.cpp
  89. sslerrordialog.cpp
  90. syncrunfilelog.cpp
  91. systray.cpp
  92. thumbnailjob.cpp
  93. userinfo.cpp
  94. accountstate.cpp
  95. addcertificatedialog.cpp
  96. authenticationdialog.cpp
  97. proxyauthhandler.cpp
  98. proxyauthdialog.cpp
  99. tooltipupdater.cpp
  100. notificationconfirmjob.cpp
  101. guiutility.cpp
  102. elidedlabel.cpp
  103. headerbanner.cpp
  104. iconjob.cpp
  105. iconutils.cpp
  106. remotewipe.cpp
  107. userstatusselectormodel.cpp
  108. emojimodel.cpp
  109. fileactivitylistmodel.cpp
  110. tray/syncstatussummary.cpp
  111. tray/ActivityData.cpp
  112. tray/ActivityListModel.cpp
  113. tray/UserModel.cpp
  114. tray/NotificationHandler.cpp
  115. tray/NotificationCache.cpp
  116. creds/credentialsfactory.cpp
  117. creds/httpcredentialsgui.cpp
  118. creds/oauth.cpp
  119. creds/flow2auth.cpp
  120. creds/webflowcredentials.cpp
  121. creds/webflowcredentialsdialog.cpp
  122. wizard/postfixlineedit.cpp
  123. wizard/abstractcredswizardpage.cpp
  124. wizard/owncloudadvancedsetuppage.cpp
  125. wizard/owncloudconnectionmethoddialog.cpp
  126. wizard/owncloudhttpcredspage.cpp
  127. wizard/owncloudoauthcredspage.cpp
  128. wizard/flow2authcredspage.cpp
  129. wizard/flow2authwidget.cpp
  130. wizard/owncloudsetuppage.cpp
  131. wizard/owncloudwizardcommon.cpp
  132. wizard/owncloudwizard.cpp
  133. wizard/slideshow.cpp
  134. wizard/welcomepage.cpp
  135. wizard/linklabel.cpp
  136. )
  137. if (Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND)
  138. list(APPEND client_SRCS
  139. wizard/webviewpage.cpp
  140. wizard/webview.cpp
  141. )
  142. endif()
  143. IF(BUILD_UPDATER)
  144. set(updater_SRCS
  145. updater/ocupdater.cpp
  146. updater/updateinfo.cpp
  147. updater/updater.cpp
  148. )
  149. endif()
  150. IF( APPLE )
  151. list(APPEND client_SRCS cocoainitializer_mac.mm)
  152. list(APPEND client_SRCS systray.mm)
  153. if(SPARKLE_FOUND AND BUILD_UPDATER)
  154. # Define this, we need to check in updater.cpp
  155. add_definitions(-DHAVE_SPARKLE)
  156. list(APPEND updater_SRCS updater/sparkleupdater_mac.mm updater/sparkleupdater.h)
  157. list(APPEND updater_DEPS ${SPARKLE_LIBRARY})
  158. # Sparkle.framework is installed from here because macdeployqt's CopyFramework breaks on this bundle
  159. # as its logic is tightly tailored around Qt5 frameworks
  160. install(DIRECTORY "${SPARKLE_LIBRARY}"
  161. DESTINATION "${OWNCLOUD_OSX_BUNDLE}/Contents/Frameworks" USE_SOURCE_PERMISSIONS)
  162. endif()
  163. ENDIF()
  164. IF( NOT WIN32 AND NOT APPLE )
  165. set(client_SRCS ${client_SRCS} folderwatcher_linux.cpp)
  166. ENDIF()
  167. IF( WIN32 )
  168. set(client_SRCS ${client_SRCS} folderwatcher_win.cpp)
  169. ENDIF()
  170. IF( APPLE )
  171. list(APPEND client_SRCS folderwatcher_mac.cpp)
  172. ENDIF()
  173. set(3rdparty_SRC
  174. ../3rdparty/QProgressIndicator/QProgressIndicator.cpp
  175. ../3rdparty/qtlockedfile/qtlockedfile.cpp
  176. ../3rdparty/qtsingleapplication/qtlocalpeer.cpp
  177. ../3rdparty/qtsingleapplication/qtsingleapplication.cpp
  178. ../3rdparty/qtsingleapplication/qtsinglecoreapplication.cpp
  179. ../3rdparty/kmessagewidget/kmessagewidget.cpp
  180. )
  181. if(NOT WIN32)
  182. list(APPEND 3rdparty_SRC ../3rdparty/qtlockedfile/qtlockedfile_unix.cpp)
  183. else()
  184. list(APPEND 3rdparty_SRC ../3rdparty/qtlockedfile/qtlockedfile_win.cpp )
  185. endif()
  186. find_package(Qt5LinguistTools)
  187. if(Qt5LinguistTools_FOUND)
  188. qt5_add_translation(client_I18N ${TRANSLATIONS})
  189. endif()
  190. IF( WIN32 )
  191. configure_file(
  192. ${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in
  193. ${CMAKE_CURRENT_BINARY_DIR}/version.rc
  194. @ONLY)
  195. set(client_version ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
  196. IF(NOT MSVC)
  197. set(client_manifest ${CMAKE_CURRENT_SOURCE_DIR}/manifest-mingw.rc)
  198. ENDIF()
  199. ENDIF()
  200. set( final_src
  201. ${MIRALL_RC_SRC}
  202. ${client_SRCS}
  203. ${client_UI_SRCS}
  204. ${guiMoc}
  205. ${client_I18N}
  206. ${3rdparty_SRC}
  207. ${3rdparty_MOC}
  208. )
  209. if(Qt5Keychain_FOUND)
  210. list(APPEND libsync_LINK_TARGETS qt5keychain)
  211. endif()
  212. # add executable icon on windows and osx
  213. # UPSTREAM our ECMAddAppIcon.cmake then require that version here
  214. # find_package(ECM 1.7.0 REQUIRED NO_MODULE)
  215. # list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
  216. include(ECMAddAppIcon)
  217. # For historical reasons we can not use the application_shortname
  218. # for ownCloud but must rather set it manually.
  219. if (NOT DEFINED APPLICATION_ICON_NAME)
  220. set(APPLICATION_ICON_NAME ${APPLICATION_SHORTNAME})
  221. endif()
  222. # Generate png icons from svg
  223. find_program(SVG_CONVERTER
  224. NAMES inkscape inkscape.exe rsvg-convert
  225. REQUIRED
  226. HINTS "C:\\Program Files\\Inkscape\\bin" "/usr/bin" ENV SVG_CONVERTER_DIR)
  227. # REQUIRED keyword is only supported on CMake 3.18 and above
  228. if (NOT SVG_CONVERTER)
  229. message(FATAL_ERROR "Could not find a suitable svg converter. Set SVG_CONVERTER_DIR to the path of either the inkscape or rsvg-convert executable.")
  230. endif()
  231. function(generate_sized_png_from_svg icon_path size)
  232. get_filename_component(icon_name_dir ${icon_path} DIRECTORY)
  233. get_filename_component(icon_name_wle ${icon_path} NAME_WLE)
  234. if (EXISTS "${icon_name_dir}/${size}-${icon_name_wle}.png")
  235. return()
  236. endif()
  237. set(icon_output_name "${size}-${icon_name_wle}.png")
  238. message(STATUS "Generate ${icon_output_name}")
  239. execute_process(COMMAND
  240. "${SVG_CONVERTER}" -w ${size} -h ${size} "${icon_path}" -o "${icon_output_name}"
  241. WORKING_DIRECTORY "${icon_name_dir}"
  242. RESULT_VARIABLE
  243. SVG_CONVERTER_SIDEBAR_ERROR
  244. OUTPUT_QUIET
  245. ERROR_QUIET)
  246. if (SVG_CONVERTER_SIDEBAR_ERROR)
  247. message(FATAL_ERROR
  248. "${SVG_CONVERTER} could not generate icon: ${SVG_CONVERTER_SIDEBAR_ERROR}")
  249. else()
  250. endif()
  251. endfunction()
  252. if ((APPLICATION_ICON_SET MATCHES "PNG")
  253. AND
  254. (NOT EXISTS "${theme_dir}/colored/${APPLICATION_ICON_NAME}-icon.svg"))
  255. # We may have no svg application icon in when customers use PNG
  256. # icons in brander, but theme.qrc expects a svg icon.
  257. file(TOUCH "${theme_dir}/colored/${APPLICATION_ICON_NAME}-icon.svg")
  258. endif()
  259. if(APPLE)
  260. set(MACOS_SIDEBAR_ICON_SVG "${theme_dir}/colored/${APPLICATION_ICON_NAME}-sidebar.svg")
  261. generate_sized_png_from_svg(${MACOS_SIDEBAR_ICON_SVG} 16)
  262. generate_sized_png_from_svg(${MACOS_SIDEBAR_ICON_SVG} 32)
  263. generate_sized_png_from_svg(${MACOS_SIDEBAR_ICON_SVG} 64)
  264. generate_sized_png_from_svg(${MACOS_SIDEBAR_ICON_SVG} 128)
  265. generate_sized_png_from_svg(${MACOS_SIDEBAR_ICON_SVG} 256)
  266. endif()
  267. if(WIN32)
  268. set(STARTMENU_ICON_SVG "${theme_dir}/colored/${APPLICATION_ICON_NAME}-w10startmenu.svg")
  269. generate_sized_png_from_svg(${STARTMENU_ICON_SVG} 70)
  270. generate_sized_png_from_svg(${STARTMENU_ICON_SVG} 150)
  271. endif()
  272. set(APP_ICON_SVG "${theme_dir}/colored/${APPLICATION_ICON_NAME}-icon.svg")
  273. generate_sized_png_from_svg(${APP_ICON_SVG} 16)
  274. generate_sized_png_from_svg(${APP_ICON_SVG} 24)
  275. generate_sized_png_from_svg(${APP_ICON_SVG} 32)
  276. generate_sized_png_from_svg(${APP_ICON_SVG} 48)
  277. generate_sized_png_from_svg(${APP_ICON_SVG} 64)
  278. generate_sized_png_from_svg(${APP_ICON_SVG} 128)
  279. generate_sized_png_from_svg(${APP_ICON_SVG} 256)
  280. generate_sized_png_from_svg(${APP_ICON_SVG} 512)
  281. generate_sized_png_from_svg(${APP_ICON_SVG} 1024)
  282. file(GLOB_RECURSE OWNCLOUD_ICONS "${theme_dir}/colored/*-${APPLICATION_ICON_NAME}-icon*")
  283. if(APPLE)
  284. file(GLOB_RECURSE OWNCLOUD_SIDEBAR_ICONS "${theme_dir}/colored/*-${APPLICATION_ICON_NAME}-sidebar*")
  285. MESSAGE(STATUS "OWNCLOUD_SIDEBAR_ICONS: ${APPLICATION_ICON_NAME}: ${OWNCLOUD_SIDEBAR_ICONS}")
  286. endif()
  287. ecm_add_app_icon(APP_ICON ICONS "${OWNCLOUD_ICONS}" SIDEBAR_ICONS "${OWNCLOUD_SIDEBAR_ICONS}" OUTFILE_BASENAME "${APPLICATION_ICON_NAME}")
  288. if(UNIX AND NOT APPLE)
  289. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
  290. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE")
  291. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
  292. endif()
  293. if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
  294. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
  295. endif()
  296. add_library(nextcloudCore STATIC ${final_src})
  297. target_link_libraries(nextcloudCore
  298. PUBLIC
  299. Nextcloud::sync
  300. Qt5::Widgets
  301. Qt5::GuiPrivate
  302. Qt5::Svg
  303. Qt5::Network
  304. Qt5::Xml
  305. Qt5::Qml
  306. Qt5::Quick
  307. Qt5::QuickControls2
  308. )
  309. add_subdirectory(socketapi)
  310. if(Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND)
  311. target_link_libraries(nextcloudCore PUBLIC Qt5::WebEngineWidgets)
  312. endif()
  313. set_target_properties(nextcloudCore
  314. PROPERTIES
  315. AUTOUIC ON
  316. AUTORCC ON
  317. AUTOMOC ON
  318. )
  319. target_include_directories(nextcloudCore
  320. PUBLIC
  321. ${CMAKE_SOURCE_DIR}/src/3rdparty/QProgressIndicator
  322. ${CMAKE_SOURCE_DIR}/src/3rdparty/qtlockedfile
  323. ${CMAKE_SOURCE_DIR}/src/3rdparty/qtsingleapplication
  324. ${CMAKE_SOURCE_DIR}/src/3rdparty/kmessagewidget
  325. ${CMAKE_CURRENT_BINARY_DIR}
  326. ${CMAKE_CURRENT_SOURCE_DIR}
  327. )
  328. if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
  329. if(NOT WIN32)
  330. file(GLOB _icons "${theme_dir}/colored/*-${APPLICATION_ICON_NAME}-icon.png")
  331. foreach(_file ${_icons})
  332. string(REPLACE "${theme_dir}/colored/" "" _res ${_file})
  333. string(REPLACE "-${APPLICATION_ICON_NAME}-icon.png" "" _res ${_res})
  334. install(FILES ${_file} RENAME ${APPLICATION_ICON_NAME}.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${_res}x${_res}/apps)
  335. endforeach(_file)
  336. install(FILES ${client_I18N} DESTINATION ${CMAKE_INSTALL_DATADIR}/${APPLICATION_EXECUTABLE}/i18n)
  337. else()
  338. file(GLOB_RECURSE VISUAL_ELEMENTS "${theme_dir}/colored/*-${APPLICATION_ICON_NAME}-w10startmenu*")
  339. install(FILES ${VISUAL_ELEMENTS} DESTINATION bin/visualelements)
  340. install(FILES "${theme_dir}/${APPLICATION_EXECUTABLE}.VisualElementsManifest.xml" DESTINATION bin)
  341. install(FILES ${client_I18N} DESTINATION i18n)
  342. endif()
  343. # we may not add MACOSX_BUNDLE here, if not building one
  344. add_executable(nextcloud WIN32 main.cpp ${client_version} ${client_manifest} ${APP_ICON})
  345. set_target_properties(nextcloud PROPERTIES
  346. OUTPUT_NAME "${APPLICATION_EXECUTABLE}"
  347. )
  348. else()
  349. # set(CMAKE_INSTALL_PREFIX ".") # Examples use /Applications. hurmpf.
  350. set(MACOSX_BUNDLE_ICON_FILE "${APPLICATION_ICON_NAME}.icns")
  351. # we must add MACOSX_BUNDLE only if building a bundle
  352. add_executable(nextcloud WIN32 MACOSX_BUNDLE main.cpp ${APP_ICON})
  353. if (BUILD_OWNCLOUD_OSX_BUNDLE)
  354. set_target_properties(nextcloud PROPERTIES
  355. OUTPUT_NAME "${APPLICATION_NAME}")
  356. else()
  357. set_target_properties(nextcloud PROPERTIES
  358. OUTPUT_NAME "${APPLICATION_EXECUTABLE}")
  359. endif()
  360. set (QM_DIR ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/Translations)
  361. install(FILES ${client_I18N} DESTINATION ${QM_DIR})
  362. get_target_property(_qmake Qt5::qmake LOCATION)
  363. execute_process(COMMAND ${_qmake} -query QT_INSTALL_TRANSLATIONS
  364. OUTPUT_VARIABLE QT_TRANSLATIONS_DIR
  365. OUTPUT_STRIP_TRAILING_WHITESPACE
  366. )
  367. file(GLOB qt_I18N ${QT_TRANSLATIONS_DIR}/qt_??.qm ${QT_TRANSLATIONS_DIR}/qt_??_??.qm)
  368. install(FILES ${qt_I18N} DESTINATION ${QM_DIR})
  369. file(GLOB qtbase_I18N ${QT_TRANSLATIONS_DIR}/qtbase_??.qm ${QT_TRANSLATIONS_DIR}/qt_??_??.qm)
  370. install(FILES ${qtbase_I18N} DESTINATION ${QM_DIR})
  371. file(GLOB qtkeychain_I18N ${QT_TRANSLATIONS_DIR}/qtkeychain*.qm)
  372. install(FILES ${qtkeychain_I18N} DESTINATION ${QM_DIR})
  373. endif()
  374. IF(BUILD_UPDATER)
  375. add_library(updater STATIC ${updater_SRCS})
  376. target_link_libraries(updater Nextcloud::sync ${updater_DEPS} Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Xml)
  377. target_include_directories(updater PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
  378. set_target_properties(updater PROPERTIES AUTOMOC ON)
  379. target_link_libraries(nextcloudCore PUBLIC updater)
  380. endif()
  381. set_target_properties(nextcloud PROPERTIES
  382. RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY}
  383. )
  384. target_link_libraries(nextcloud PRIVATE nextcloudCore)
  385. if(TARGET PkgConfig::CLOUDPROVIDERS)
  386. message("Building with libcloudproviderssupport")
  387. target_sources(nextcloudCore PRIVATE cloudproviders/cloudprovidermanager.cpp cloudproviders/cloudproviderwrapper.cpp)
  388. string(TOLOWER "${APPLICATION_VENDOR}" DBUS_VENDOR)
  389. string(REGEX REPLACE "[^A-z0-9]" "" DBUS_VENDOR "${DBUS_VENDOR}")
  390. string(REGEX REPLACE "[^A-z0-9]" "" DBUS_APPLICATION_NAME "${APPLICATION_SHORTNAME}")
  391. if(NOT DBUS_PREFIX)
  392. set(DBUS_PREFIX "com")
  393. endif(NOT DBUS_PREFIX)
  394. set(LIBCLOUDPROVIDERS_DBUS_BUS_NAME "${DBUS_PREFIX}.${DBUS_VENDOR}.${DBUS_APPLICATION_NAME}")
  395. set(LIBCLOUDPROVIDERS_DBUS_OBJECT_PATH "/${DBUS_PREFIX}/${DBUS_VENDOR}/${DBUS_APPLICATION_NAME}")
  396. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cloudproviders/cloudproviderconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/cloudproviderconfig.h)
  397. target_compile_definitions(nextcloudCore PUBLIC -DWITH_LIBCLOUDPROVIDERS)
  398. target_link_libraries(nextcloudCore
  399. PRIVATE
  400. PkgConfig::CLOUDPROVIDERS
  401. PkgConfig::GLIB2
  402. PkgConfig::GIO
  403. )
  404. endif()
  405. ## handle DBUS for Fdo notifications
  406. if( UNIX AND NOT APPLE )
  407. find_package(Qt5 COMPONENTS DBus)
  408. target_link_libraries(nextcloudCore PUBLIC Qt5::DBus)
  409. target_compile_definitions(nextcloudCore PUBLIC "USE_FDO_NOTIFICATIONS")
  410. endif()
  411. if (APPLE)
  412. find_package(Qt5 COMPONENTS MacExtras)
  413. target_link_libraries(nextcloudCore PUBLIC Qt5::MacExtras)
  414. endif()
  415. if(WITH_CRASHREPORTER)
  416. target_link_libraries(nextcloudCore PUBLIC crashreporter-handler)
  417. if(UNIX AND NOT MAC)
  418. find_package(Threads REQUIRED)
  419. target_link_libraries(nextcloudCore PUBLIC Threads::Threads)
  420. endif()
  421. endif()
  422. install(TARGETS nextcloud
  423. RUNTIME DESTINATION bin
  424. LIBRARY DESTINATION lib
  425. ARCHIVE DESTINATION lib
  426. BUNDLE DESTINATION "."
  427. )
  428. # FIXME: The following lines are dup in src/gui and src/cmd because it needs to be done after both are installed
  429. #FIXME: find a nice solution to make the second if(BUILD_OWNCLOUD_OSX_BUNDLE) unnecessary
  430. # currently it needs to be done because the code right above needs to be executed no matter
  431. # if building a bundle or not and the install_qt4_executable needs to be called afterwards
  432. #
  433. # OSX: Run macdeployqt for src/gui and for src/cmd using the -executable option
  434. if(BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY)
  435. get_target_property (QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
  436. get_filename_component(QT_BIN_DIR "${QT_QMAKE_EXECUTABLE}" DIRECTORY)
  437. find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT_BIN_DIR}")
  438. set(cmd_NAME ${APPLICATION_EXECUTABLE}cmd)
  439. if(CMAKE_BUILD_TYPE MATCHES Debug)
  440. set(NO_STRIP "-no-strip")
  441. else()
  442. set(NO_STRIP "")
  443. endif()
  444. add_custom_command(TARGET nextcloud POST_BUILD
  445. COMMAND "${MACDEPLOYQT_EXECUTABLE}"
  446. "$<TARGET_FILE_DIR:nextcloud>/../.."
  447. -qmldir=${CMAKE_SOURCE_DIR}/src/gui
  448. -always-overwrite
  449. -executable="$<TARGET_FILE_DIR:nextcloud>/${cmd_NAME}"
  450. ${NO_STRIP}
  451. COMMAND "${CMAKE_COMMAND}"
  452. -E rm -rf "${BIN_OUTPUT_DIRECTORY}/${OWNCLOUD_OSX_BUNDLE}/Contents/PlugIns/bearer"
  453. COMMENT "Running macdeployqt..."
  454. )
  455. endif()
  456. if(NOT BUILD_OWNCLOUD_OSX_BUNDLE AND NOT WIN32)
  457. configure_file(${CMAKE_SOURCE_DIR}/mirall.desktop.in
  458. ${CMAKE_CURRENT_BINARY_DIR}/${LINUX_APPLICATION_ID}.desktop)
  459. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LINUX_APPLICATION_ID}.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )
  460. configure_file(owncloud.xml.in ${APPLICATION_EXECUTABLE}.xml)
  461. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_EXECUTABLE}.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages )
  462. find_package(SharedMimeInfo)
  463. if(SharedMimeInfo_FOUND)
  464. update_xdg_mimetypes( ${CMAKE_INSTALL_DATADIR}/mime/packages )
  465. endif(SharedMimeInfo_FOUND)
  466. endif()