From bf976f04c7ffe4907e736190ed2a99d4b45eca39 Mon Sep 17 00:00:00 2001 From: slava Date: Sat, 26 Apr 2025 10:13:36 +0700 Subject: [PATCH] Refactor CMakeLists to conditionally include SCRCPY for macOS. Moved the inclusion of SCRCPY and executable definition to within the APPLE conditional block. This ensures platform-specific sources are handled appropriately, improving configurability and avoiding redundancy. --- CMakeLists.txt | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c6cf82..08769cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,12 +22,9 @@ elseif (APPLE) set(CMAKE_CXX_STANDARD 17) # или 20, если нужно set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ObjC++") + set(SCRCPY ${CMAKE_CURRENT_SOURCE_DIR}/views/scrcpy/ScrcpyWindow_mac.mm) endif () -set(SCRCPY - ${CMAKE_CURRENT_SOURCE_DIR}/views/scrcpy/ScrcpyWindow_mac.mm -) - find_package(Qt6 REQUIRED COMPONENTS Widgets Sql @@ -53,16 +50,15 @@ file(GLOB_RECURSE MODELS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/models/*.h" ) -add_executable(ARCDesktopProject - main.cpp - ${VIEW_SOURCES} - ${SERVICES_SOURCES} - ${DB_SOURCES} - ${MODELS_SOURCES} - ${SCRCPY} -) - if (WIN32) + add_executable(ARCDesktopProject + main.cpp + ${VIEW_SOURCES} + ${SERVICES_SOURCES} + ${DB_SOURCES} + ${MODELS_SOURCES} + ) + target_link_libraries(ARCDesktopProject Qt6::Widgets Qt6::Sql @@ -75,6 +71,15 @@ if (WIN32) file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/rus.traineddata" DESTINATION "${CMAKE_BINARY_DIR}") elseif (APPLE) + add_executable(ARCDesktopProject + main.cpp + ${VIEW_SOURCES} + ${SERVICES_SOURCES} + ${DB_SOURCES} + ${MODELS_SOURCES} + ${SCRCPY} + ) + target_link_libraries(ARCDesktopProject Qt6::Widgets Qt6::Sql