QtConfiguration.cmake 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. include(FetchDependencies)
  2. if(NOT IS_DIRECTORY ${QTROOT})
  3. download_deps(
  4. "plexmediaplayer-qt"
  5. DIRECTORY dir
  6. DEPHASH QT_DEPS_HASH
  7. ARTIFACTNAME konvergo-qt
  8. )
  9. set(QTROOT ${dir})
  10. endif()
  11. list(APPEND CMAKE_FIND_ROOT_PATH ${QTROOT})
  12. list(APPEND CMAKE_PREFIX_PATH ${QTROOT})
  13. include_directories(${QTROOT}/include)
  14. # Write qt.conf in the Qt depends directory so that the Qt tools can find QML files
  15. set(QTCONFCONTENT "[Paths]
  16. Prefix=${QTROOT}
  17. ")
  18. file(WRITE ${QTROOT}/bin/qt.conf ${QTCONFCONTENT})
  19. set(REQUIRED_QT_VERSION "5.6.0")
  20. message(STATUS ${QTROOT})
  21. set(QTCONFIGROOT ${QTROOT}/lib/cmake/Qt5)
  22. set(components Core Network WebChannel Qml Quick Xml WebEngine)
  23. if(OPENELEC)
  24. set(components ${components} DBus)
  25. endif(OPENELEC)
  26. foreach(COMP ${components})
  27. set(mod Qt5${COMP})
  28. # look for the config files in the QtConfigRoot defined above
  29. set(${mod}_DIR ${QTCONFIGROOT}${COMP})
  30. # look for the actual package
  31. find_package(${mod} ${REQUIRED_QT_VERSION} REQUIRED)
  32. include_directories(${${mod}_INCLUDE_DIRS})
  33. if(OPENELEC)
  34. include_directories(${${mod}_PRIVATE_INCLUDE_DIRS})
  35. endif(OPENELEC)
  36. list(APPEND QT5_LIBRARIES ${${mod}_LIBRARIES})
  37. list(APPEND QT5_CFLAGS ${${mod}_EXECUTABLE_COMPILE_FLAGS})
  38. endforeach(COMP ${components})
  39. list(REMOVE_DUPLICATES QT5_CFLAGS)
  40. if(WIN32)
  41. list(REMOVE_ITEM QT5_CFLAGS -fPIC)
  42. endif(WIN32)
  43. message(STATUS "Qt version: ${Qt5Core_VERSION_STRING}")
  44. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QT5_CFLAGS}")
  45. set(CMAKE_REQUIRED_INCLUDES ${Qt5WebEngine_INCLUDE_DIRS};${Qt5WebEngine_PRIVATE_INCLUDE_DIRS})
  46. set(CMAKE_REQUIRED_LIBRARIES ${QT5_LIBRARIES})