CMakeLists.txt 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
  2. # use a toolchain file if any for Embedded
  3. if (EXISTS "${CMAKE_SOURCE_DIR}/toolchain.cmake")
  4. set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/toolchain.cmake")
  5. endif()
  6. project(PlexMediaPlayer CXX C)
  7. if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
  8. include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
  9. else()
  10. message(WARNING "Could not find conanbuildinfo.cmake - could be a problem! Make sure to run conan install first")
  11. endif()
  12. # we want this to be able to run clang-tidy
  13. set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "" FORCE)
  14. option(OPENELEC "Make an OpenELEC build" OFF)
  15. option(LINUX_DBUS "Enable D-Bus power management" OFF)
  16. if(OPENELEC)
  17. set(LINUX_DBUS ON)
  18. add_definitions(-DKONVERGO_OPENELEC=1)
  19. Message(STATUS "Making an OpenELEC build")
  20. endif(OPENELEC)
  21. if(LINUX_DBUS)
  22. add_definitions(-DLINUX_DBUS=1)
  23. Message(STATUS "Enabling D-Bus power management")
  24. endif(LINUX_DBUS)
  25. if(BUILD_TARGET STREQUAL "RPI")
  26. add_definitions(-DTARGET_RPI=1)
  27. set(RPI_LIBS bcm_host)
  28. Message(STATUS "Build for Raspberry PI target")
  29. endif(BUILD_TARGET STREQUAL "RPI")
  30. option(ENABLE_HELPER "Enable PMP Helper" ON)
  31. if (ENABLE_HELPER)
  32. add_definitions(-DENABLE_HELPER=1)
  33. endif(ENABLE_HELPER)
  34. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  35. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
  36. set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME Core)
  37. macro(set_policy _POLICY _VALUE)
  38. if(POLICY ${_POLICY})
  39. cmake_policy(SET ${_POLICY} ${_VALUE})
  40. endif()
  41. endmacro()
  42. set_policy(CMP0020 NEW)
  43. set_policy(CMP0017 NEW)
  44. set_policy(CMP0058 NEW)
  45. set_policy(CMP0026 OLD)
  46. include(utils)
  47. include(CompilerFlags)
  48. include(DependencyConfiguration)
  49. include(QtConfiguration)
  50. include(VersionConfiguration)
  51. include(NameConfiguration)
  52. include(PlayerConfiguration)
  53. include(InputConfiguration)
  54. include(FindBreakpad)
  55. include(BreakpadSymbols)
  56. include(ClangTidy)
  57. include(WebClientConan)
  58. add_definitions(-DQS_LOG_LINE_NUMBERS -DQS_LOG_SEPARATE_THREAD)
  59. if(APPLE)
  60. include(AppleConfiguration)
  61. elseif(WIN32)
  62. include(Win32Configuration)
  63. elseif(UNIX AND (NOT APPLE))
  64. include(LinuxConfiguration)
  65. endif(APPLE)
  66. if (Qt5_POSITION_INDEPENDENT_CODE)
  67. SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
  68. endif(Qt5_POSITION_INDEPENDENT_CODE)
  69. add_subdirectory(external)
  70. add_subdirectory(src)
  71. include(CPackConfiguration)
  72. add_custom_target(install_app_bundle COMMAND ${CMAKE_COMMAND} -P cmake_install.cmake DEPENDS PlexMediaPlayer PMPHelper)