From a6098eb06171b682f5f19f7576aac97125ac4d99 Mon Sep 17 00:00:00 2001 From: Yufan You Date: Tue, 13 Feb 2024 21:10:33 +0800 Subject: [PATCH 1/2] feat(installation/build-from-source): add ECM and KSH, update commands --- .../installation/build-from-source/_index.md | 49 ++++++++++++------- .../build-from-source/_index.zh.md | 47 +++++++++++------- 2 files changed, 62 insertions(+), 34 deletions(-) diff --git a/content/docs/installation/build-from-source/_index.md b/content/docs/installation/build-from-source/_index.md index 4af61e97c..426fc5bab 100644 --- a/content/docs/installation/build-from-source/_index.md +++ b/content/docs/installation/build-from-source/_index.md @@ -5,40 +5,55 @@ weight: 20 description: In this way, you can get the latest unreleased features and get ready for contributing. It needs more steps but is the only choice if your OS is not officially supported. --- +### Preparation + 1. Clone this repo and submodules: ```sh git clone --recurse-submodules https://github.com/cpeditor/cpeditor.git + # or alternatively in two separate commands + # git clone https://github.com/cpeditor/cpeditor.git + # git submodule update --init --recursive cd cpeditor ``` -2. Install [Qt](https://www.qt.io/download) (5.15 or higher), [CMake](https://cmake.org/download/) (3.12 or higher) and [Python3](https://www.python.org/downloads/). - - On some Linux distributions and macOS, you can install from your package manager. For example, `sudo pacman -S qt5` on Arch Linux, `brew install qt5` on macOS. +2. Install [Qt](https://www.qt.io/download) (5.15), [CMake](https://cmake.org/download/) (3.12 or higher) and [Python3](https://www.python.org/downloads/). + + - On some Linux distributions and macOS, you can install from your package manager. For example, `sudo pacman -S qt5-base` on Arch Linux, `brew install qt@5` on macOS. - You can also use [aqtinstall](https://github.com/miurahr/aqtinstall) to install Qt. -3. If CMake can't find the Qt installation path, you should set the environment variable: `CMAKE_PREFIX_PATH=%QtPath%/%QtVersion%/%Compiler%/lib/cmake`. For example, on macOS, you can run something like `export CMAKE_PREFIX_PATH="/usr/local/Cellar/qt/5.15.1"`. +3. If CMake can't find the Qt installation path, you should set the environment variable: `CMAKE_PREFIX_PATH=%QtPath%/%QtVersion%/%Compiler%/lib/cmake`. For example, on macOS, you can run something like `export CMAKE_PREFIX_PATH="/usr/local/Cellar/qt/5.15.2"`. + +4. Install KDE (kf5) Extra CMake Modules and Syntax Highlighting. -4. Run the following commands: + - On some Linux distributions and macOS, you can install from your package manager. For example, `sudo pacman -S extra-cmake-modules syntax-highlighting5` on Arch Linux, [Homebrew KDE](https://github.com/KDE/homebrew-kde) and then `brew install extra-cmake-modules kde-mac/kde/kf5-syntax-highlighting` on macOS. - - Linux/macOS: + - Otherwise, you can use CMake to build and install them: ```sh - mkdir build - cd build - cmake .. -DCMAKE_BUILD_TYPE=Release - cmake --build . + cd third_party/extra-cmake-modules # cd third_party/syntax-highlighting + cmake -B build -S . -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF -DBUILD_QTHELP_DOCS=OFF -DBUILD_TESTING=OFF + cmake --build build --config Release --target install # may require sudo ``` - - Windows: - ```bat - mkdir build - cd build - cmake .. - cmake --build . --config Release - ``` +### Build + +- Linux/macOS: + + ```sh + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release + cmake --build build + ``` + +- Windows: + + ```bat + cmake -S . -B build + cmake --build build --config Release + ``` On Linux, you will get `build/cpeditor`. On macOS, you will get `build/cpeditor.app`. -On Windows, you will get `build\cpeditor.exe`, or `build\Release\cpeditor.exe`. If DLLs are missing, you can add `%QtPath%\%QtVersion%\%Compiler%\bin` (for example, `D:\Qt\5.15.1\msvc2019_64\bin`) to the PATH environmental variable. +On Windows, you will get `build\cpeditor.exe`, or `build\Release\cpeditor.exe`. If DLLs are missing, you can add `%QtPath%\%QtVersion%\%Compiler%\bin` (for example, `D:\Qt\5.15.2\msvc2019_64\bin`) to the PATH environmental variable. diff --git a/content/docs/installation/build-from-source/_index.zh.md b/content/docs/installation/build-from-source/_index.zh.md index 60fb397e4..6b61b5e77 100644 --- a/content/docs/installation/build-from-source/_index.zh.md +++ b/content/docs/installation/build-from-source/_index.zh.md @@ -5,41 +5,54 @@ weight: 20 description: 通过这种方式,你可以使用最新的还未发布的特性,同时为参与开发做好准备。这需要更多的步骤,也是在你的操作系统不被支持时的唯一方案。 --- +### 准备工作 + 1. 克隆源代码仓库以及子组件: ```sh git clone --recurse-submodules https://github.com/cpeditor/cpeditor.git + # 或者分成两条命令 + # git clone https://github.com/cpeditor/cpeditor.git + # git submodule update --init --recursive cd cpeditor ``` -2. 安装 [Qt](https://www.qt.io/download)(5.15 或更高版本), [CMake](https://cmake.org/download/)(3.12 或更高版本)以及 [Python3](https://www.python.org/downloads/)。 - - 在一些 Linux 发行版和 macOS 系统上,你可以直接使用包管理器安装 Qt。例如,在 Arch Linux 上可以使用 `sudo pacman -S qt5-base`,在 macOS 上可以使用 `brew install qt5`。 +2. 安装 [Qt](https://www.qt.io/download)(5.15), [CMake](https://cmake.org/download/)(3.12 或更高版本)以及 [Python3](https://www.python.org/downloads/)。 + - 在一些 Linux 发行版和 macOS 系统上,你可以直接使用包管理器安装 Qt。例如,在 Arch Linux 上可以使用 `sudo pacman -S qt5-base`,在 macOS 上可以使用 `brew install qt@5`。 - 你还可以使用 [aqtinstall](https://github.com/miurahr/aqtinstall) 来下载并安装。 -3. 如果 CMake 提示找不到 Qt 路径,你应该设置环境变量:`CMAKE_PREFIX_PATH=%QtPath%/%QtVersion%/%Compiler%/lib/cmake`。例如,在 macOS 上,你可以运行 `export CMAKE_PREFIX_PATH="/usr/local/Cellar/qt/5.15.1"`。 +3. 如果 CMake 提示找不到 Qt 路径,你应该设置环境变量:`CMAKE_PREFIX_PATH=%QtPath%/%QtVersion%/%Compiler%/lib/cmake`。例如,在 macOS 上,你可以运行 `export CMAKE_PREFIX_PATH="/usr/local/Cellar/qt/5.15.2"`。 + +4. 安装 KDE (kf5) Extra CMake Modules 以及 Syntax Highlighting. -4. 执行如下命令完成构建过程。 + - 在一些 Linux 发行版和 macOS 系统上,你可以直接使用包管理器安装它们。例如,在 Arch Linux 上可以使用 `sudo pacman -S extra-cmake-modules syntax-highlighting5`,在 macOS 上可以使用 [Homebrew KDE](https://github.com/KDE/homebrew-kde) 然后 `brew install extra-cmake-modules kde-mac/kde/kf5-syntax-highlighting`。 - - Linux/macOS: + - 否则,你需要使用 CMake 构建并安装它们: ```sh - mkdir build - cd build - cmake .. -DCMAKE_BUILD_TYPE=Release - cmake --build . + cd third_party/extra-cmake-modules # cd third_party/syntax-highlighting + cmake -B build -S . -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF -DBUILD_QTHELP_DOCS=OFF -DBUILD_TESTING=OFF + cmake --build build --config Release --target install # 可能需要 sudo ``` - - Windows: +### 构建 - ```bat - mkdir build - cd build - cmake .. - cmake --build . --config Release - ``` +- Linux/macOS: + + ```sh + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release + cmake --build build + ``` + +- Windows: + + ```bat + cmake -S . -B build + cmake --build build --config Release + ``` 在 Linux 上,你会得到 `build/cpeditor`。 在 macOS 上,你会得到 `build/cpeditor.app`。 -在 Windows 上,你会得到 `build/cpeditor.exe` 或 `build/Release/cpeditor.exe`。如果打开时提示 DLL 缺失,你可以将 `%QtPath%\%QtVersion%\%Compiler%\bin`(例如:`D:\Qt\5.15.1\msvc2019_64\bin`)加入 PATH 环境变量。 +在 Windows 上,你会得到 `build/cpeditor.exe` 或 `build/Release/cpeditor.exe`。如果打开时提示 DLL 缺失,你可以将 `%QtPath%\%QtVersion%\%Compiler%\bin`(例如:`D:\Qt\5.15.2\msvc2019_64\bin`)加入 PATH 环境变量。 From 0da0ff153eb7a8baf9abc484ab473f169b7510a3 Mon Sep 17 00:00:00 2001 From: Yufan You Date: Tue, 13 Feb 2024 21:20:08 +0800 Subject: [PATCH 2/2] fix(installation/build-from-source): no need to install ECM --- content/docs/installation/build-from-source/_index.md | 11 +++++++---- .../docs/installation/build-from-source/_index.zh.md | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/content/docs/installation/build-from-source/_index.md b/content/docs/installation/build-from-source/_index.md index 426fc5bab..ca282213c 100644 --- a/content/docs/installation/build-from-source/_index.md +++ b/content/docs/installation/build-from-source/_index.md @@ -24,16 +24,19 @@ description: In this way, you can get the latest unreleased features and get rea 3. If CMake can't find the Qt installation path, you should set the environment variable: `CMAKE_PREFIX_PATH=%QtPath%/%QtVersion%/%Compiler%/lib/cmake`. For example, on macOS, you can run something like `export CMAKE_PREFIX_PATH="/usr/local/Cellar/qt/5.15.2"`. -4. Install KDE (kf5) Extra CMake Modules and Syntax Highlighting. +4. Install KDE (kf5) Syntax Highlighting. - - On some Linux distributions and macOS, you can install from your package manager. For example, `sudo pacman -S extra-cmake-modules syntax-highlighting5` on Arch Linux, [Homebrew KDE](https://github.com/KDE/homebrew-kde) and then `brew install extra-cmake-modules kde-mac/kde/kf5-syntax-highlighting` on macOS. + - On some Linux distributions and macOS, you can install from your package manager. For example, `sudo pacman -S syntax-highlighting5` on Arch Linux, [Homebrew KDE](https://github.com/KDE/homebrew-kde) and then `brew install kde-mac/kde/kf5-syntax-highlighting` on macOS. - - Otherwise, you can use CMake to build and install them: + - Otherwise, you can use CMake to build and install Extra CMake Modules first and then KSH: ```sh - cd third_party/extra-cmake-modules # cd third_party/syntax-highlighting + cd third_party/extra-cmake-modules cmake -B build -S . -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF -DBUILD_QTHELP_DOCS=OFF -DBUILD_TESTING=OFF cmake --build build --config Release --target install # may require sudo + cd ../syntax-highlighting + cmake -B build -S . -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF -DBUILD_QTHELP_DOCS=OFF -DBUILD_TESTING=OFF + cmake --build build --config Release --target install ``` ### Build diff --git a/content/docs/installation/build-from-source/_index.zh.md b/content/docs/installation/build-from-source/_index.zh.md index 6b61b5e77..dfe173de1 100644 --- a/content/docs/installation/build-from-source/_index.zh.md +++ b/content/docs/installation/build-from-source/_index.zh.md @@ -23,16 +23,19 @@ description: 通过这种方式,你可以使用最新的还未发布的特性 3. 如果 CMake 提示找不到 Qt 路径,你应该设置环境变量:`CMAKE_PREFIX_PATH=%QtPath%/%QtVersion%/%Compiler%/lib/cmake`。例如,在 macOS 上,你可以运行 `export CMAKE_PREFIX_PATH="/usr/local/Cellar/qt/5.15.2"`。 -4. 安装 KDE (kf5) Extra CMake Modules 以及 Syntax Highlighting. +4. 安装 KDE (kf5) Extra CMake Modules。 - - 在一些 Linux 发行版和 macOS 系统上,你可以直接使用包管理器安装它们。例如,在 Arch Linux 上可以使用 `sudo pacman -S extra-cmake-modules syntax-highlighting5`,在 macOS 上可以使用 [Homebrew KDE](https://github.com/KDE/homebrew-kde) 然后 `brew install extra-cmake-modules kde-mac/kde/kf5-syntax-highlighting`。 + - 在一些 Linux 发行版和 macOS 系统上,你可以直接使用包管理器安装它们。例如,在 Arch Linux 上可以使用 `sudo pacman -S syntax-highlighting5`,在 macOS 上可以使用 [Homebrew KDE](https://github.com/KDE/homebrew-kde) 然后 `brew install kde-mac/kde/kf5-syntax-highlighting`。 - - 否则,你需要使用 CMake 构建并安装它们: + - 否则,你需要使用 CMake 先构建并安装 Extra CMake Modules 然后再是 KSH: ```sh - cd third_party/extra-cmake-modules # cd third_party/syntax-highlighting + cd third_party/extra-cmake-modules cmake -B build -S . -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF -DBUILD_QTHELP_DOCS=OFF -DBUILD_TESTING=OFF cmake --build build --config Release --target install # 可能需要 sudo + cd ../syntax-highlighting + cmake -B build -S . -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF -DBUILD_QTHELP_DOCS=OFF -DBUILD_TESTING=OFF + cmake --build build --config Release --target install ``` ### 构建