Skip to content

Commit

Permalink
chore: Add QML demo app as subdir of QtScrcpy
Browse files Browse the repository at this point in the history
Also take into account Qt builds which arent built
with X11 support in xmousetap.cpp
  • Loading branch information
kaqduz committed Jan 7, 2025
1 parent a4bd669 commit 4483c3f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
project(all)

add_subdirectory(QtScrcpy)
add_subdirectory(TestQml)
add_subdirectory(QtScrcpy)
13 changes: 12 additions & 1 deletion QtScrcpy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ set(QC_PROJECT_VERSION ${QC_FILE_VERSION})
project(${QC_PROJECT_NAME} VERSION ${QC_PROJECT_VERSION} LANGUAGES CXX)
message(STATUS "[${PROJECT_NAME}] Project ${PROJECT_NAME} ${PROJECT_VERSION}")

option(BUILD_QML_DEMO "Build demo QML app" ON)

# QC define

# check arch
Expand Down Expand Up @@ -68,7 +70,12 @@ if (NOT MSVC)
add_compile_options(-Wall -Wextra -pedantic -Werror)

# disable some warning
add_compile_options(-Wno-nested-anon-types -Wno-c++17-extensions -Wno-overloaded-virtual)
set(QSC_COMPILE_DEFINITIONS -Wno-nested-anon-types -Wno-c++17-extensions -Wno-overloaded-virtual)
if(BUILD_QML_DEMO)
set(QSC_COMPILE_DEFINITIONS ${QSC_COMPILE_DEFINITIONS} -Wno-gnu-zero-variadic-macro-arguments)
endif()

add_compile_options(${QSC_COMPILE_DEFINITIONS})
endif()

#
Expand Down Expand Up @@ -359,3 +366,7 @@ target_link_libraries(QtScrcpyQml PRIVATE
Qt${QT_VERSION_MAJOR}::Quick
QtScrcpyCore
)

if(BUILD_QML_DEMO)
add_subdirectory(TestQml)
endif()
14 changes: 2 additions & 12 deletions TestQml/CMakeLists.txt → QtScrcpy/TestQml/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
cmake_minimum_required(VERSION 3.16)

project(TestQml VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 REQUIRED COMPONENTS Quick)

qt_standard_project_setup(REQUIRES 6.5)

qt_add_executable(appTestQml
main.cpp
)
Expand Down Expand Up @@ -48,9 +38,9 @@ else()
endif()

set_target_properties(appTestQml PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../output/${QC_CPU_ARCH}/${CMAKE_BUILD_TYPE}/$<0:>"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../output/${QC_CPU_ARCH}/${CMAKE_BUILD_TYPE}/$<0:>"
)

add_custom_command(TARGET appTestQml POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/config/config.ini" "${CMAKE_CURRENT_SOURCE_DIR}/../output/${QC_CPU_ARCH}/${CMAKE_BUILD_TYPE}/config/config.ini"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/../../config/config.ini" "${CMAKE_CURRENT_SOURCE_DIR}/../../output/${QC_CPU_ARCH}/${CMAKE_BUILD_TYPE}/config/config.ini"
)
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions QtScrcpy/util/mousetap/xmousetap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void XMouseTap::initMouseEventTap() {}
void XMouseTap::quitMouseEventTap() {}

void XMouseTap::enableMouseEventTap(QRect rc, bool enabled) {
#if QT_FEATURE_xcb==1
if (enabled && rc.isEmpty()) {
return;
}
Expand Down Expand Up @@ -61,4 +62,8 @@ void XMouseTap::enableMouseEventTap(QRect rc, bool enabled) {
XUngrabPointer(display, CurrentTime);
}
XFlush(display);
#else
Q_UNUSED(rc);
Q_UNUSED(enabled);
#endif
}

0 comments on commit 4483c3f

Please sign in to comment.