QtConfiguration.cmake 1.7 KB

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