QtConfiguration.cmake 1.8 KB

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