QtConfiguration.cmake 1.7 KB

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