mirror of https://gitee.com/cxasm/notepad--.git
148 lines
5.1 KiB
CMake
148 lines
5.1 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
||
|
||
include(cmake/SparkWithGit.cmake)
|
||
|
||
spark_include(SparkCMakeInfoBeforeConfig.cmake)
|
||
project(Notepad-- VERSION 2.0.0)
|
||
spark_include(SparkCMakeInfoAfterConfig.cmake)
|
||
|
||
# -------------- Notepad -- 全局构建配置 ------------- #
|
||
option(USE_QT6 "使用 Qt6 进行编译本项目与随带所有内容" OFF)
|
||
|
||
spark_include(cmake/SparkEnvConfig.cmake)
|
||
spark_include(cmake/SparkMacrosConfig.cmake)
|
||
if(USE_QT6)
|
||
include(cmake/SparkFindQt6Config.cmake)
|
||
else()
|
||
include(cmake/SparkFindQt5Config.cmake)
|
||
endif(USE_QT6)
|
||
spark_include(SparkMacrosExtendConfig.cmake)
|
||
include(cmake/SparkCMakeDebugConfig.cmake)
|
||
|
||
# 引用构建起始
|
||
set(SPARK_FRAMEWORK_STORE "${CMAKE_SOURCE_DIR}/3rd_plugins_cache")
|
||
spark_include(SparkFramework.cmake)
|
||
|
||
# ----------------- 构建之前 全局定义 ----------------- #
|
||
# 在 Windows 中开启 UNICODE 以支持 TCHAR 功能
|
||
if(WIN32)
|
||
add_compile_definitions(_UNICODE= UNICODE=)
|
||
# TODO: move to cmake/platforms/windows-msvc.cmake
|
||
if(MSVC)
|
||
# MSVC 编译器处理方案,支持 utf-8 编码的项目,同时为扩展的插件提供能力
|
||
add_compile_options(/utf-8)
|
||
endif(MSVC)
|
||
endif()
|
||
# 符合 2.0.0 代码预期的版本处理, 核心编辑器组件 2.11
|
||
add_compile_definitions(TEST_PRE)
|
||
|
||
# ----------------- 构建 QSci 库 ----------------- #
|
||
if(TRUE)
|
||
include(cmake/modules/QScint.cmake)
|
||
endif(TRUE)
|
||
|
||
|
||
# ----------------- 构建 Notepad-- 程序 ----------------- #
|
||
if(TRUE)
|
||
include(cmake/modules/Notepad--.cmake)
|
||
endif(TRUE)
|
||
|
||
# ----------------- 构建 Notepad-- 插件 ----------------- #
|
||
add_subdirectory(src/plugin)
|
||
|
||
# ----------------- Notepad-- 其它主线构建相关 ----------------- #
|
||
option(USE_WINDOWS_UNIVERSAL "通用 Windows 平台构建" OFF)
|
||
option(USE_WINDOWS_MINGW "通用 Windows 平台 MinGW 构建" OFF)
|
||
option(USE_WINDOWS_MSVC "通用 Windows 平台 MSVC 构建" OFF)
|
||
#
|
||
option(WINDOWS_DEPLOY_QT "通用 Windows 平台 Qt 部署" OFF)
|
||
option(WINDOWS_DEPLOY_QT5 "通用 Windows 平台指定 Qt5 部署 windeployqt" OFF)
|
||
option(WINDOWS_DEPLOY_QT6 "通用 Windows 平台指定 Qt6 部署 windeployqt" OFF)
|
||
#
|
||
option(USE_LINUX_UNIVERSAL "通用 Linux 平台构建" OFF)
|
||
option(USE_LINUX_DEBIAN "通用 Debian Linux 平台构建" OFF)
|
||
option(USE_LINUX_APPIMAGE "通用 Appimage Linux 平台构建" OFF)
|
||
option(USE_LINUX_UOS "独立 Linux 平台的 Uos 构建" OFF)
|
||
#
|
||
option(USE_MACOSX_UNIVERSAL "通用 MacOSX 平台构建" OFF)
|
||
|
||
# 使用 windows.cmake / linux.cmake / macos.cmake 维护构建.
|
||
|
||
# 在 Windows 中此处将由通用构建、MinGW 构建、MSVC 构建组成
|
||
if(WIN32)
|
||
|
||
# 通用 Windows 平台构建,一切的起始
|
||
if(USE_WINDOWS_UNIVERSAL)
|
||
include(cmake/platforms/windows-universal.cmake)
|
||
|
||
# 为 Windows 中构建的应用进行 windeployqt 的配方
|
||
include(cmake/platforms/windows-deployqt.cmake)
|
||
|
||
# 通用平台的 Windows MinGW 构建
|
||
if(USE_WINDOWS_MINGW)
|
||
# include(cmake/platforms/windows-mingw.cmake)
|
||
endif()
|
||
|
||
# 通用平台的 Windows MSVC 构建
|
||
if(USE_WINDOWS_MSVC)
|
||
# include(cmake/platforms/windows-msvc.cmake)
|
||
endif()
|
||
|
||
# 其它 Windows 平台的构建
|
||
else()
|
||
# include(cmake/platforms/windows-other.cmake)
|
||
endif(USE_WINDOWS_UNIVERSAL)
|
||
|
||
# 在 Linux 中此处将由通用构建、Debian 打包构建、Appimage 打包构建、Uos 打包构建组成
|
||
elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID)
|
||
|
||
# 通用 Linux 平台构建,一切的起始
|
||
if(USE_LINUX_UNIVERSAL)
|
||
include(cmake/platforms/linux-universal.cmake)
|
||
|
||
# 通用 Linux 平台的 Debian deb 构建
|
||
if(USE_LINUX_DEBIAN)
|
||
include(cmake/platforms/linux-debian.cmake)
|
||
endif()
|
||
|
||
# 通用 Linux 平台的 Appimage 构建
|
||
if(USE_LINUX_APPIMAGE)
|
||
include(cmake/platforms/linux-appimage.cmake)
|
||
endif()
|
||
|
||
# 独立 Linux 平台的 Uos 构建
|
||
elseif(USE_LINUX_UOS)
|
||
include(cmake/platforms/linux-uos.cmake)
|
||
|
||
# 其它 Linux 平台的构建
|
||
else()
|
||
# include(cmake/platforms/linux-other.cmake)
|
||
endif(USE_LINUX_UNIVERSAL)
|
||
|
||
# 通用 MacOSX 平台的构建
|
||
elseif(APPLE)
|
||
|
||
# 通用 MacOSX 平台构建,一切的起始
|
||
if(USE_MACOSX_UNIVERSAL)
|
||
include(cmake/platforms/macos-universal.cmake)
|
||
|
||
endif(USE_MACOSX_UNIVERSAL)
|
||
|
||
endif()
|
||
|
||
# ----------------- Notepad-- 其它主线构建相关 ----------------- #
|
||
|
||
if(USE_QT6)
|
||
# Qt5/Qt6 兼容性构建检查文件检查
|
||
include(cmake/platforms/utils.cmake)
|
||
qt5_qt6_compatible_check(cmake/qt5_qt6_compatible_check QT56_PASS)
|
||
if(NOT QT56_PASS)
|
||
message(SEND_ERROR "[${QT56_PASS}] Qt5/Qt6 兼容性检查文件当前未能检查通过,不建议构建 Qt6。")
|
||
else()
|
||
message(NOTICE "[${QT56_PASS}] Qt5/Qt6 兼容性检查文件当前检查通过。")
|
||
endif(NOT QT56_PASS)
|
||
endif(USE_QT6)
|
||
|
||
|
||
# 在全局结束位置使用 cmake-debug 目标来驱动内部调试信息打印
|
||
spark_generator_cmake_debug(cmake-debug) |