geopro/cmake/qwt.cmake

30 lines
1.7 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 定义 qwt 静态库目标Qwt 6.2 二维科学图表:数据集详情散点/等值线图)。
#
# 为何不用 Qwt 原生 qmake本机 VS2026 预览版缺 vswhereqmake 探测 cl 失败。
# 为何不用 vcpkg 的 qwt其端口依赖 vcpkg-qtbase会与官方 Qt 形成双 Qt 冲突(项目铁律:
# 依赖 Qt 的组件不走 vcpkg。故此处用 CMake 直接编 Qwt 源码,对接官方 Qt6同 VTK 思路)。
#
# 源码目录 external/qwt-src已 gitignore按 docs/ENV_SETUP 拉取):
# git clone --depth 1 https://github.com/opencor/qwt external/qwt-src # Qwt 6.2.0 镜像
# 由根 CMakeLists 在源码存在时 include 本文件。
set(QWT_SRC_DIR "${CMAKE_SOURCE_DIR}/external/qwt-src/src")
find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent PrintSupport Svg)
file(GLOB _qwt_sources CONFIGURE_DEPENDS "${QWT_SRC_DIR}/*.cpp")
file(GLOB _qwt_headers CONFIGURE_DEPENDS "${QWT_SRC_DIR}/*.h")
# 排除OpenGL 画布 / SVG plot item / QwtPolar 部件(避免额外模块依赖与面积)。
# 保留 qwt_symbol.cpp用 QSvgRenderer故链 Qt6::Svg与 qwt_point_polar.cpp几何工具
list(FILTER _qwt_sources EXCLUDE REGEX "qwt_plot_glcanvas|qwt_plot_opengl_canvas|qwt_plot_svgitem|qwt_polar_")
list(FILTER _qwt_headers EXCLUDE REGEX "qwt_plot_glcanvas|qwt_plot_opengl_canvas|qwt_plot_svgitem|qwt_polar_")
add_library(qwt STATIC ${_qwt_sources} ${_qwt_headers})
set_target_properties(qwt PROPERTIES AUTOMOC ON)
target_include_directories(qwt PUBLIC "${QWT_SRC_DIR}")
target_link_libraries(qwt PUBLIC Qt6::Widgets Qt6::Concurrent Qt6::PrintSupport Qt6::Svg)
target_compile_features(qwt PUBLIC cxx_std_17)
if(MSVC)
target_compile_options(qwt PRIVATE /bigobj /EHsc /wd4244 /wd4267 /wd4305 /wd4456)
endif()