CMakeLists.txt 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. cmake_minimum_required(VERSION 2.6)
  2. cmake_policy(VERSION 2.8.0)
  3. project(client)
  4. set(OEM_THEME_DIR "" CACHE STRING "Define directory containing a custom theme")
  5. if ( EXISTS ${OEM_THEME_DIR}/OEM.cmake )
  6. include ( ${OEM_THEME_DIR}/OEM.cmake )
  7. else ()
  8. include ( ${CMAKE_SOURCE_DIR}/OWNCLOUD.cmake )
  9. endif()
  10. # need this logic to not mess with re/uninstallations via macosx.pkgproj
  11. if(${APPLICATION_REV_DOMAIN} STREQUAL "com.owncloud.desktopclient")
  12. set(APPLICATION_REV_DOMAIN_INSTALLER "com.ownCloud.client")
  13. else()
  14. set(APPLICATION_REV_DOMAIN_INSTALLER ${APPLICATION_REV_DOMAIN})
  15. endif()
  16. if (NOT DEFINED APPLICATION_SHORTNAME)
  17. set ( APPLICATION_SHORTNAME ${APPLICATION_NAME} )
  18. endif()
  19. set(PACKAGE "${APPLICATION_SHORTNAME}-client")
  20. set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
  21. if(NOT CRASHREPORTER_EXECUTABLE)
  22. set(CRASHREPORTER_EXECUTABLE "${APPLICATION_EXECUTABLE}_crash_reporter")
  23. endif()
  24. include(Warnings)
  25. include(${CMAKE_SOURCE_DIR}/VERSION.cmake)
  26. include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/")
  27. # disable the crashrepoter if libcrashreporter-qt is not available or we're building for ARM
  28. if( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty/libcrashreporter-qt/CMakeLists.txt")
  29. set( WITH_CRASHREPORTER OFF )
  30. endif()
  31. if(NOT WITH_CRASHREPORTER)
  32. message(STATUS "Build of crashreporter disabled.")
  33. endif()
  34. #####
  35. ## handle DBUS for Fdo notifications
  36. if( UNIX AND NOT APPLE )
  37. add_definitions( -DUSE_FDO_NOTIFICATIONS)
  38. set(WITH_DBUS ON)
  39. endif()
  40. ####
  41. include(GNUInstallDirs)
  42. include(DefineInstallationPaths)
  43. include(QtVersionAbstraction)
  44. setup_qt()
  45. include(GetGitRevisionDescription)
  46. get_git_head_revision(GIT_REFSPEC GIT_SHA1)
  47. # if we cannot get it from git, directly try .tag (packages)
  48. # this will work if the tar balls have been properly created
  49. # via git-archive.
  50. if (${GIT_SHA1} STREQUAL "GITDIR-NOTFOUND")
  51. file(READ ${CMAKE_SOURCE_DIR}/.tag sha1_candidate)
  52. string(REPLACE "\n" "" sha1_candidate ${sha1_candidate})
  53. if (NOT ${sha1_candidate} STREQUAL "$Format:%H$")
  54. message("${sha1_candidate}")
  55. set (GIT_SHA1 "${sha1_candidate}")
  56. endif()
  57. endif()
  58. message(STATUS "GIT_SHA1 ${GIT_SHA1}")
  59. set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
  60. set(DATADIR ${DATA_INSTALL_DIR})
  61. #####
  62. ## handle BUILD_OWNCLOUD_OSX_BUNDLE
  63. # BUILD_OWNCLOUD_OSX_BUNDLE was not initialized OR set to true on OSX
  64. if(APPLE AND (NOT DEFINED BUILD_OWNCLOUD_OSX_BUNDLE OR BUILD_OWNCLOUD_OSX_BUNDLE))
  65. set(BUILD_OWNCLOUD_OSX_BUNDLE ON)
  66. set(OWNCLOUD_OSX_BUNDLE "${APPLICATION_EXECUTABLE}.app")
  67. set(LIB_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
  68. set(BIN_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
  69. # BUILD_OWNCLOUD_OSX_BUNDLE was disabled on OSX
  70. elseif(APPLE AND NOT BUILD_OWNCLOUD_OSX_BUNDLE)
  71. 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.")
  72. # any other platform
  73. else()
  74. set(BUILD_OWNCLOUD_OSX_BUNDLE OFF)
  75. endif()
  76. #####
  77. # this option removes Http authentication, keychain, shibboleth etc and is intended for
  78. # external authentication mechanisms
  79. option(TOKEN_AUTH_ONLY "TOKEN_AUTH_ONLY" OFF)
  80. if(TOKEN_AUTH_ONLY)
  81. message("Compiling with token authentication")
  82. add_definitions(-DTOKEN_AUTH_ONLY=1)
  83. endif()
  84. option(NO_MSG_HANDLER "Don't redirect QDebug outputs to the log window/file" OFF)
  85. if(NO_MSG_HANDLER)
  86. add_definitions(-DNO_MSG_HANDLER=1)
  87. endif()
  88. # this option creates only libocsync and libowncloudsync
  89. option(BUILD_LIBRARIES_ONLY "BUILD_LIBRARIES_ONLY" OFF)
  90. # When this option is enabled, 5xx errors are not added to the clacklist
  91. # Normaly you don't want to enable this option because if a particular file
  92. # trigger a bug on the server, you want the file to be blacklisted.
  93. option(OWNCLOUD_5XX_NO_BLACKLIST "OWNCLOUD_5XX_NO_BLACKLIST" OFF)
  94. if(OWNCLOUD_5XX_NO_BLACKLIST)
  95. add_definitions(-DOWNCLOUD_5XX_NO_BLACKLIST=1)
  96. endif()
  97. #### find libs
  98. #find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest QtWebkit REQUIRED )
  99. #if( UNIX AND NOT APPLE ) # Fdo notifications
  100. # find_package(Qt4 4.7.0 COMPONENTS QtDBus REQUIRED )
  101. #endif()
  102. set(USE_NEON TRUE)
  103. if(HAVE_QT5)
  104. message(STATUS "Using Qt ${Qt5Core_VERSION_MAJOR}.${Qt5Core_VERSION_MINOR}.x")
  105. if (${Qt5Core_VERSION_MAJOR} EQUAL "5")
  106. if (${Qt5Core_VERSION_MINOR} EQUAL "4" OR ${Qt5Core_VERSION_MINOR} GREATER 4)
  107. message(STATUS "We would not require Neon in this setup, compile without!")
  108. set(USE_NEON FALSE)
  109. else()
  110. message(STATUS "Still requiring Neon with this Qt version :-( Qt 5.4 is better!")
  111. endif()
  112. endif()
  113. else()
  114. message(STATUS "If possible compile me with Qt 5.4 which is much faster/better.")
  115. endif()
  116. if (USE_NEON)
  117. find_package(Neon REQUIRED)
  118. endif(USE_NEON)
  119. find_package(OpenSSL 1.0.0 REQUIRED)
  120. if(NOT TOKEN_AUTH_ONLY)
  121. if (Qt5Core_DIR)
  122. find_package(Qt5Keychain REQUIRED)
  123. else()
  124. find_package(QtKeychain REQUIRED)
  125. endif()
  126. endif()
  127. if(APPLE)
  128. find_package(Sparkle)
  129. endif(APPLE)
  130. if(UNIX)
  131. find_package(INotify REQUIRED)
  132. else()
  133. find_package(INotify)
  134. endif()
  135. find_package(Sphinx)
  136. find_package(PdfLatex)
  137. find_package(SQLite3 3.8.0 REQUIRED)
  138. # On some OS, we want to use our own, not the system sqlite
  139. if (USE_OUR_OWN_SQLITE3)
  140. include_directories(BEFORE ${SQLITE3_INCLUDE_DIR})
  141. endif()
  142. configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
  143. configure_file(test/test_journal.db "${CMAKE_BINARY_DIR}/test/test_journal.db" COPYONLY)
  144. include(OwnCloudCPack.cmake)
  145. add_definitions(-DUNICODE)
  146. add_definitions(-D_UNICODE)
  147. if( WIN32 )
  148. add_definitions( -D__USE_MINGW_ANSI_STDIO=1 )
  149. endif( WIN32 )
  150. # Handle Translations, pick all client_* files from trans directory.
  151. file( GLOB TRANS_FILES ${CMAKE_SOURCE_DIR}/translations/client_*.ts)
  152. set(TRANSLATIONS ${TRANS_FILES})
  153. add_subdirectory(csync)
  154. add_subdirectory(src)
  155. if(NOT BUILD_LIBRARIES_ONLY)
  156. add_subdirectory(shell_integration)
  157. add_subdirectory(doc)
  158. add_subdirectory(admin)
  159. endif(NOT BUILD_LIBRARIES_ONLY)
  160. if(UNIT_TESTING)
  161. include(CTest)
  162. enable_testing()
  163. add_subdirectory(test)
  164. endif(UNIT_TESTING)
  165. if(BUILD_OWNCLOUD_OSX_BUNDLE)
  166. install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
  167. else()
  168. install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
  169. configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY)
  170. endif()