CMakeLists.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. cmake_minimum_required(VERSION 2.6)
  2. cmake_policy(VERSION 2.8.0)
  3. project(mirall)
  4. set(PACKAGE "mirall")
  5. set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
  6. include(Warnings)
  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. if (NOT DEFINED APPLICATION_SHORTNAME)
  14. set ( APPLICATION_SHORTNAME ${APPLICATION_NAME} )
  15. endif()
  16. include(${CMAKE_SOURCE_DIR}/VERSION.cmake)
  17. configure_file( ${CMAKE_SOURCE_DIR}/src/mirall/version.h.in "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/version.h" )
  18. include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/")
  19. #####
  20. ## handle DBUS for Fdo notifications
  21. if( UNIX AND NOT APPLE )
  22. add_definitions( -DUSE_FDO_NOTIFICATIONS)
  23. set(WITH_DBUS ON)
  24. endif()
  25. ####
  26. include(GNUInstallDirs)
  27. include(DefineInstallationPaths)
  28. include(QtVersionAbstraction)
  29. setup_qt()
  30. include(GetGitRevisionDescription)
  31. get_git_head_revision(GIT_REFSPEC GIT_SHA1)
  32. # if we cannot get it from git, directly try .tag (packages)
  33. # this will work if the tar balls have been properly created
  34. # via git-archive.
  35. if (GIT_SHA1)
  36. if (${GIT_SHA1} STREQUAL "GITDIR-NOTFOUND")
  37. file(READ ${CMAKE_SOURCE_DIR}/.tag sha1_candidate)
  38. string(REPLACE "\n" "" sha1_candidate ${sha1_candidate})
  39. if (NOT ${sha1_candidate} STREQUAL "$Format:%H$")
  40. message("${sha1_candidate}")
  41. set (GIT_SHA1 "${sha1_candidate}")
  42. endif()
  43. endif()
  44. endif()
  45. set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
  46. set(DATADIR ${DATA_INSTALL_DIR})
  47. #####
  48. ## handle BUILD_OWNCLOUD_OSX_BUNDLE
  49. # BUILD_OWNCLOUD_OSX_BUNDLE was not initialized OR set to true on OSX
  50. if(APPLE AND (NOT DEFINED BUILD_OWNCLOUD_OSX_BUNDLE OR BUILD_OWNCLOUD_OSX_BUNDLE))
  51. set(BUILD_OWNCLOUD_OSX_BUNDLE ON)
  52. set(OWNCLOUD_OSX_BUNDLE "${APPLICATION_EXECUTABLE}.app")
  53. set(LIB_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
  54. set(BIN_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS")
  55. # BUILD_OWNCLOUD_OSX_BUNDLE was disabled on OSX
  56. elseif(APPLE AND NOT BUILD_OWNCLOUD_OSX_BUNDLE)
  57. 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.")
  58. # any other platform
  59. else()
  60. set(BUILD_OWNCLOUD_OSX_BUNDLE OFF)
  61. endif()
  62. #####
  63. # this option removes Http authentication, keychain, shibboleth etc and is intended for
  64. # external authentication mechanisms
  65. option(TOKEN_AUTH_ONLY "TOKEN_AUTH_ONLY" OFF)
  66. if(TOKEN_AUTH_ONLY)
  67. message("Compiling with token authentication")
  68. add_definitions(-DTOKEN_AUTH_ONLY=1)
  69. endif()
  70. # this option creates only libocsync and libowncloudsync
  71. option(BUILD_LIBRARIES_ONLY "BUILD_LIBRARIES_ONLY" OFF)
  72. # When this option is enabled, 5xx errors are not added to the clacklist
  73. # Normaly you don't want to enable this option because if a particular file
  74. # trigger a bug on the server, you want the file to be blacklisted.
  75. option(OWNCLOUD_5XX_NO_BLACKLIST "OWNCLOUD_5XX_NO_BLACKLIST" OFF)
  76. if(OWNCLOUD_5XX_NO_BLACKLIST)
  77. add_definitions(-DOWNCLOUD_5XX_NO_BLACKLIST=1)
  78. endif()
  79. #### find libs
  80. #find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest QtWebkit REQUIRED )
  81. #if( UNIX AND NOT APPLE ) # Fdo notifications
  82. # find_package(Qt4 4.7.0 COMPONENTS QtDBus REQUIRED )
  83. #endif()
  84. find_package(Neon REQUIRED)
  85. if(NOT TOKEN_AUTH_ONLY)
  86. if (Qt5Core_DIR)
  87. find_package(Qt5Keychain REQUIRED)
  88. else()
  89. find_package(QtKeychain REQUIRED)
  90. endif()
  91. endif()
  92. if(APPLE)
  93. find_package(Sparkle)
  94. endif(APPLE)
  95. if(UNIX)
  96. find_package(INotify REQUIRED)
  97. else()
  98. find_package(INotify)
  99. endif()
  100. find_package(Sphinx)
  101. find_package(PdfLatex)
  102. configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
  103. configure_file(test/test_journal.db "${CMAKE_BINARY_DIR}/test/test_journal.db" COPYONLY)
  104. # Copy that logo, the installer uses it later
  105. if(BUILD_OWNCLOUD_OSX_BUNDLE)
  106. install(FILES resources/owncloud_logo_blue.png DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
  107. endif()
  108. include(OwnCloudCPack.cmake)
  109. add_definitions(-DUNICODE)
  110. add_definitions(-D_UNICODE)
  111. if( WIN32 )
  112. add_definitions( -D__USE_MINGW_ANSI_STDIO=1 )
  113. endif( WIN32 )
  114. # Handle Translations, pick all mirall_* files from trans directory.
  115. file( GLOB TRANS_FILES ${CMAKE_SOURCE_DIR}/translations/mirall_*.ts)
  116. set(TRANSLATIONS ${TRANS_FILES})
  117. add_subdirectory(csync)
  118. add_subdirectory(src)
  119. add_subdirectory(shell_integration)
  120. add_subdirectory(doc)
  121. add_subdirectory(admin)
  122. if(UNIT_TESTING)
  123. include(CTest)
  124. enable_testing()
  125. add_subdirectory(test)
  126. endif(UNIT_TESTING)
  127. if(BUILD_OWNCLOUD_OSX_BUNDLE)
  128. configure_file(sync-exclude.lst ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
  129. else()
  130. install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
  131. configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY)
  132. endif()