QtConfiguration.cmake 1.5 KB

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