208 lines
6.4 KiB
CMake
208 lines
6.4 KiB
CMake
|
|
cmake_minimum_required(VERSION 3.5)
|
||
|
|
|
||
|
|
project(DiagramDesigner LANGUAGES CXX VERSION 1.0)
|
||
|
|
|
||
|
|
set(CMAKE_AUTOUIC ON)
|
||
|
|
set(CMAKE_AUTOMOC ON)
|
||
|
|
set(CMAKE_AUTORCC ON)
|
||
|
|
|
||
|
|
#set(ADS_VERSION 4.3.1)
|
||
|
|
#add_subdirectory(QtADS)
|
||
|
|
|
||
|
|
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||
|
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets REQUIRED)
|
||
|
|
find_package(Qt6 REQUIRED COMPONENTS SvgWidgets)
|
||
|
|
|
||
|
|
|
||
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||
|
|
# 默认 ui 文件要和 .h 头文件在一个目录,若不在一个目录,需要指定其所在目录
|
||
|
|
set(CMAKE_AUTOUIC_SEARCH_PATHS "ui")
|
||
|
|
|
||
|
|
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
||
|
|
set(dd_PlatformDir "x86")
|
||
|
|
else()
|
||
|
|
if(DEFINED CMAKE_SYSTEM_PROCESSOR)
|
||
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
|
||
|
|
set(dd_PlatformDir "x64")
|
||
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
|
||
|
|
set(dd_PlatformDir "aarch64")
|
||
|
|
else()
|
||
|
|
set(dd_PlatformDir "x64")
|
||
|
|
endif()
|
||
|
|
else()
|
||
|
|
set(dd_PlatformDir "x64")
|
||
|
|
endif()
|
||
|
|
endif()
|
||
|
|
|
||
|
|
set(H_HEADER_FILES
|
||
|
|
include/global.h
|
||
|
|
include/mainwindow.h
|
||
|
|
include/graphicElementsPanel.h
|
||
|
|
include/electricElementsPanel.h
|
||
|
|
include/electricElementsBox.h
|
||
|
|
include/electricElementsListwidget.h
|
||
|
|
include/drawingPanel.h
|
||
|
|
include/diagramCavas.h
|
||
|
|
include/designerScene.h
|
||
|
|
include/designerView.h
|
||
|
|
include/operationCommand.h
|
||
|
|
include/toolPage.h
|
||
|
|
include/toolBox.h
|
||
|
|
|
||
|
|
include/util/baseSelector.h
|
||
|
|
include/util/creatingSelector.h
|
||
|
|
include/util/movingSelector.h
|
||
|
|
include/util/rotationSelector.h
|
||
|
|
include/util/scalingSelector.h
|
||
|
|
include/util/editingSelector.h
|
||
|
|
include/util/connectingSelector.h
|
||
|
|
include/util/selectorManager.h
|
||
|
|
|
||
|
|
include/graphicsItem/itemControlHandle.h
|
||
|
|
include/graphicsItem/graphicsBaseItem.h
|
||
|
|
include/graphicsItem/graphicsRectItem.h
|
||
|
|
include/graphicsItem/graphicsPolygonItem.h
|
||
|
|
include/graphicsItem/graphicsItemGroup.h
|
||
|
|
include/graphicsItem/electricSvgItem.h
|
||
|
|
include/graphicsItem/electricSvgItemBus.h
|
||
|
|
include/graphicsItem/electricSvgItemRect.h
|
||
|
|
include/graphicsItem/electricSvgItemTriangle.h
|
||
|
|
include/abstractGraphModel.h
|
||
|
|
include/connectionIdUtils.h
|
||
|
|
include/serializable.h
|
||
|
|
include/dataFlowGraphModel.h
|
||
|
|
include/nodeData.h
|
||
|
|
include/nodeDelegateModel.h
|
||
|
|
include/nodeDelegateModelRegistry.h
|
||
|
|
include/style.h
|
||
|
|
include/nodeStyle.h
|
||
|
|
include/connectionStyle.h
|
||
|
|
include/graphicsViewStyle.h
|
||
|
|
include/styleCollection.h
|
||
|
|
include/abstractNodeGeometry.h
|
||
|
|
include/basicGraphicsScene.h
|
||
|
|
include/connectionState.h
|
||
|
|
include/connectionGraphicsObject.h
|
||
|
|
include/nodeGraphicsObject.h
|
||
|
|
include/nodeState.h
|
||
|
|
include/connectionPainter.h
|
||
|
|
include/nodeConnectionInteraction.h
|
||
|
|
include/undoCommands.h
|
||
|
|
include/locateNode.h
|
||
|
|
include/defaultNodePainter.h
|
||
|
|
include/abstractNodePainter.h
|
||
|
|
include/defaultHorizontalNodeGeometry.h
|
||
|
|
include/defaultVerticalNodeGeometry.h
|
||
|
|
)
|
||
|
|
set(CPP_SOURCE_FILES
|
||
|
|
source/main.cpp
|
||
|
|
source/mainwindow.cpp
|
||
|
|
source/graphicElementsPanel.cpp
|
||
|
|
source/electricElementsPanel.cpp
|
||
|
|
source/electricElementsBox.cpp
|
||
|
|
source/electricElementsListwidget.cpp
|
||
|
|
source/drawingPanel.cpp
|
||
|
|
source/diagramCavas.cpp
|
||
|
|
source/designerScene.cpp
|
||
|
|
source/designerView.cpp
|
||
|
|
source/operationCommand.cpp
|
||
|
|
source/toolPage.cpp
|
||
|
|
source/toolBox.cpp
|
||
|
|
|
||
|
|
source/util/baseSelector.cpp
|
||
|
|
source/util/creatingSelector.cpp
|
||
|
|
source/util/movingSelector.cpp
|
||
|
|
source/util/rotationSelector.cpp
|
||
|
|
source/util/scalingSelector.cpp
|
||
|
|
source/util/editingSelector.cpp
|
||
|
|
source/util/connectingSelector.cpp
|
||
|
|
source/util/selectorManager.cpp
|
||
|
|
|
||
|
|
source/graphicsItem/itemControlHandle.cpp
|
||
|
|
source/graphicsItem/graphicsBaseItem.cpp
|
||
|
|
source/graphicsItem/graphicsRectItem.cpp
|
||
|
|
source/graphicsItem/graphicsPolygonItem.cpp
|
||
|
|
source/graphicsItem/graphicsItemGroup.cpp
|
||
|
|
source/graphicsItem/electricSvgItem.cpp
|
||
|
|
source/graphicsItem/electricSvgItemBus.cpp
|
||
|
|
source/graphicsItem/electricSvgItemRect.cpp
|
||
|
|
source/graphicsItem/electricSvgItemTriangle.cpp
|
||
|
|
source/abstractGraphModel.cpp
|
||
|
|
source/dataFlowGraphModel.cpp
|
||
|
|
source/nodeDelegateModel.cpp
|
||
|
|
source/nodeDelegateModelRegistry.cpp
|
||
|
|
source/nodeStyle.cpp
|
||
|
|
source/styleCollection.cpp
|
||
|
|
source/connectionStyle.cpp
|
||
|
|
source/graphicsViewStyle.cpp
|
||
|
|
source/abstractNodeGeometry.cpp
|
||
|
|
source/basicGraphicsScene.cpp
|
||
|
|
source/connectionState.cpp
|
||
|
|
source/nodeState.cpp
|
||
|
|
source/connectionPainter.cpp
|
||
|
|
source/nodeConnectionInteraction.cpp
|
||
|
|
source/undoCommands.cpp
|
||
|
|
source/locateNode.cpp
|
||
|
|
source/connectionGraphicsObject.cpp
|
||
|
|
source/defaultVerticalNodeGeometry.cpp
|
||
|
|
source/defaultHorizontalNodeGeometry.cpp
|
||
|
|
source/nodeGraphicsObject.cpp
|
||
|
|
)
|
||
|
|
set(UI_FILES
|
||
|
|
ui/mainwindow.ui
|
||
|
|
ui/graphicElementsPanel.ui
|
||
|
|
ui/drawingPanel.ui
|
||
|
|
)
|
||
|
|
|
||
|
|
# 包含源文件目录
|
||
|
|
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
|
||
|
|
|
||
|
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||
|
|
qt_add_executable(DiagramDesigner
|
||
|
|
MANUAL_FINALIZATION
|
||
|
|
${H_HEADER_FILES}
|
||
|
|
${CPP_SOURCE_FILES}
|
||
|
|
${UI_FILES}
|
||
|
|
resource/DiagramDesigner.qrc
|
||
|
|
)
|
||
|
|
else()
|
||
|
|
if(ANDROID)
|
||
|
|
add_library(DiagramDesigner SHARED
|
||
|
|
${H_HEADER_FILES}
|
||
|
|
${CPP_SOURCE_FILES}
|
||
|
|
${UI_FILES}
|
||
|
|
resource/DiagramDesigner.qrc
|
||
|
|
)
|
||
|
|
else()
|
||
|
|
add_executable(DiagramDesigner WIN32
|
||
|
|
${H_HEADER_FILES}
|
||
|
|
${CPP_SOURCE_FILES}
|
||
|
|
${UI_FILES}
|
||
|
|
resource/DiagramDesigner.qrc
|
||
|
|
)
|
||
|
|
endif()
|
||
|
|
endif()
|
||
|
|
|
||
|
|
include_directories(include)
|
||
|
|
|
||
|
|
target_include_directories(DiagramDesigner PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||
|
|
#target_link_libraries(DiagramDesigner PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
|
||
|
|
target_link_libraries(DiagramDesigner PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||
|
|
Qt${QT_VERSION_MAJOR}::Gui
|
||
|
|
Qt${QT_VERSION_MAJOR}::Widgets)
|
||
|
|
target_link_libraries(DiagramDesigner PRIVATE Qt6::SvgWidgets)
|
||
|
|
set_target_properties(DiagramDesigner PROPERTIES
|
||
|
|
AUTOMOC ON
|
||
|
|
AUTORCC ON
|
||
|
|
AUTOUIC ON
|
||
|
|
CXX_STANDARD 14
|
||
|
|
CXX_STANDARD_REQUIRED ON
|
||
|
|
CXX_EXTENSIONS OFF
|
||
|
|
VERSION 1.0
|
||
|
|
EXPORT_NAME "DiagramDesigner with Qt Advanced Docking System"
|
||
|
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${dd_PlatformDir}/lib"
|
||
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${dd_PlatformDir}/lib"
|
||
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${dd_PlatformDir}/bin"
|
||
|
|
)
|
||
|
|
|