init
This commit is contained in:
109
skylink_qt_station/CMakeLists.txt
Normal file
109
skylink_qt_station/CMakeLists.txt
Normal file
@@ -0,0 +1,109 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
|
||||
project(skylink_station LANGUAGES CXX)
|
||||
|
||||
# ============================================================================
|
||||
# 编译标准和优化选项
|
||||
# ============================================================================
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(OpenCV_DIR "D:/app/opencv4_12/opencv/build/x64/vc16/lib")
|
||||
|
||||
# 如果未指定编译类型,默认为 Release
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
||||
endif()
|
||||
|
||||
# ============================================================================
|
||||
# 查找依赖
|
||||
# ============================================================================
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
Widgets
|
||||
Network
|
||||
Concurrent
|
||||
)
|
||||
|
||||
find_package(OpenCV REQUIRED COMPONENTS core imgproc)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# ============================================================================
|
||||
# 包含目录
|
||||
# ============================================================================
|
||||
|
||||
include_directories(
|
||||
src
|
||||
${CMAKE_SOURCE_DIR}/../protocol # 公共协议定义
|
||||
)
|
||||
|
||||
# ============================================================================
|
||||
# 源文件列表
|
||||
# ============================================================================
|
||||
|
||||
set(SOURCES
|
||||
src/main.cpp
|
||||
src/MainWindow.cpp
|
||||
src/GroundReceiver.cpp
|
||||
src/DataLogger.cpp
|
||||
)
|
||||
|
||||
set(HEADERS
|
||||
src/MainWindow.h
|
||||
src/GroundReceiver.h
|
||||
src/DataLogger.h
|
||||
)
|
||||
|
||||
set(UI_FILES
|
||||
forms/MainWindow.ui
|
||||
)
|
||||
|
||||
set(RESOURCES
|
||||
resources.qrc
|
||||
)
|
||||
|
||||
# ============================================================================
|
||||
# 创建可执行文件
|
||||
# ============================================================================
|
||||
|
||||
add_executable(skylink_station
|
||||
${SOURCES}
|
||||
${HEADERS}
|
||||
${UI_FILES}
|
||||
${RESOURCES}
|
||||
)
|
||||
|
||||
# ============================================================================
|
||||
# 链接库
|
||||
# ============================================================================
|
||||
|
||||
target_link_libraries(skylink_station
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::Widgets
|
||||
Qt6::Network
|
||||
Qt6::Concurrent
|
||||
${OpenCV_LIBRARIES}
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
# ============================================================================
|
||||
# 编译选项
|
||||
# ============================================================================
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(skylink_station PRIVATE /W4)
|
||||
else()
|
||||
target_compile_options(skylink_station PRIVATE -Wall -Wextra -Wpedantic)
|
||||
endif()
|
||||
|
||||
# ============================================================================
|
||||
# 安装规则
|
||||
# ============================================================================
|
||||
|
||||
install(TARGETS skylink_station DESTINATION bin)
|
||||
Reference in New Issue
Block a user