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. DYLIB_SCRIPT_PATH ${PROJECT_SOURCE_DIR}/scripts/fix-install-names.py
  12. )
  13. set(QTROOT ${dir})
  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. endif()
  20. message(STATUS "Qt root directory: ${QTROOT}")
  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. set(QTCONFIGROOT ${QTROOT}/lib/cmake/Qt5)
  26. set(components Core Network WebChannel Qml Quick Xml WebEngine Widgets)
  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. if(QT5_CFLAGS)
  44. list(REMOVE_DUPLICATES QT5_CFLAGS)
  45. if(WIN32)
  46. list(REMOVE_ITEM QT5_CFLAGS -fPIC)
  47. endif(WIN32)
  48. endif(QT5_CFLAGS)
  49. message(STATUS "Qt version: ${Qt5Core_VERSION_STRING}")
  50. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QT5_CFLAGS}")
  51. set(CMAKE_REQUIRED_INCLUDES ${Qt5WebEngine_INCLUDE_DIRS};${Qt5WebEngine_PRIVATE_INCLUDE_DIRS})
  52. set(CMAKE_REQUIRED_LIBRARIES ${QT5_LIBRARIES})