CMakeLists.txt 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. include(GNUInstallDirs)
  49. include(DefineInstallationPaths)
  50. include(GenerateExportHeader)
  51. include(GetGitRevisionDescription)
  52. get_git_head_revision(GIT_REFSPEC GIT_SHA1)
  53. # if we cannot get it from git, directly try .tag (packages)
  54. # this will work if the tar balls have been properly created
  55. # via git-archive.
  56. if (${GIT_SHA1} STREQUAL "GITDIR-NOTFOUND")
  57. file(READ ${CMAKE_SOURCE_DIR}/.tag sha1_candidate)
  58. string(REPLACE "\n" "" sha1_candidate ${sha1_candidate})
  59. if (NOT ${sha1_candidate} STREQUAL "$Format:%H$")
  60. message("${sha1_candidate}")
  61. set (GIT_SHA1 "${sha1_candidate}")
  62. endif()
  63. endif()
  64. message(STATUS "GIT_SHA1 ${GIT_SHA1}")
  65. set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
  66. set(DATADIR ${DATA_INSTALL_DIR})
  67. if(WIN32)
  68. set(DATADIR "share")
  69. endif(WIN32)
  70. set(SHAREDIR ${DATADIR})
  71. #####
  72. ## handle BUILD_OWNCLOUD_OSX_BUNDLE
  73. # BUILD_OWNCLOUD_OSX_BUNDLE was not initialized OR set to true on OSX
  74. if(APPLE AND (NOT DEFINED BUILD_OWNCLOUD_OSX_BUNDLE OR BUILD_OWNCLOUD_OSX_BUNDLE))
  75. set(BUILD_OWNCLOUD_OSX_BUNDLE ON)
  76. set(OWNCLOUD_OSX_BUNDLE "${APPLICATION_EXECUTABLE}.app")
  77. set(LIB_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
  78. set(BIN_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
  79. # BUILD_OWNCLOUD_OSX_BUNDLE was disabled on OSX
  80. elseif(APPLE AND NOT BUILD_OWNCLOUD_OSX_BUNDLE)
  81. 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.")
  82. # any other platform
  83. else()
  84. set(BUILD_OWNCLOUD_OSX_BUNDLE OFF)
  85. endif()
  86. #####
  87. # this option removes Http authentication, keychain, shibboleth etc and is intended for
  88. # external authentication mechanisms
  89. option(TOKEN_AUTH_ONLY "TOKEN_AUTH_ONLY" OFF)
  90. if(TOKEN_AUTH_ONLY)
  91. message("Compiling with token authentication")
  92. add_definitions(-DTOKEN_AUTH_ONLY=1)
  93. endif()
  94. option(NO_MSG_HANDLER "Don't redirect QDebug outputs to the log window/file" OFF)
  95. if(NO_MSG_HANDLER)
  96. add_definitions(-DNO_MSG_HANDLER=1)
  97. endif()
  98. # this option creates only libocsync and libowncloudsync
  99. option(BUILD_LIBRARIES_ONLY "BUILD_LIBRARIES_ONLY" OFF)
  100. # When this option is enabled, 5xx errors are not added to the blacklist
  101. # Normally you don't want to enable this option because if a particular file
  102. # triggers a bug on the server, you want the file to be blacklisted.
  103. option(OWNCLOUD_5XX_NO_BLACKLIST "OWNCLOUD_5XX_NO_BLACKLIST" OFF)
  104. if(OWNCLOUD_5XX_NO_BLACKLIST)
  105. add_definitions(-DOWNCLOUD_5XX_NO_BLACKLIST=1)
  106. endif()
  107. # When this option is enabled, a rename that is not allowed will be renamed back
  108. # do the original as a restoration step. Withut this option, the restoration will
  109. # re-download the file instead.
  110. # The default is off because we don't want to rename the files back behind the user's back
  111. # Added for IL issue #550
  112. option(OWNCLOUD_RESTORE_RENAME "OWNCLOUD_RESTORE_RENAME" OFF)
  113. if(OWNCLOUD_RESTORE_RENAME)
  114. add_definitions(-DOWNCLOUD_RESTORE_RENAME=1)
  115. endif()
  116. # Disable shibboleth.
  117. # So the client can be built without QtWebKit
  118. option(NO_SHIBBOLETH "Build without Shibboleth support. Allow to build the client without QtWebKit" OFF)
  119. if(NO_SHIBBOLETH)
  120. message("Compiling without shibboleth")
  121. add_definitions(-DNO_SHIBBOLETH=1)
  122. endif()
  123. if(APPLE)
  124. set( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" )
  125. endif()
  126. find_package(OpenSSL 1.0.0 REQUIRED)
  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. if (WIN32)
  142. add_definitions(-DSQLITE_API=__declspec\(dllimport\))
  143. endif()
  144. endif()
  145. find_package(ZLIB)
  146. configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
  147. configure_file(test/test_journal.db "${CMAKE_BINARY_DIR}/test/test_journal.db" COPYONLY)
  148. include(OwnCloudCPack.cmake)
  149. add_definitions(-DUNICODE)
  150. add_definitions(-D_UNICODE)
  151. if( WIN32 )
  152. add_definitions( -D__USE_MINGW_ANSI_STDIO=1 )
  153. add_definitions( -DNOMINMAX )
  154. endif( WIN32 )
  155. # Handle Translations, pick all client_* files from trans directory.
  156. file( GLOB TRANS_FILES ${CMAKE_SOURCE_DIR}/translations/client_*.ts)
  157. set(TRANSLATIONS ${TRANS_FILES})
  158. add_subdirectory(csync)
  159. add_subdirectory(src)
  160. if(NOT BUILD_LIBRARIES_ONLY)
  161. add_subdirectory(shell_integration)
  162. add_subdirectory(doc)
  163. add_subdirectory(doc/dev)
  164. add_subdirectory(admin)
  165. endif(NOT BUILD_LIBRARIES_ONLY)
  166. if(UNIT_TESTING)
  167. include(CTest)
  168. enable_testing()
  169. add_subdirectory(test)
  170. endif(UNIT_TESTING)
  171. if(BUILD_OWNCLOUD_OSX_BUNDLE)
  172. install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
  173. configure_file(sync-exclude.lst bin/${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
  174. else()
  175. install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
  176. configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY)
  177. endif()