QtConfiguration.cmake 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. include(FetchDependencies)
  2. download_deps("plexmediaplayer-qt" dir)
  3. set(QTROOT ${dir})
  4. list(APPEND CMAKE_FIND_ROOT_PATH ${dir})
  5. list(APPEND CMAKE_PREFIX_PATH ${dir})
  6. include_directories(${dir}/include)
  7. set(REQUIRED_QT_VERSION "5.5.0")
  8. message(STATUS ${QTROOT})
  9. set(QTCONFIGROOT ${QTROOT}/lib/cmake/Qt5)
  10. set(components Core Network WebChannel Qml Quick Xml WebEngine)
  11. if(OPENELEC)
  12. set(components ${components} DBus)
  13. endif(OPENELEC)
  14. foreach(COMP ${components})
  15. set(mod Qt5${COMP})
  16. # look for the config files in the QtConfigRoot defined above
  17. set(${mod}_DIR ${QTCONFIGROOT}${COMP})
  18. # look for the actual package
  19. find_package(${mod} ${REQUIRED_QT_VERSION} REQUIRED)
  20. include_directories(${${mod}_INCLUDE_DIRS})
  21. if(OPENELEC)
  22. include_directories(${${mod}_PRIVATE_INCLUDE_DIRS})
  23. endif(OPENELEC)
  24. list(APPEND QT5_LIBRARIES ${${mod}_LIBRARIES})
  25. list(APPEND QT5_CFLAGS ${${mod}_EXECUTABLE_COMPILE_FLAGS})
  26. endforeach(COMP ${components})
  27. list(REMOVE_DUPLICATES QT5_CFLAGS)
  28. if(WIN32)
  29. list(REMOVE_ITEM QT5_CFLAGS -fPIC)
  30. endif(WIN32)
  31. message(STATUS "Qt version: ${Qt5Core_VERSION_STRING}")
  32. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QT5_CFLAGS}")
  33. set(CMAKE_REQUIRED_INCLUDES ${Qt5WebEngine_INCLUDE_DIRS};${Qt5WebEngine_PRIVATE_INCLUDE_DIRS})
  34. set(CMAKE_REQUIRED_LIBRARIES ${QT5_LIBRARIES})
  35. OPTION(SKIP_QT_TEST "Skip tests for required Qt features" OFF)
  36. if(NOT SKIP_QT_TEST)
  37. include(CheckCXXSourceCompiles)
  38. check_cxx_source_compiles("
  39. #include <private/qquickwebengineview_p.h>
  40. #include <QColor>
  41. int main()
  42. {
  43. QQuickWebEngineView* view = new QQuickWebEngineView(NULL);
  44. view->setBackgroundColor(QColor(\"transparent\"));
  45. }
  46. " WebEngineBackgroundProperty)
  47. if(NOT WebEngineBackgroundProperty)
  48. message(FATAL_ERROR "QQuickWebEngineView doesn't have the background property."
  49. "This will break video playback. As of Qt 5.5 you need to manually patch and build Qt to get this property."
  50. "With the release of Qt5.6 it will no longer be required. See qt-patches/README for more details.")
  51. endif(NOT WebEngineBackgroundProperty)
  52. endif(NOT SKIP_QT_TEST)