2023-02-02 14:47:56 +08:00
|
|
|
cmake_minimum_required(VERSION 3.22)
|
2023-01-31 22:17:32 +08:00
|
|
|
|
2023-02-16 23:16:50 +08:00
|
|
|
project(Notepad-- VERSION 1.22.0)
|
2023-01-31 22:17:32 +08:00
|
|
|
|
2023-02-13 00:43:56 +08:00
|
|
|
# -------------- Notepad -- 全局构建配置 ------------- #
|
|
|
|
option(USE_QT6 "使用 Qt6 进行编译本项目与随带所有内容" OFF)
|
|
|
|
|
2023-02-05 13:00:22 +08:00
|
|
|
include(cmake/SparkEnvConfig.cmake)
|
|
|
|
include(cmake/SparkMacrosConfig.cmake)
|
2023-02-13 00:43:56 +08:00
|
|
|
if(USE_QT6)
|
|
|
|
include(cmake/SparkFindQt6Config.cmake)
|
|
|
|
else()
|
|
|
|
include(cmake/SparkFindQt5Config.cmake)
|
|
|
|
endif(USE_QT6)
|
2023-02-05 13:00:22 +08:00
|
|
|
include(cmake/SparkMacrosExtendConfig.cmake)
|
2023-01-31 22:17:32 +08:00
|
|
|
|
2023-02-13 14:16:33 +08:00
|
|
|
|
|
|
|
# ----------------- 构建之前 全局定义 ----------------- #
|
|
|
|
# 在 Windows 中开启 UNICODE 以支持 TCHAR 功能
|
|
|
|
if(WIN32)
|
2023-02-14 13:36:44 +08:00
|
|
|
add_compile_definitions(_UNICODE= UNICODE=)
|
2023-02-13 14:16:33 +08:00
|
|
|
endif()
|
|
|
|
|
2023-02-22 11:41:13 +08:00
|
|
|
# ----------------- 构建 QSci 库 ----------------- #
|
2023-02-05 13:00:22 +08:00
|
|
|
if(TRUE)
|
2023-02-14 13:40:49 +08:00
|
|
|
include(cmake/modules/QScint.cmake)
|
2023-02-05 13:00:22 +08:00
|
|
|
endif(TRUE)
|
2023-01-31 22:17:32 +08:00
|
|
|
|
2023-02-02 18:05:54 +08:00
|
|
|
|
2023-02-08 01:49:39 +08:00
|
|
|
# ----------------- 构建 Notepad-- 程序 ----------------- #
|
2023-02-05 13:00:22 +08:00
|
|
|
if(TRUE)
|
2023-02-14 13:40:49 +08:00
|
|
|
include(cmake/modules/Notepad--.cmake)
|
2023-02-05 16:58:53 +08:00
|
|
|
endif(TRUE)
|
|
|
|
|
2023-02-08 22:50:32 +08:00
|
|
|
# ----------------- Notepad-- 其它主线构建相关 ----------------- #
|
2023-02-22 11:41:13 +08:00
|
|
|
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)
|
2023-02-16 23:16:50 +08:00
|
|
|
#
|
|
|
|
option(USE_LINUX_UNIVERSAL "通用 Linux 平台构建" OFF)
|
|
|
|
option(USE_LINUX_DEBIAN "通用 Debian Linux 平台构建" OFF)
|
2023-02-17 00:45:30 +08:00
|
|
|
option(USE_LINUX_APPIMAGE "通用 Appimage Linux 平台构建" OFF)
|
2023-02-16 23:16:50 +08:00
|
|
|
#
|
|
|
|
option(USE_LINUX_UOS "独立 Linux 平台的 Uos 构建" OFF)
|
|
|
|
#
|
2023-02-22 11:41:13 +08:00
|
|
|
option(USE_MACOS_UNIVERSAL "通用 MacOS 平台构建" OFF)
|
2023-02-16 23:16:50 +08:00
|
|
|
|
2023-02-22 11:41:13 +08:00
|
|
|
# 使用 windows.cmake / linux.cmake / macos.cmake 维护构建.
|
2023-02-08 22:50:32 +08:00
|
|
|
|
2023-02-22 11:41:13 +08:00
|
|
|
# 在 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)
|
2023-02-16 23:16:50 +08:00
|
|
|
|
|
|
|
# 在 Linux 中此处将由通用构建、Debian 打包构建、Appimage 打包构建、Uos 打包构建组成
|
2023-02-08 22:50:32 +08:00
|
|
|
elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID)
|
2023-02-16 23:16:50 +08:00
|
|
|
|
|
|
|
# 通用 Linux 平台构建,一切的起始
|
|
|
|
if(USE_LINUX_UNIVERSAL)
|
2023-02-16 23:41:58 +08:00
|
|
|
include(cmake/platforms/linux-universal.cmake)
|
2023-02-16 23:16:50 +08:00
|
|
|
|
2023-02-16 23:41:58 +08:00
|
|
|
# 通用 Linux 平台的 Debian deb 构建
|
2023-02-16 23:16:50 +08:00
|
|
|
if(USE_LINUX_DEBIAN)
|
2023-02-17 00:09:34 +08:00
|
|
|
include(cmake/platforms/linux-debian.cmake)
|
2023-02-16 23:16:50 +08:00
|
|
|
endif()
|
|
|
|
|
2023-02-16 23:41:58 +08:00
|
|
|
# 通用 Linux 平台的 Appimage 构建
|
2023-02-17 00:45:30 +08:00
|
|
|
if(USE_LINUX_APPIMAGE)
|
|
|
|
include(cmake/platforms/linux-appimage.cmake)
|
2023-02-16 23:16:50 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# 独立 Linux 平台的 Uos 构建
|
|
|
|
elseif(USE_LINUX_UOS)
|
2023-02-17 02:00:13 +08:00
|
|
|
include(cmake/platforms/linux-uos.cmake)
|
2023-02-16 23:16:50 +08:00
|
|
|
|
|
|
|
# 其它 Linux 平台的构建
|
|
|
|
else()
|
2023-02-22 11:41:13 +08:00
|
|
|
# include(cmake/platforms/linux-other.cmake)
|
2023-02-16 23:16:50 +08:00
|
|
|
endif(USE_LINUX_UNIVERSAL)
|
|
|
|
|
2023-02-22 11:41:13 +08:00
|
|
|
# 通用 MacOS 平台的构建(一个无具体实现的空构建)
|
|
|
|
elseif(APPLE)
|
2023-02-16 23:16:50 +08:00
|
|
|
|
2023-02-22 11:41:13 +08:00
|
|
|
# include(cmake/platforms/macos.cmake)
|
2023-02-08 22:50:32 +08:00
|
|
|
endif()
|
2023-02-16 23:16:50 +08:00
|
|
|
|
|
|
|
# ----------------- Notepad-- 其它主线构建相关 ----------------- #
|
|
|
|
|
2023-03-01 02:53:30 +08:00
|
|
|
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)
|