CMakeLists.txt 6.5 KB

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