diff --git a/CMakeLists.txt b/CMakeLists.txt index 773bd74..aa3abfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/src/cpp/settingPageTool) add_subdirectory(${CMAKE_SOURCE_DIR}/src/cpp/utils) if(CMAKE_BUILD_TYPE STREQUAL "Debug") + message("Enable Qml Debug") target_compile_definitions(${EXE_NAME} PRIVATE QT_QML_DEBUG) endif() diff --git a/src/cpp/imagePageTool/CMakeLists.txt b/src/cpp/imagePageTool/CMakeLists.txt index 4317cc3..01a39b4 100644 --- a/src/cpp/imagePageTool/CMakeLists.txt +++ b/src/cpp/imagePageTool/CMakeLists.txt @@ -13,17 +13,19 @@ set(QSC_DEPLOY_PATH ${CMAKE_BINARY_DIR}/lib) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/scrcpy/core) +# ffmpeg +set(FFMPEG_PATH "F:\\Soft\\libffmpeg_7.1_msvc17_x64") +target_include_directories(${EXE_NAME} PRIVATE ${FFMPEG_PATH}\\include) +target_link_directories(${EXE_NAME} PRIVATE ${FFMPEG_PATH}\\lib) + find_program(ADB_PATH adb) if(ADB_PATH) message(STATUS "Found adb at: ${ADB_PATH}") + target_compile_definitions(${EXE_NAME} PRIVATE ADB_PATH="${ADB_PATH}") else() message(FATAL_ERROR "adb not found on your system") endif() -if(ADB_PATH) - add_definitions(-DADB_PATH="${ADB_PATH}") -endif() - # MacOS if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") find_package(PkgConfig REQUIRED) @@ -33,4 +35,4 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") target_link_directories(${EXE_NAME} PRIVATE ${FFMPEG_LIBRARY_DIRS}) target_link_libraries(${EXE_NAME} PRIVATE ${FFMPEG_LIBRARIES}) -endif() \ No newline at end of file +endif() diff --git a/src/main.cpp b/src/main.cpp index 739b78b..ac0212d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,8 @@ bool checkADB() { QProcess process; + QString trueADBPath; + if (QSysInfo::productType() == "windows") { process.start("where", {"adb"}); } else { @@ -29,15 +31,19 @@ bool checkADB() { } process.waitForFinished(); QString output = process.readAll().simplified(); - - if (!output.isEmpty() && QFile::exists(output)) { - qInfo() << "find adb: " << output; - qputenv("QTSCRCPY_ADB_PATH", output.toLocal8Bit()); + if (!output.isEmpty() && QFile::exists(output)) { + trueADBPath = output; + } else { + trueADBPath = ADB_PATH; + } + if (!trueADBPath.isEmpty()) { + qInfo() << "find adb: " << trueADBPath; + qputenv("QTSCRCPY_ADB_PATH", trueADBPath.toLocal8Bit()); return true; } - + qWarning() << "can not fount adb!"; return false; }