91 lines
2.0 KiB
CMake
91 lines
2.0 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
project(touchsensor VERSION 2.0.0 LANGUAGES CXX)
|
|
|
|
set(BUILD_EXAMPLE ON)
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
add_compile_options(-Os -O3)
|
|
|
|
set(QT_VERSION Qt6)
|
|
find_package(${QT_VERSION} REQUIRED COMPONENTS Widgets Network PrintSupport)
|
|
find_package(Eigen3 REQUIRED)
|
|
|
|
# For #include "..."
|
|
include_directories(.)
|
|
|
|
# 库文件收集
|
|
file(
|
|
GLOB_RECURSE PROJECT_SOURCE
|
|
CONFIGURE_DEPENDS
|
|
# Project source
|
|
"modern-qt/*.cc"
|
|
# Custom signals
|
|
"modern-qt/widget/sliders.hh"
|
|
)
|
|
add_library(
|
|
modern-qt SHARED
|
|
${PROJECT_SOURCE}
|
|
modern-qt/widget/select.hh
|
|
modern-qt/widget/select.impl.hh
|
|
)
|
|
target_link_libraries(
|
|
modern-qt PUBLIC
|
|
${QT_VERSION}::Widgets
|
|
${QT_VERSION}::Network
|
|
)
|
|
|
|
file(
|
|
GLOB_RECURSE WIDGETS_CC
|
|
CONFIGURE_DEPENDS "components/*.cc"
|
|
)
|
|
|
|
file(
|
|
GLOB_RECURSE QCUSTOMPLOT_SOURCE
|
|
CONFIGURE_DEPENDS
|
|
"qcustomplot/*.cpp"
|
|
"qcustomplot/*.h"
|
|
)
|
|
add_library(
|
|
qcustomplot SHARED
|
|
${QCUSTOMPLOT_SOURCE}
|
|
)
|
|
target_link_libraries(
|
|
qcustomplot PUBLIC
|
|
${QT_VERSION}::Core
|
|
${QT_VERSION}::Gui
|
|
${QT_VERSION}::PrintSupport
|
|
)
|
|
|
|
qt_standard_project_setup()
|
|
add_executable(
|
|
${PROJECT_NAME}
|
|
${WIDGETS_CC}
|
|
main.cc
|
|
component.hh
|
|
resources.qrc
|
|
components/view.cc
|
|
modern-qt/widget/select.cc
|
|
components/charts/heatmap.cc
|
|
components/charts/heatmap.hh
|
|
components/charts/heatmap.impl.hh
|
|
)
|
|
qt6_add_resources(QRC_FILES resources.qrc)
|
|
target_sources(${PROJECT_NAME} PRIVATE ${QRC_FILES})
|
|
#qt_add_resources(QRC_FILES resources.qrc)
|
|
#qt_add_resources(${PROJECT_NAME} ${QRC_FILES} resources.qrc)
|
|
#target_sources(${PROJECT_NAME} PRIVATE ${QRC_FILES})
|
|
target_link_libraries(
|
|
${PROJECT_NAME}
|
|
${QT_VERSION}::Widgets
|
|
${QT_VERSION}::Network
|
|
modern-qt
|
|
qcustomplot
|
|
)
|