PowerDesigner/CMakeLists.txt

135 lines
3.9 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.

cmake_minimum_required(VERSION 3.5)
project(PowerDesigner 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)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#默认ui文件要和.h头文件在一个目录若不在一个目录需要指定其所在目录
set(CMAKE_AUTOUIC_SEARCH_PATHS "ui")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
set(pd_PlatformDir "x86")
else()
if(DEFINED CMAKE_SYSTEM_PROCESSOR)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
set(pd_PlatformDir "x64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
set(pd_PlatformDir "aarch64")
else()
set(pd_PlatformDir "x64")
endif()
else()
set(pd_PlatformDir "x64")
endif()
endif()
set(H_HEADER_FILES
include/global.h
include/mainwindow.h
include/graphicElementsPanel.h
include/drawingPanel.h
include/designerScene.h
include/designerView.h
include/operationCommand.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/selectorManager.h
include/graphicsItem/itemControlHandle.h
include/graphicsItem/graphicsBaseItem.h
include/graphicsItem/graphicsRectItem.h
include/graphicsItem/graphicsPolygonItem.h
)
set(CPP_SOURCE_FILES
source/main.cpp
source/mainwindow.cpp
source/graphicElementsPanel.cpp
source/drawingPanel.cpp
source/designerScene.cpp
source/designerView.cpp
source/operationCommand.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/selectorManager.cpp
source/graphicsItem/itemControlHandle.cpp
source/graphicsItem/graphicsBaseItem.cpp
source/graphicsItem/graphicsRectItem.cpp
source/graphicsItem/graphicsPolygonItem.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(PowerDesigner
MANUAL_FINALIZATION
${H_HEADER_FILES}
${CPP_SOURCE_FILES}
${UI_FILES}
resource/PowerDesigner.qrc
)
else()
if(ANDROID)
add_library(PowerDesigner SHARED
${H_HEADER_FILES}
${CPP_SOURCE_FILES}
${UI_FILES}
resource/PowerDesigner.qrc
)
else()
add_executable(PowerDesigner WIN32
${H_HEADER_FILES}
${CPP_SOURCE_FILES}
${UI_FILES}
resource/PowerDesigner.qrc
)
endif()
endif()
include_directories(include)
target_include_directories(PowerDesigner PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(PowerDesigner PRIVATE qt${QT_VERSION_MAJOR}advanceddocking)
target_link_libraries(PowerDesigner PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)
set_target_properties(PowerDesigner PROPERTIES
AUTOMOC ON
AUTORCC ON
AUTOUIC ON
CXX_STANDARD 14
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
VERSION 1.0
EXPORT_NAME "PowerDesigner with Qt Advanced Docking System"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${pd_PlatformDir}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${pd_PlatformDir}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${pd_PlatformDir}/bin"
)