2023-10-25 21:22:38 +08:00
# General Development Notes
2024-03-06 17:32:21 +08:00
Red Panda C++ need Qt 5.15 to build.
2023-10-25 21:22:38 +08:00
Recommended development environments:
1. Visual Studio Code.
* Better performance.
2. Qt Creator.
* (Almost) zero configuration.
* Built-in UI designer.
* Debugger integration with Qt.
To setup development environment in Visual Studio Code:
2024-03-04 18:39:14 +08:00
0. (Windows only) Enable Developer Mode in Windows Settings, and enable `core.symlinks` in Git (`git config core.symlinks true`).
2024-01-19 09:25:21 +08:00
1. Install [xmake ](https://xmake.io/ ) and [XMake extension ](https://marketplace.visualstudio.com/items?itemName=tboox.xmake-vscode ).
2. Install [C/C++ extension ](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools ) for language and debugging support.
3. Optionally install [clangd ](https://clangd.llvm.org/ ) and [clangd extension ](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd ) for better analysis.
4. Config workspace:
- Compile commands: `.vscode/compile_commands.json` (“C/C++: Edit Configurations (UI)” from the Command Palette);
- “Clangd: Arguments”: `--compile-commands-dir=.vscode` ;
- “Xmake: Additional Config Arguments”: `--qt=/usr` for example.
5. Run “XMake: UpdateIntellisense” (Command Palette) to generate compilation database.
\* Note: xmake was introduced for compilation database generation and feature matrix test. It is not fully functional yet.
2022-02-21 12:01:26 +08:00
# Windows
2023-08-21 10:45:09 +08:00
| Library + Toolchain \ Target | x86 | x64 | ARM64 |
| ---------------------------- | --- | --- | ----- |
| MSYS2 + GNU-based MinGW | ✔️ | ✔️ | ❌ |
| MSYS2 + LLVM-based MinGW | ✔️ | ✔️ | ✔️ |
2024-05-09 21:08:28 +08:00
| [Windows NT 5.x ](https://github.com/redpanda-cpp/qtbase-xp ) + [MinGW Lite ](https://github.com/redpanda-cpp/mingw-lite ) | ✔️ | ✔️ | ❌ |
2024-04-28 16:47:35 +08:00
See also [more build instructions for Windows ](./docs/detailed-build-win.md ).
2023-10-21 13:38:12 +08:00
2023-08-21 10:45:09 +08:00
## MSYS2 Qt Library with MinGW Toolchain (Recommended)
Red Panda C++ should work with any MinGW toolchain from MSYS2, including GCCs and Clangs in three GNU-based environments (MINGW32, MINGW64 and UCRT64), and Clangs in three LLVM-based environments (CLANG32, CLANG64 and CLANGARM64; see also [MSYS2’ s document ](https://www.msys2.org/docs/environments/ )), while the following toolchains are frequently tested:
- MINGW32 GCC,
- MINGW64 GCC,
- UCRT64 GCC (recommended for x64)
- CLANGARM64 Clang (the only and recommended toolchain for ARM64).
Official distributions of Red Panda C++ are built with MINGW32 GCC and MINGW64 GCC.
Prerequisites:
2024-04-28 16:47:35 +08:00
0. Windows 10 x64 or later, or Windows 11 ARM64.
2023-08-21 10:45:09 +08:00
1. Install MSYS2.
2024-04-28 16:47:35 +08:00
2. In selected environment, install toolchain, Qt 5 library, and required utils:
2023-08-21 10:45:09 +08:00
```bash
2024-04-28 16:47:35 +08:00
pacman -S \
$MINGW_PACKAGE_PREFIX-{toolchain,qt5-static,7zip,cmake} \
mingw-w64-i686-nsis \
git curl
2023-08-21 10:45:09 +08:00
```
2024-04-28 16:47:35 +08:00
To build, launch selected MSYS2 environment, run:
```bash
./packages/msys/build-mingw.sh
```
to build Red Panda C++ installer and portable package with MinGW GCC toolchain or without compiler; and
```bash
./packages/msys/build-llvm.sh
```
to build Red Panda C++ installer with LLVM MinGW toolchain.
Common arguments:
- `-h` , `--help` : show help message.
- `-c` , `--clean` : clean build directory.
- `-nd` , `--no-deps` : do not check dependencies.
- `-t <dir>` , `--target-dir <dir>` : set target directory for the packages. Default: `dist/` .
Extra arguments for `build-mingw.sh` :
- `--mingw32` : add `assets/mingw32.7z` to the package.
- `--mingw64` : add `assets/mingw64.7z` to the package.
- `--mingw` : alias for `--mingw32` (x86 app) or `--mingw64` (x64 app).
- `--ucrt <build>` : add UCRT runtime from Windows SDK to the package. e.g. `--ucrt 22621` for Windows 11 SDK 22H2.
2024-05-09 21:08:28 +08:00
## Windows NT 5.x Qt Library with MinGW Lite Toolchain
2024-04-28 16:47:35 +08:00
2024-05-17 15:52:36 +08:00
The script `build-xp.sh` is alike `build-mingw.sh` , but the toolchain is provided by Qt library.
2023-08-21 10:45:09 +08:00
Prerequisites:
2024-04-28 16:47:35 +08:00
0. Windows 10 x64 or later.
1. Install MSYS2.
2024-05-09 21:08:28 +08:00
2. Install required utils:
2024-04-28 16:47:35 +08:00
```bash
pacman -S \
2024-05-09 21:08:28 +08:00
mingw-w64-x86_64-{7zip,cmake} \
2024-04-28 16:47:35 +08:00
mingw-w64-i686-nsis \
git curl
2023-08-21 10:45:09 +08:00
```
2024-04-28 16:47:35 +08:00
3. Download [Windows XP Qt Library ](https://github.com/redpanda-cpp/qtbase-xp ) and extract to `C:/Qt` .
- The directory structure should be like
```
C:
└─ Qt
2024-05-17 15:52:36 +08:00
└─ 5.15.13+redpanda1
├─ mingw141_32-msvcrt
2024-04-28 16:47:35 +08:00
│ ├─ bin
2024-05-17 15:52:36 +08:00
│ │ ├─ gcc.exe
│ │ ├─ mingw32-make.exe
│ │ └─ qmake.exe
2024-04-28 16:47:35 +08:00
│ ├─ include
│ ├─ lib
│ └─ ...
2024-05-17 15:52:36 +08:00
└─ mingw141_64-msvcrt
2024-04-28 16:47:35 +08:00
├─ bin
2024-05-17 15:52:36 +08:00
│ ├─ gcc.exe
│ ├─ mingw32-make.exe
│ └─ qmake.exe
2024-04-28 16:47:35 +08:00
├─ include
├─ lib
└─ ...
```
- Or you can build from source and specify the path with `--qt` argument.
2024-05-17 15:52:36 +08:00
To build, launch MSYS2 environment, run:
2024-04-28 16:47:35 +08:00
```bash
2024-05-09 21:08:28 +08:00
./packages/msys/build-xp.sh -p 32-msvcrt
2024-04-28 16:47:35 +08:00
```
This script accepts the same arguments as `build-mingw.sh` , plus:
2024-05-09 21:08:28 +08:00
- `-p|--profile <profile>` : (REQUIRED) the profile of MinGW Lite as well as Qt library. Available profiles are `64-ucrt` , `64-msvcrt` , `32-ucrt` , `32-msvcrt` , `32-win2000` .
2024-04-28 16:47:35 +08:00
- `--qt <dir>` : set Qt directory. e.g. `--qt /d/myqt-32` .
The directory structure should be like
```
D:
└─ myqt-32
├─ bin
├─ include
├─ lib
└─ ...
```
2022-02-21 12:01:26 +08:00
2024-04-27 10:22:53 +08:00
# Linux
2022-02-21 12:01:26 +08:00
2024-04-27 10:22:53 +08:00
See also [more build instructions for freedesktop.org-conforming (XDG) desktop systems ](./docs/detailed-build-xdg.md ).
2023-09-05 19:14:08 +08:00
2024-04-27 10:22:53 +08:00
## Alpine Linux, Arch Linux, Debian and Its Derivatives, Fedora, openSUSE
2023-09-05 19:14:08 +08:00
2024-04-27 10:22:53 +08:00
1. Setup build environment (documentation for [Alpine ](https://wiki.alpinelinux.org/wiki/Abuild_and_Helpers ), [Arch ](https://wiki.archlinux.org/title/Makepkg ), [Debians ](https://wiki.debian.org/BuildingTutorial ), [RPM ](https://rpm-packaging-guide.github.io/#prerequisites )).
- For Debians:
```sh
sudo apt install --no-install-recommends build-essential debhelper devscripts equivs
```
2023-11-19 08:48:58 +08:00
2. Call build script:
- Alpine Linux: `./packages/alpine/buildapk.sh`
- Arch Linux: `./packages/archlinux/buildpkg.sh`
2024-04-27 10:22:53 +08:00
- Debians: `./packages/debian/builddeb.sh`
2023-11-19 08:48:58 +08:00
- Fedora: `./packages/fedora/buildrpm.sh`
- openSUSE: `./packages/opensuse/buildrpm.sh`
2023-10-24 12:20:32 +08:00
3. Install the package:
2023-11-19 08:48:58 +08:00
- Alpine Linux: `~/packages/unsupported/$(uname -m)/redpanda-cpp-git-*.apk`
- Arch Linux: `/tmp/redpanda-cpp-git/redpanda-cpp-git-*.pkg.tar.zst`
2024-04-27 10:22:53 +08:00
- Debians: `/tmp/redpanda-cpp_*.deb`
2023-11-19 08:48:58 +08:00
- Fedora, openSUSE: `~/rpmbuild/RPMS/$(uname -m)/redpanda-cpp-git-*.rpm`
2023-10-24 12:20:32 +08:00
4. Run Red Panda C++:
```bash
RedPandaIDE
```
2024-04-27 10:22:53 +08:00
Note that some of these scripts check out HEAD of the repo, so any changes should be committed before building.
2023-10-24 12:20:32 +08:00
2024-04-27 10:22:53 +08:00
Alternatively, build in container (rootless Podman preferred; Docker may break file permissions):
2023-01-03 12:18:02 +08:00
2024-04-27 10:22:53 +08:00
```sh
podman run --rm -v $PWD:/mnt -w /mnt < image > ./packages/< distro > /01-in-docker.sh
2023-01-03 12:18:02 +08:00
2024-04-27 10:22:53 +08:00
# Arch Linux for example
podman run --rm -v $PWD:/mnt -w /mnt docker.io/archlinux:latest ./packages/archlinux/01-in-docker.sh
2024-03-06 17:32:21 +08:00
```
2024-04-27 10:22:53 +08:00
The package will be placed in `dist/` .
2023-01-03 12:18:02 +08:00
2024-04-27 10:22:53 +08:00
## Statically Linked Binary for Ubuntu 20.04 x86_64 (NOI Linux 2.0)
2023-08-13 20:56:46 +08:00
2024-04-27 10:22:53 +08:00
The package `redpanda-cpp-bin` is roughly “AppImage repack”. The binary is actually built in a container. Thus the build host is not necessarily Ubuntu 20.04; any Linux distribution with Podman and dpkg should work.
2023-08-13 20:56:46 +08:00
2024-04-27 10:22:53 +08:00
1. Install Podman, and dpkg if build host is not Debian or its derivatives:
```sh
sudo apt install podman
```
WARNING: DO NOT install packages with dpkg on non-Debians, or your system will be terminated.
2. Call build script:
```sh
./packages/debian-static/builddeb.sh
```
The package will be placed in `dist/` .
2023-08-13 20:56:46 +08:00
2024-04-27 10:22:53 +08:00
## Linux AppImage
```bash
2024-06-11 07:55:19 +08:00
podman run --rm -v $PWD:/mnt -w /mnt quay.io/redpanda-cpp/appimage-builder-x86_64:20240610.0 ./packages/appimage/01-in-docker.sh
2024-04-27 10:22:53 +08:00
```
2023-08-13 20:56:46 +08:00
2024-04-27 10:22:53 +08:00
Dockerfiles are available in [redpanda-cpp/appimage-builder ](https://github.com/redpanda-cpp/appimage-builder ). Available architectures: `x86_64` , `aarch64` , `riscv64` .
2023-09-05 19:14:08 +08:00
# macOS
## Qt.io Qt Library
Prerequisites:
0. macOS 10.13 or later.
1. Install Xcode Command Line Tools:
```zsh
xcode-select --install
```
2. Install Qt with online installer from [Qt.io ](https://www.qt.io/download-qt-installer-oss ).
- Select the library (in _Qt_ group, _Qt 5.15.2_ subgroup, check _macOS_ ).
Build:
1. Set related variables:
```bash
SRC_DIR="~/redpanda-src"
BUILD_DIR="~/redpanda-build"
INSTALL_DIR="~/redpanda-pkg"
```
2. Navigate to build directory:
```bash
rm -rf "$BUILD_DIR" # optional for clean build
mkdir -p "$BUILD_DIR" & & cd "$BUILD_DIR"
```
3. Configure, build and install:
```bash
~/Qt/5.15.2/clang_64/bin/qmake PREFIX="$INSTALL_DIR" "$SRC_DIR/Red_Panda_CPP.pro"
make -j$(sysctl -n hw.logicalcpu)
make install
~/Qt/5.15.2/clang_64/bin/macdeployqt "$INSTALL_DIR/bin/RedPandaIDE.app"
```