CMakeLists.txt 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. cmake_minimum_required(VERSION 2.6)
  2. cmake_policy(VERSION 2.8.0)
  3. if(POLICY CMP0020)
  4. cmake_policy(SET CMP0020 NEW)
  5. endif()
  6. project(client)
  7. set(OEM_THEME_DIR "" CACHE STRING "Define directory containing a custom theme")
  8. if ( EXISTS ${OEM_THEME_DIR}/OEM.cmake )
  9. include ( ${OEM_THEME_DIR}/OEM.cmake )
  10. else ()
  11. include ( ${CMAKE_SOURCE_DIR}/OWNCLOUD.cmake )
  12. endif()
  13. # need this logic to not mess with re/uninstallations via macosx.pkgproj
  14. if(${APPLICATION_REV_DOMAIN} STREQUAL "com.owncloud.desktopclient")
  15. set(APPLICATION_REV_DOMAIN_INSTALLER "com.ownCloud.client")
  16. else()
  17. set(APPLICATION_REV_DOMAIN_INSTALLER ${APPLICATION_REV_DOMAIN})
  18. endif()
  19. if (NOT DEFINED APPLICATION_SHORTNAME)
  20. set ( APPLICATION_SHORTNAME ${APPLICATION_NAME} )
  21. endif()
  22. # For usage in XML files we preprocess
  23. string(REPLACE "&" "&" APPLICATION_NAME_XML_ESCAPED "${APPLICATION_NAME}")
  24. string(REPLACE "<" "&lt;" APPLICATION_NAME_XML_ESCAPED "${APPLICATION_NAME_XML_ESCAPED}")
  25. string(REPLACE ">" "&gt;" APPLICATION_NAME_XML_ESCAPED "${APPLICATION_NAME_XML_ESCAPED}")
  26. set(PACKAGE "${APPLICATION_SHORTNAME}-client")
  27. set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
  28. if(NOT CRASHREPORTER_EXECUTABLE)
  29. set(CRASHREPORTER_EXECUTABLE "${APPLICATION_EXECUTABLE}_crash_reporter")
  30. endif()
  31. include(Warnings)
  32. include(${CMAKE_SOURCE_DIR}/VERSION.cmake)
  33. include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
  34. # disable the crashreporter if libcrashreporter-qt is not available or we're building for ARM
  35. if( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty/libcrashreporter-qt/CMakeLists.txt")
  36. set( WITH_CRASHREPORTER OFF )
  37. endif()
  38. if(NOT WITH_CRASHREPORTER)
  39. message(STATUS "Build of crashreporter disabled.")
  40. endif()
  41. #####
  42. ## handle DBUS for Fdo notifications
  43. if( UNIX AND NOT APPLE )
  44. add_definitions( -DUSE_FDO_NOTIFICATIONS)
  45. set(WITH_DBUS ON)
  46. endif()
  47. ####
  48. # Enable Q_ASSERT etc. in all builds
  49. add_definitions( -DQT_FORCE_ASSERTS )
  50. include(GNUInstallDirs)
  51. include(DefineInstallationPaths)
  52. include(GenerateExportHeader)
  53. include(GetGitRevisionDescription)
  54. get_git_head_revision(GIT_REFSPEC GIT_SHA1)
  55. # if we cannot get it from git, directly try .tag (packages)
  56. # this will work if the tar balls have been properly created
  57. # via git-archive.
  58. if ("${GIT_SHA1}" STREQUAL "GITDIR-NOTFOUND")
  59. file(READ ${CMAKE_SOURCE_DIR}/.tag sha1_candidate)
  60. string(REPLACE "\n" "" sha1_candidate ${sha1_candidate})
  61. if (NOT ${sha1_candidate} STREQUAL "$Format:%H$")
  62. message("${sha1_candidate}")
  63. set (GIT_SHA1 "${sha1_candidate}")
  64. endif()
  65. endif()
  66. message(STATUS "GIT_SHA1 ${GIT_SHA1}")
  67. set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
  68. set(DATADIR ${DATA_INSTALL_DIR})
  69. if(WIN32)
  70. set(DATADIR "share")
  71. endif(WIN32)
  72. set(SHAREDIR ${DATADIR})
  73. #####
  74. ## handle BUILD_OWNCLOUD_OSX_BUNDLE
  75. # BUILD_OWNCLOUD_OSX_BUNDLE was not initialized OR set to true on OSX
  76. if(APPLE AND (NOT DEFINED BUILD_OWNCLOUD_OSX_BUNDLE OR BUILD_OWNCLOUD_OSX_BUNDLE))
  77. set(BUILD_OWNCLOUD_OSX_BUNDLE ON)
  78. set(OWNCLOUD_OSX_BUNDLE "${APPLICATION_EXECUTABLE}.app")
  79. set(LIB_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
  80. set(BIN_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
  81. # BUILD_OWNCLOUD_OSX_BUNDLE was disabled on OSX
  82. elseif(APPLE AND NOT BUILD_OWNCLOUD_OSX_BUNDLE)
  83. 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.")
  84. # any other platform
  85. else()
  86. set(BUILD_OWNCLOUD_OSX_BUNDLE OFF)
  87. endif()
  88. #####
  89. # this option removes Http authentication, keychain, shibboleth etc and is intended for
  90. # external authentication mechanisms
  91. option(TOKEN_AUTH_ONLY "TOKEN_AUTH_ONLY" OFF)
  92. if(TOKEN_AUTH_ONLY)
  93. message("Compiling with token authentication")
  94. add_definitions(-DTOKEN_AUTH_ONLY=1)
  95. endif()
  96. option(NO_MSG_HANDLER "Don't redirect QDebug outputs to the log window/file" OFF)
  97. if(NO_MSG_HANDLER)
  98. add_definitions(-DNO_MSG_HANDLER=1)
  99. endif()
  100. # this option creates only libocsync and libowncloudsync
  101. option(BUILD_LIBRARIES_ONLY "BUILD_LIBRARIES_ONLY" OFF)
  102. # When this option is enabled, 5xx errors are not added to the blacklist
  103. # Normally you don't want to enable this option because if a particular file
  104. # triggers a bug on the server, you want the file to be blacklisted.
  105. option(OWNCLOUD_5XX_NO_BLACKLIST "OWNCLOUD_5XX_NO_BLACKLIST" OFF)
  106. if(OWNCLOUD_5XX_NO_BLACKLIST)
  107. add_definitions(-DOWNCLOUD_5XX_NO_BLACKLIST=1)
  108. endif()
  109. # When this option is enabled, a rename that is not allowed will be renamed back
  110. # do the original as a restoration step. Withut this option, the restoration will
  111. # re-download the file instead.
  112. # The default is off because we don't want to rename the files back behind the user's back
  113. # Added for IL issue #550
  114. option(OWNCLOUD_RESTORE_RENAME "OWNCLOUD_RESTORE_RENAME" OFF)
  115. if(OWNCLOUD_RESTORE_RENAME)
  116. add_definitions(-DOWNCLOUD_RESTORE_RENAME=1)
  117. endif()
  118. # Disable shibboleth.
  119. # So the client can be built without QtWebKit
  120. option(NO_SHIBBOLETH "Build without Shibboleth support. Allow to build the client without QtWebKit" OFF)
  121. if(NO_SHIBBOLETH)
  122. message("Compiling without shibboleth")
  123. add_definitions(-DNO_SHIBBOLETH=1)
  124. endif()
  125. if(APPLE)
  126. set( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" )
  127. endif()
  128. find_package(OpenSSL 1.0.0 REQUIRED)
  129. if(APPLE)
  130. find_package(Sparkle)
  131. endif(APPLE)
  132. if(UNIX)
  133. find_package(INotify REQUIRED)
  134. else()
  135. find_package(INotify)
  136. endif()
  137. find_package(Sphinx)
  138. find_package(PdfLatex)
  139. find_package(SQLite3 3.8.0 REQUIRED)
  140. # On some OS, we want to use our own, not the system sqlite
  141. if (USE_OUR_OWN_SQLITE3)
  142. include_directories(BEFORE ${SQLITE3_INCLUDE_DIR})
  143. if (WIN32)
  144. add_definitions(-DSQLITE_API=__declspec\(dllimport\))
  145. endif()
  146. endif()
  147. find_package(ZLIB)
  148. configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
  149. configure_file(test/test_journal.db "${CMAKE_BINARY_DIR}/test/test_journal.db" COPYONLY)
  150. include(OwnCloudCPack.cmake)
  151. add_definitions(-DUNICODE)
  152. add_definitions(-D_UNICODE)
  153. if( WIN32 )
  154. add_definitions( -D__USE_MINGW_ANSI_STDIO=1 )
  155. add_definitions( -DNOMINMAX )
  156. endif( WIN32 )
  157. # Handle Translations, pick all client_* files from trans directory.
  158. file( GLOB TRANS_FILES ${CMAKE_SOURCE_DIR}/translations/client_*.ts)
  159. set(TRANSLATIONS ${TRANS_FILES})
  160. add_subdirectory(csync)
  161. add_subdirectory(src)
  162. if(NOT BUILD_LIBRARIES_ONLY)
  163. add_subdirectory(shell_integration)
  164. add_subdirectory(doc)
  165. add_subdirectory(doc/dev)
  166. add_subdirectory(admin)
  167. endif(NOT BUILD_LIBRARIES_ONLY)
  168. if(UNIT_TESTING)
  169. include(CTest)
  170. enable_testing()
  171. add_subdirectory(test)
  172. endif(UNIT_TESTING)
  173. if(BUILD_OWNCLOUD_OSX_BUNDLE)
  174. install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
  175. configure_file(sync-exclude.lst bin/${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
  176. else()
  177. install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
  178. configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY)
  179. endif()