CMakeLists.txt 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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})
  27. # disable the crashreporter 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(GetGitRevisionDescription)
  44. get_git_head_revision(GIT_REFSPEC GIT_SHA1)
  45. # if we cannot get it from git, directly try .tag (packages)
  46. # this will work if the tar balls have been properly created
  47. # via git-archive.
  48. if (${GIT_SHA1} STREQUAL "GITDIR-NOTFOUND")
  49. file(READ ${CMAKE_SOURCE_DIR}/.tag sha1_candidate)
  50. string(REPLACE "\n" "" sha1_candidate ${sha1_candidate})
  51. if (NOT ${sha1_candidate} STREQUAL "$Format:%H$")
  52. message("${sha1_candidate}")
  53. set (GIT_SHA1 "${sha1_candidate}")
  54. endif()
  55. endif()
  56. message(STATUS "GIT_SHA1 ${GIT_SHA1}")
  57. set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
  58. set(DATADIR ${DATA_INSTALL_DIR})
  59. if(WIN32)
  60. set(DATADIR "share")
  61. endif(WIN32)
  62. set(SHAREDIR ${DATADIR})
  63. #####
  64. ## handle BUILD_OWNCLOUD_OSX_BUNDLE
  65. # BUILD_OWNCLOUD_OSX_BUNDLE was not initialized OR set to true on OSX
  66. if(APPLE AND (NOT DEFINED BUILD_OWNCLOUD_OSX_BUNDLE OR BUILD_OWNCLOUD_OSX_BUNDLE))
  67. set(BUILD_OWNCLOUD_OSX_BUNDLE ON)
  68. set(OWNCLOUD_OSX_BUNDLE "${APPLICATION_EXECUTABLE}.app")
  69. set(LIB_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
  70. set(BIN_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
  71. # BUILD_OWNCLOUD_OSX_BUNDLE was disabled on OSX
  72. elseif(APPLE AND NOT BUILD_OWNCLOUD_OSX_BUNDLE)
  73. 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.")
  74. # any other platform
  75. else()
  76. set(BUILD_OWNCLOUD_OSX_BUNDLE OFF)
  77. endif()
  78. #####
  79. # this option removes Http authentication, keychain, shibboleth etc and is intended for
  80. # external authentication mechanisms
  81. option(TOKEN_AUTH_ONLY "TOKEN_AUTH_ONLY" OFF)
  82. if(TOKEN_AUTH_ONLY)
  83. message("Compiling with token authentication")
  84. add_definitions(-DTOKEN_AUTH_ONLY=1)
  85. endif()
  86. option(NO_MSG_HANDLER "Don't redirect QDebug outputs to the log window/file" OFF)
  87. if(NO_MSG_HANDLER)
  88. add_definitions(-DNO_MSG_HANDLER=1)
  89. endif()
  90. # this option creates only libocsync and libowncloudsync
  91. option(BUILD_LIBRARIES_ONLY "BUILD_LIBRARIES_ONLY" OFF)
  92. # When this option is enabled, 5xx errors are not added to the blacklist
  93. # Normally you don't want to enable this option because if a particular file
  94. # triggers a bug on the server, you want the file to be blacklisted.
  95. option(OWNCLOUD_5XX_NO_BLACKLIST "OWNCLOUD_5XX_NO_BLACKLIST" OFF)
  96. if(OWNCLOUD_5XX_NO_BLACKLIST)
  97. add_definitions(-DOWNCLOUD_5XX_NO_BLACKLIST=1)
  98. endif()
  99. if(APPLE)
  100. set( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" )
  101. endif()
  102. find_package(OpenSSL 1.0.0 REQUIRED)
  103. if(APPLE)
  104. find_package(Sparkle)
  105. endif(APPLE)
  106. if(UNIX)
  107. find_package(INotify REQUIRED)
  108. else()
  109. find_package(INotify)
  110. endif()
  111. find_package(Sphinx)
  112. find_package(PdfLatex)
  113. find_package(SQLite3 3.8.0 REQUIRED)
  114. # On some OS, we want to use our own, not the system sqlite
  115. if (USE_OUR_OWN_SQLITE3)
  116. include_directories(BEFORE ${SQLITE3_INCLUDE_DIR})
  117. endif()
  118. find_package(ZLIB)
  119. configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
  120. configure_file(test/test_journal.db "${CMAKE_BINARY_DIR}/test/test_journal.db" COPYONLY)
  121. include(OwnCloudCPack.cmake)
  122. add_definitions(-DUNICODE)
  123. add_definitions(-D_UNICODE)
  124. if( WIN32 )
  125. add_definitions( -D__USE_MINGW_ANSI_STDIO=1 )
  126. endif( WIN32 )
  127. # Handle Translations, pick all client_* files from trans directory.
  128. file( GLOB TRANS_FILES ${CMAKE_SOURCE_DIR}/translations/client_*.ts)
  129. set(TRANSLATIONS ${TRANS_FILES})
  130. add_subdirectory(csync)
  131. add_subdirectory(src)
  132. if(NOT BUILD_LIBRARIES_ONLY)
  133. add_subdirectory(shell_integration)
  134. add_subdirectory(doc)
  135. add_subdirectory(doc/dev)
  136. add_subdirectory(admin)
  137. endif(NOT BUILD_LIBRARIES_ONLY)
  138. if(UNIT_TESTING)
  139. include(CTest)
  140. enable_testing()
  141. add_subdirectory(test)
  142. endif(UNIT_TESTING)
  143. if(BUILD_OWNCLOUD_OSX_BUNDLE)
  144. install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
  145. configure_file(sync-exclude.lst bin/${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
  146. else()
  147. install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
  148. configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY)
  149. endif()