Skip to content

Commit

Permalink
feat: Add minimal QML support, add simple demo QML app
Browse files Browse the repository at this point in the history
  • Loading branch information
kaqduz committed Jan 6, 2025
1 parent 42c65d2 commit a4bd669
Show file tree
Hide file tree
Showing 10 changed files with 1,662 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
project(all)

add_subdirectory(QtScrcpy)
add_subdirectory(TestQml)
26 changes: 23 additions & 3 deletions QtScrcpy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Network Multimedia OpenGL OpenGLWidgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Network Multimedia OpenGL OpenGLWidgets REQUIRED)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Network Multimedia OpenGL OpenGLWidgets Quick REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Network Multimedia OpenGL OpenGLWidgets Quick REQUIRED)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(X11 REQUIRED)
endif()
Expand Down Expand Up @@ -297,6 +297,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_link_libraries(${PROJECT_NAME} PRIVATE "-framework AppKit")
endif()

qt_add_library(QtScrcpyQml STATIC)

# Linux
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
get_target_property(QSC_BIN_OUTPUT_PATH ${PROJECT_NAME} RUNTIME_OUTPUT_DIRECTORY)
Expand All @@ -313,7 +315,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")

target_link_libraries(${PROJECT_NAME} PRIVATE
# qx11
Qt${QT_VERSION_MAJOR}::CorePrivate
# xcb https://doc.qt.io/qt-5/linux-requirements.html
xcb
# pthread
Expand All @@ -339,3 +340,22 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::OpenGLWidgets
QtScrcpyCore
)

qt_add_qml_module(QtScrcpyQml
SOURCES
URI "QtScrcpy"
VERSION 1.0
SOURCES
qml/scrcpyitem.h qml/scrcpyitem.cpp
qml/scrcpymanager.h qml/scrcpymanager.cpp
util/config.h
util/config.cpp
)

target_include_directories(QtScrcpyQml PRIVATE qml)

target_link_libraries(QtScrcpyQml PRIVATE
Qt${QT_VERSION_MAJOR}::OpenGL
Qt${QT_VERSION_MAJOR}::Quick
QtScrcpyCore
)
2 changes: 1 addition & 1 deletion QtScrcpy/QtScrcpyCore
Submodule QtScrcpyCore updated 0 files
Loading

0 comments on commit a4bd669

Please sign in to comment.