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.
This commit is contained in:
parent
d52574c50f
commit
bf976f04c7
@ -22,12 +22,9 @@ elseif (APPLE)
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17) # или 20, если нужно
|
set(CMAKE_CXX_STANDARD 17) # или 20, если нужно
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ObjC++")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ObjC++")
|
||||||
|
set(SCRCPY ${CMAKE_CURRENT_SOURCE_DIR}/views/scrcpy/ScrcpyWindow_mac.mm)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(SCRCPY
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/views/scrcpy/ScrcpyWindow_mac.mm
|
|
||||||
)
|
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS
|
find_package(Qt6 REQUIRED COMPONENTS
|
||||||
Widgets
|
Widgets
|
||||||
Sql
|
Sql
|
||||||
@ -53,16 +50,15 @@ file(GLOB_RECURSE MODELS_SOURCES
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/models/*.h"
|
"${CMAKE_CURRENT_SOURCE_DIR}/models/*.h"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
add_executable(ARCDesktopProject
|
add_executable(ARCDesktopProject
|
||||||
main.cpp
|
main.cpp
|
||||||
${VIEW_SOURCES}
|
${VIEW_SOURCES}
|
||||||
${SERVICES_SOURCES}
|
${SERVICES_SOURCES}
|
||||||
${DB_SOURCES}
|
${DB_SOURCES}
|
||||||
${MODELS_SOURCES}
|
${MODELS_SOURCES}
|
||||||
${SCRCPY}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
target_link_libraries(ARCDesktopProject
|
target_link_libraries(ARCDesktopProject
|
||||||
Qt6::Widgets
|
Qt6::Widgets
|
||||||
Qt6::Sql
|
Qt6::Sql
|
||||||
@ -75,6 +71,15 @@ if (WIN32)
|
|||||||
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/rus.traineddata" DESTINATION "${CMAKE_BINARY_DIR}")
|
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/rus.traineddata" DESTINATION "${CMAKE_BINARY_DIR}")
|
||||||
|
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
|
add_executable(ARCDesktopProject
|
||||||
|
main.cpp
|
||||||
|
${VIEW_SOURCES}
|
||||||
|
${SERVICES_SOURCES}
|
||||||
|
${DB_SOURCES}
|
||||||
|
${MODELS_SOURCES}
|
||||||
|
${SCRCPY}
|
||||||
|
)
|
||||||
|
|
||||||
target_link_libraries(ARCDesktopProject
|
target_link_libraries(ARCDesktopProject
|
||||||
Qt6::Widgets
|
Qt6::Widgets
|
||||||
Qt6::Sql
|
Qt6::Sql
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user