CMakeLists.txt 17 KB

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