project(gui) set(CMAKE_AUTOMOC TRUE) add_subdirectory(updater) #TODO Move resources files 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_SOURCE_DIR}/theme) endif() set(mirall_UI accountsettings.ui folderwizardsourcepage.ui folderwizardtargetpage.ui generalsettings.ui ignorelisteditor.ui networksettings.ui protocolwidget.ui settingsdialog.ui sslerrordialog.ui wizard/owncloudadvancedsetuppage.ui wizard/owncloudhttpcredspage.ui wizard/owncloudsetupnocredspage.ui wizard/owncloudwizardresultpage.ui ) qt_wrap_ui(mirall_UI_SRCS ${mirall_UI}) set(mirall_SRCS accountsettings.cpp application.cpp folder.cpp folderman.cpp folderstatusmodel.cpp folderwatcher.cpp folderwizard.cpp generalsettings.cpp ignorelisteditor.cpp logbrowser.cpp networksettings.cpp openfilemanager.cpp owncloudgui.cpp owncloudsetupwizard.cpp protocolwidget.cpp selectivesyncdialog.cpp settingsdialog.cpp socketapi.cpp sslbutton.cpp sslerrordialog.cpp syncrunfilelog.cpp systray.cpp wizard/abstractcredswizardpage.cpp wizard/owncloudadvancedsetuppage.cpp wizard/owncloudhttpcredspage.cpp wizard/owncloudsetuppage.cpp wizard/owncloudshibbolethcredspage.cpp wizard/owncloudwizardcommon.cpp wizard/owncloudwizard.cpp wizard/owncloudwizardresultpage.cpp ) set(updater_SRCS updater/ocupdater.cpp updater/updateinfo.cpp updater/updater.cpp ) IF( APPLE ) list(APPEND mirall_SRCS cocoainitializer_mac.mm) list(APPEND mirall_SRCS settingsdialogmac.cpp) if(SPARKLE_FOUND) # Define this, we need to check in updater.cpp add_definitions( -DHAVE_SPARKLE ) list(APPEND updater_SRCS updater/sparkleupdater_mac.mm) endif() ENDIF() IF( NOT WIN32 AND NOT APPLE ) set(mirall_SRCS ${mirall_SRCS} folderwatcher_linux.cpp) ENDIF() IF( WIN32 ) set(mirall_SRCS ${mirall_SRCS} folderwatcher_win.cpp) ENDIF() IF( APPLE ) list(APPEND mirall_SRCS folderwatcher_mac.cpp) ENDIF() set(3rdparty_SRC ../3rdparty/fancylineedit/fancylineedit.cpp ../3rdparty/QProgressIndicator/QProgressIndicator.cpp ../3rdparty/qtlockedfile/qtlockedfile.cpp ../3rdparty/qtsingleapplication/qtlocalpeer.cpp ../3rdparty/qtsingleapplication/qtsingleapplication.cpp ../3rdparty/qtsingleapplication/qtsinglecoreapplication.cpp ) if (APPLE) list(APPEND 3rdparty_SRC ../3rdparty/qtmacgoodies/src/macpreferenceswindow.mm ../3rdparty/qtmacgoodies/src/macstandardicon.mm ) endif() 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_SOURCE_DIR}/src/3rdparty/fancylineedit ${CMAKE_SOURCE_DIR}/src/3rdparty/qjson ${CMAKE_SOURCE_DIR}/src/3rdparty/QProgressIndicator ${CMAKE_SOURCE_DIR}/src/3rdparty/qtlockedfile ${CMAKE_SOURCE_DIR}/src/3rdparty/qtmacgoodies/src ${CMAKE_SOURCE_DIR}/src/3rdparty/qtsingleapplication ) include_directories(${3rdparty_INC}) # csync is required. include_directories(${CMAKE_SOURCE_DIR}/csync/src ${CMAKE_SOURCE_DIR}/csync/src/httpbf/src ${CMAKE_BINARY_DIR}/csync ${CMAKE_BINARY_DIR}/csync/src ) include_directories(${NEON_INCLUDE_DIRS}) include_directories(../libsync ${CMAKE_CURRENT_BINARY_DIR}/../libsync) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) qt_add_translation(mirall_I18N ${TRANSLATIONS}) set( final_src ${MIRALL_RC_SRC} ${mirall_SRCS} ${mirall_UI_SRCS} ${mirallMoc} ${mirall_I18N} ${3rdparty_SRC} ${3rdparty_MOC} ) # add executable icon on windows and osx include( AddAppIconMacro ) set(ownCloud_old ${ownCloud}) # set an icon_app_name. For historical reasons we can not use the # application_shortname for ownCloud but must rather set it manually. if ( EXISTS ${OEM_THEME_DIR}/OEM.cmake ) set(ICON_APP_NAME ${APPLICATION_SHORTNAME}) else() set(ICON_APP_NAME "owncloud") endif() kde4_add_app_icon( ownCloud "${theme_dir}/colored/${ICON_APP_NAME}-icon*.png") list(APPEND final_src ${ownCloud}) set(ownCloud ${ownCloud_old}) if (WITH_DBUS) set(ADDITIONAL_APP_MODULES DBus) endif(WITH_DBUS) if(NOT BUILD_OWNCLOUD_OSX_BUNDLE) if(NOT WIN32) file( GLOB _icons "${theme_dir}/colored/${ICON_APP_NAME}-icon-*.png" ) foreach( _file ${_icons} ) string( REPLACE "${theme_dir}/colored/${ICON_APP_NAME}-icon-" "" _res ${_file} ) string( REPLACE ".png" "" _res ${_res} ) install( FILES ${_file} RENAME ${ICON_APP_NAME}.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 WebKitWidgets Sql ${ADDITIONAL_APP_MODULES}) elseif() if (Qt5Core_FOUND) include(DeployQt5) else(Qt5Core_FOUND) include(DeployQt4) endif(Qt5Core_FOUND) 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 WebKitWidgets Sql ${ADDITIONAL_APP_MODULES}) 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}) endif() add_library(updater STATIC ${updater_SRCS} ${updaterMoc}) target_link_libraries(updater ${synclib_NAME}) qt5_use_modules(updater Widgets Network Xml) set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} ) set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES INSTALL_RPATH "${LIB_INSTALL_DIR}/${APPLICATION_EXECUTABLE}" ) target_link_libraries( ${APPLICATION_EXECUTABLE} ${QT_LIBRARIES} ) target_link_libraries( ${APPLICATION_EXECUTABLE} ${synclib_NAME} ) target_link_libraries( ${APPLICATION_EXECUTABLE} updater ) target_link_libraries( ${APPLICATION_EXECUTABLE} ${OS_SPECIFIC_LINK_LIBRARIES} ) if(WITH_CRASHREPORTER) target_link_libraries( ${APPLICATION_EXECUTABLE} crashreporter-handler) if(UNIX AND NOT MAC) find_package(Threads REQUIRED) target_link_libraries( ${APPLICATION_EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) endif() endif() 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) if(Qt5Core_FOUND) install_qt5_executable(${OWNCLOUD_OSX_BUNDLE} "qtaccessiblewidgets;qsqlite;qcocoa") else(Qt5Core_FOUND) install_qt4_executable(${OWNCLOUD_OSX_BUNDLE} "qtaccessiblewidgets;qsqlite") endif(Qt5Core_FOUND) endif() if(NOT BUILD_OWNCLOUD_OSX_BUNDLE AND 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()