2012-04-23 12:56:55 +04:00
cmake_minimum_required ( VERSION 2.6 )
2015-08-10 12:57:05 +03:00
cmake_policy ( VERSION 2.8.0 )
2014-08-01 12:54:04 +04:00
2014-11-10 00:30:05 +03:00
project ( client )
2013-08-07 14:36:45 +04:00
2013-05-17 22:56:17 +04:00
set ( OEM_THEME_DIR "" CACHE STRING "Define directory containing a custom theme" )
if ( EXISTS ${ OEM_THEME_DIR } /OEM.cmake )
2013-01-09 19:29:50 +04:00
include ( ${ OEM_THEME_DIR } /OEM.cmake )
2012-09-20 11:19:26 +04:00
else ( )
2012-09-26 13:29:55 +04:00
include ( ${ CMAKE_SOURCE_DIR } /OWNCLOUD.cmake )
2012-09-20 11:19:26 +04:00
endif ( )
2014-11-17 20:30:32 +03:00
# need this logic to not mess with re/uninstallations via macosx.pkgproj
if ( ${ APPLICATION_REV_DOMAIN } STREQUAL "com.owncloud.desktopclient" )
set ( APPLICATION_REV_DOMAIN_INSTALLER "com.ownCloud.client" )
else ( )
set ( APPLICATION_REV_DOMAIN_INSTALLER ${ APPLICATION_REV_DOMAIN } )
endif ( )
2013-08-23 12:16:54 +04:00
if ( NOT DEFINED APPLICATION_SHORTNAME )
set ( APPLICATION_SHORTNAME ${ APPLICATION_NAME } )
endif ( )
2014-11-10 00:30:05 +03:00
set ( PACKAGE "${APPLICATION_SHORTNAME}-client" )
set ( CMAKE_MODULE_PATH ${ CMAKE_SOURCE_DIR } /cmake/modules )
2014-08-30 12:46:09 +04:00
if ( NOT CRASHREPORTER_EXECUTABLE )
set ( CRASHREPORTER_EXECUTABLE "${APPLICATION_EXECUTABLE}_crash_reporter" )
endif ( )
2014-11-10 00:30:05 +03:00
include ( Warnings )
2011-04-06 13:28:38 +04:00
include ( ${ CMAKE_SOURCE_DIR } /VERSION.cmake )
2013-04-25 15:19:13 +04:00
include_directories ( BEFORE ${ CMAKE_CURRENT_BINARY_DIR } "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/" )
2012-04-26 18:32:50 +04:00
2015-09-10 10:35:11 +03:00
# disable the crashreporter if libcrashreporter-qt is not available or we're building for ARM
2014-08-28 14:05:00 +04:00
if ( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty/libcrashreporter-qt/CMakeLists.txt" )
set ( WITH_CRASHREPORTER OFF )
endif ( )
if ( NOT WITH_CRASHREPORTER )
message ( STATUS "Build of crashreporter disabled." )
endif ( )
2013-09-05 20:41:49 +04:00
#####
## handle DBUS for Fdo notifications
if ( UNIX AND NOT APPLE )
add_definitions ( -DUSE_FDO_NOTIFICATIONS )
set ( WITH_DBUS ON )
endif ( )
####
2012-04-14 06:43:04 +04:00
include ( GNUInstallDirs )
2013-08-22 11:40:15 +04:00
include ( DefineInstallationPaths )
2013-08-24 16:57:55 +04:00
include ( QtVersionAbstraction )
2013-08-28 22:14:40 +04:00
setup_qt ( )
2012-12-20 23:05:56 +04:00
include ( GetGitRevisionDescription )
2015-02-06 14:18:09 +03:00
2012-12-20 23:05:56 +04:00
get_git_head_revision ( GIT_REFSPEC GIT_SHA1 )
# if we cannot get it from git, directly try .tag (packages)
# this will work if the tar balls have been properly created
# via git-archive.
if ( ${ GIT_SHA1 } STREQUAL "GITDIR-NOTFOUND" )
file ( READ ${ CMAKE_SOURCE_DIR } /.tag sha1_candidate )
string ( REPLACE "\n" "" sha1_candidate ${ sha1_candidate } )
if ( NOT ${ sha1_candidate } STREQUAL "$Format:%H$" )
message ( "${sha1_candidate}" )
set ( GIT_SHA1 "${sha1_candidate}" )
endif ( )
endif ( )
2014-10-27 13:54:16 +03:00
message ( STATUS "GIT_SHA1 ${GIT_SHA1}" )
2012-12-20 23:05:56 +04:00
2013-08-22 11:40:15 +04:00
set ( SYSCONFDIR ${ SYSCONF_INSTALL_DIR } )
set ( DATADIR ${ DATA_INSTALL_DIR } )
2015-07-30 17:37:22 +03:00
if ( WIN32 )
set ( DATADIR "share" )
endif ( WIN32 )
set ( SHAREDIR ${ DATADIR } )
2012-04-14 06:43:04 +04:00
2012-08-06 18:01:43 +04:00
#####
## handle BUILD_OWNCLOUD_OSX_BUNDLE
# BUILD_OWNCLOUD_OSX_BUNDLE was not initialized OR set to true on OSX
if ( APPLE AND ( NOT DEFINED BUILD_OWNCLOUD_OSX_BUNDLE OR BUILD_OWNCLOUD_OSX_BUNDLE ) )
set ( BUILD_OWNCLOUD_OSX_BUNDLE ON )
2014-10-22 13:54:02 +04:00
set ( OWNCLOUD_OSX_BUNDLE "${APPLICATION_EXECUTABLE}.app" )
set ( LIB_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS" )
set ( BIN_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS" )
2012-08-06 18:01:43 +04:00
# BUILD_OWNCLOUD_OSX_BUNDLE was disabled on OSX
elseif ( APPLE AND NOT BUILD_OWNCLOUD_OSX_BUNDLE )
message ( FATAL_ERROR "Building in non-bundle mode on OSX is currently not supported. Comment this error out if you want to work on/test it." )
# any other platform
else ( )
set ( BUILD_OWNCLOUD_OSX_BUNDLE OFF )
2012-04-16 12:51:20 +04:00
endif ( )
2012-08-06 18:01:43 +04:00
#####
2012-04-16 12:51:20 +04:00
2014-03-12 17:20:38 +04:00
# this option removes Http authentication, keychain, shibboleth etc and is intended for
# external authentication mechanisms
option ( TOKEN_AUTH_ONLY "TOKEN_AUTH_ONLY" OFF )
if ( TOKEN_AUTH_ONLY )
message ( "Compiling with token authentication" )
add_definitions ( -DTOKEN_AUTH_ONLY=1 )
endif ( )
2015-02-19 18:49:39 +03:00
option ( NO_MSG_HANDLER "Don't redirect QDebug outputs to the log window/file" OFF )
if ( NO_MSG_HANDLER )
add_definitions ( -DNO_MSG_HANDLER=1 )
endif ( )
2014-03-12 17:20:38 +04:00
# this option creates only libocsync and libowncloudsync
option ( BUILD_LIBRARIES_ONLY "BUILD_LIBRARIES_ONLY" OFF )
2015-09-10 10:35:11 +03:00
# When this option is enabled, 5xx errors are not added to the blacklist
# Normally you don't want to enable this option because if a particular file
# triggers a bug on the server, you want the file to be blacklisted.
2014-04-29 13:39:46 +04:00
option ( OWNCLOUD_5XX_NO_BLACKLIST "OWNCLOUD_5XX_NO_BLACKLIST" OFF )
if ( OWNCLOUD_5XX_NO_BLACKLIST )
add_definitions ( -DOWNCLOUD_5XX_NO_BLACKLIST=1 )
endif ( )
2015-06-22 14:53:05 +03:00
if ( APPLE )
2015-09-10 10:35:11 +03:00
set ( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" )
2015-06-22 14:53:05 +03:00
endif ( )
2012-11-13 14:20:55 +04:00
#### find libs
2013-08-24 16:57:55 +04:00
#find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest QtWebkit REQUIRED )
#if( UNIX AND NOT APPLE ) # Fdo notifications
# find_package(Qt4 4.7.0 COMPONENTS QtDBus REQUIRED )
#endif()
2015-01-22 16:27:49 +03:00
2015-01-23 17:30:00 +03:00
2015-01-22 16:27:49 +03:00
if ( HAVE_QT5 )
if ( ${ Qt5Core_VERSION_MAJOR } EQUAL "5" )
if ( ${ Qt5Core_VERSION_MINOR } EQUAL "4" OR ${ Qt5Core_VERSION_MINOR } GREATER 4 )
else ( )
2015-06-15 15:28:11 +03:00
message ( STATUS "If possible compile me with Qt 5.4 or higher." )
2015-01-22 16:27:49 +03:00
endif ( )
endif ( )
2015-01-23 13:59:50 +03:00
else ( )
2015-06-15 15:28:11 +03:00
message ( STATUS "If possible compile me with Qt 5.4 or higher." )
2015-01-22 16:27:49 +03:00
endif ( )
2015-02-05 15:08:05 +03:00
find_package ( OpenSSL 1.0.0 REQUIRED )
2014-03-12 17:20:38 +04:00
if ( NOT TOKEN_AUTH_ONLY )
2014-03-14 20:27:50 +04:00
if ( Qt5Core_DIR )
find_package ( Qt5Keychain REQUIRED )
else ( )
find_package ( QtKeychain REQUIRED )
endif ( )
2014-03-12 21:38:59 +04:00
endif ( )
2014-03-12 17:20:38 +04:00
2014-06-02 21:02:20 +04:00
if ( APPLE )
find_package ( Sparkle )
endif ( APPLE )
2014-01-23 19:05:07 +04:00
if ( UNIX )
2014-03-12 21:38:59 +04:00
find_package ( INotify REQUIRED )
2014-01-23 19:05:07 +04:00
else ( )
2014-03-12 21:38:59 +04:00
find_package ( INotify )
2014-01-23 19:05:07 +04:00
endif ( )
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
find_package ( Sphinx )
find_package ( PdfLatex )
2012-07-20 19:12:29 +04:00
2014-10-16 19:16:29 +04:00
find_package ( SQLite3 3.8.0 REQUIRED )
# On some OS, we want to use our own, not the system sqlite
if ( USE_OUR_OWN_SQLITE3 )
include_directories ( BEFORE ${ SQLITE3_INCLUDE_DIR } )
endif ( )
2015-05-12 16:48:13 +03:00
find_package ( ZLIB )
2012-07-20 19:12:29 +04:00
configure_file ( config.h.in ${ CMAKE_CURRENT_BINARY_DIR } /config.h )
2011-04-07 21:04:07 +04:00
2014-03-20 15:34:06 +04:00
configure_file ( test/test_journal.db "${CMAKE_BINARY_DIR}/test/test_journal.db" COPYONLY )
2012-04-02 15:47:53 +04:00
include ( OwnCloudCPack.cmake )
2011-04-06 13:28:38 +04:00
2012-07-30 18:08:42 +04:00
add_definitions ( -DUNICODE )
add_definitions ( -D_UNICODE )
2014-03-05 18:39:49 +04:00
if ( WIN32 )
add_definitions ( -D__USE_MINGW_ANSI_STDIO=1 )
endif ( WIN32 )
2012-02-16 13:42:44 +04:00
2015-02-08 01:28:20 +03:00
# Handle Translations, pick all client_* files from trans directory.
file ( GLOB TRANS_FILES ${ CMAKE_SOURCE_DIR } /translations/client_*.ts )
2012-04-30 14:47:54 +04:00
set ( TRANSLATIONS ${ TRANS_FILES } )
2012-03-26 11:48:30 +04:00
2014-01-15 15:20:03 +04:00
add_subdirectory ( csync )
2011-02-17 02:21:45 +03:00
add_subdirectory ( src )
2014-11-21 14:15:41 +03:00
if ( NOT BUILD_LIBRARIES_ONLY )
2014-07-02 12:10:22 +04:00
add_subdirectory ( shell_integration )
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
add_subdirectory ( doc )
2015-06-26 18:07:47 +03:00
add_subdirectory ( doc/dev )
2014-08-26 18:01:36 +04:00
add_subdirectory ( admin )
2014-11-21 14:15:41 +03:00
endif ( NOT BUILD_LIBRARIES_ONLY )
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
2012-07-19 00:56:47 +04:00
if ( UNIT_TESTING )
2012-10-26 22:24:12 +04:00
include ( CTest )
enable_testing ( )
2012-07-19 00:56:47 +04:00
add_subdirectory ( test )
endif ( UNIT_TESTING )
2012-03-26 11:48:30 +04:00
2012-04-16 12:51:20 +04:00
if ( BUILD_OWNCLOUD_OSX_BUNDLE )
2015-01-09 16:37:59 +03:00
install ( FILES sync-exclude.lst DESTINATION ${ OWNCLOUD_OSX_BUNDLE } /Contents/Resources/ )
2015-07-06 15:59:08 +03:00
configure_file ( sync-exclude.lst bin/ ${ OWNCLOUD_OSX_BUNDLE } /Contents/Resources/sync-exclude.lst COPYONLY )
2012-04-16 12:51:20 +04:00
else ( )
2013-08-22 11:51:35 +04:00
install ( FILES sync-exclude.lst DESTINATION ${ SYSCONFDIR } / ${ APPLICATION_SHORTNAME } )
2014-09-03 16:33:58 +04:00
configure_file ( sync-exclude.lst bin/sync-exclude.lst COPYONLY )
2012-04-16 12:51:20 +04:00
endif ( )