2011-09-26 15:12:00 +04:00
|
|
|
|
2012-04-23 12:56:55 +04:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
2011-02-17 02:21:45 +03:00
|
|
|
project(mirall)
|
2011-04-06 13:28:38 +04:00
|
|
|
set(PACKAGE "mirall")
|
2011-04-07 21:04:07 +04:00
|
|
|
set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
|
2012-05-11 12:19:15 +04:00
|
|
|
|
2013-01-09 19:29:50 +04:00
|
|
|
if ( DEFINED OEM_THEME_DIR AND EXISTS ${OEM_THEME_DIR}/OEM.cmake )
|
|
|
|
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()
|
|
|
|
|
2011-04-06 13:28:38 +04:00
|
|
|
include(${CMAKE_SOURCE_DIR}/VERSION.cmake)
|
2012-07-19 00:43:27 +04:00
|
|
|
configure_file( ${CMAKE_SOURCE_DIR}/src/mirall/version.h.in "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/version.h" )
|
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
|
|
|
|
2012-04-14 06:43:04 +04:00
|
|
|
include(GNUInstallDirs)
|
2012-12-20 23:05:56 +04:00
|
|
|
|
|
|
|
include(GetGitRevisionDescription)
|
|
|
|
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()
|
|
|
|
|
2012-04-26 18:32:50 +04:00
|
|
|
## stupid, we should upstream this
|
2012-10-06 01:01:43 +04:00
|
|
|
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT CMAKE_INSTALL_SYSCONFDIR)
|
2012-04-26 18:32:50 +04:00
|
|
|
set(CMAKE_INSTALL_SYSCONFDIR "/etc")
|
|
|
|
endif()
|
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)
|
2012-09-20 11:19:26 +04:00
|
|
|
set(OWNCLOUD_OSX_BUNDLE "${APPLICATION_EXECUTABLE}.app")
|
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
|
|
|
|
2012-11-13 14:20:55 +04:00
|
|
|
#### find libs
|
2012-04-21 23:03:29 +04:00
|
|
|
find_package(Qt4 4.6.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest REQUIRED )
|
2011-04-07 21:04:07 +04:00
|
|
|
find_package(Csync)
|
2012-12-05 21:23:35 +04:00
|
|
|
if(UNIX)
|
|
|
|
find_package(INotify REQUIRED)
|
|
|
|
else()
|
2012-07-20 19:12:29 +04:00
|
|
|
find_package(INotify)
|
2012-12-05 21:23:35 +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-11-13 14:20:55 +04:00
|
|
|
find_package(QtKeychain)
|
2012-07-20 19:12:29 +04:00
|
|
|
|
|
|
|
set(WITH_CSYNC CSYNC_FOUND)
|
2012-11-28 10:54:57 +04:00
|
|
|
set(WITH_QTKEYCHAIN ${QTKEYCHAIN_FOUND})
|
2012-07-30 18:08:42 +04:00
|
|
|
set(USE_INOTIFY ${INOTIFY_FOUND})
|
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
|
|
|
|
2011-04-06 13:28:38 +04:00
|
|
|
set(CPACK_SOURCE_IGNORE_FILES
|
|
|
|
# hidden files
|
|
|
|
"/\\\\..+$"
|
|
|
|
# temporary files
|
|
|
|
"\\\\.swp$"
|
|
|
|
# backup files
|
|
|
|
"~$"
|
|
|
|
# others
|
|
|
|
"\\\\.#"
|
|
|
|
"/#"
|
|
|
|
"/build/"
|
|
|
|
"/_build/"
|
|
|
|
# used before
|
|
|
|
"\\\\.o$"
|
|
|
|
"\\\\.lo$"
|
|
|
|
"\\\\.la$"
|
|
|
|
"Makefile\\\\.in$"
|
|
|
|
)
|
2012-04-02 15:47:53 +04:00
|
|
|
|
|
|
|
include(OwnCloudCPack.cmake)
|
2011-04-06 13:28:38 +04:00
|
|
|
|
2012-02-16 13:42:44 +04:00
|
|
|
#
|
2012-05-02 17:45:38 +04:00
|
|
|
# This cmake builds two targets (aka apps), mirall and owncloud. For the owncloud
|
|
|
|
# target, OWNCLOUD_CLIENT needs to be a compile flag. It is set in src/CMakeLists.txt
|
|
|
|
# but if that fails because cmake is too old, uncomment this here if you want to build
|
|
|
|
# owncloud.
|
|
|
|
# add_definitions(-DOWNCLOUD_CLIENT)
|
2012-07-30 18:08:42 +04:00
|
|
|
add_definitions(-DUNICODE)
|
|
|
|
add_definitions(-D_UNICODE)
|
2012-02-16 13:42:44 +04:00
|
|
|
|
2012-04-30 14:47:54 +04:00
|
|
|
# Handle Translations, pick all mirall_* files from trans directory.
|
|
|
|
file( GLOB TRANS_FILES ${CMAKE_SOURCE_DIR}/translations/mirall_*.ts)
|
|
|
|
set(TRANSLATIONS ${TRANS_FILES})
|
2012-03-26 11:48:30 +04:00
|
|
|
|
2011-02-17 02:21:45 +03:00
|
|
|
add_subdirectory(src)
|
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)
|
|
|
|
|
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)
|
2012-11-16 19:34:01 +04:00
|
|
|
configure_file(sync-exclude.lst ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
|
2012-04-16 12:51:20 +04:00
|
|
|
else()
|
2012-09-27 15:16:14 +04:00
|
|
|
install( FILES sync-exclude.lst DESTINATION ${CMAKE_INSTALL_SYSCONFDIR} )
|
2012-04-16 12:51:20 +04:00
|
|
|
endif()
|