Skip to content

Commit

Permalink
chore(wiki): update build-instructions with qt6 as the default qt ver…
Browse files Browse the repository at this point in the history
…sion

Signed-off-by: seth <[email protected]>
  • Loading branch information
getchoo authored Jul 27, 2023
1 parent a8a97d9 commit 986947f
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/wiki/development/build-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ Getting the project to build and run on Linux is easy if you use any modern and
### Build dependencies

- A C++ compiler capable of building C++17 code.
- Qt Development tools 5.12 or newer (`qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5` on Debian-based systems)
- Alternatively you can also use Qt 6.0 or newer (`qt6-base-dev qtchooser qt6-base-dev-tools libqt6core6 libqt6core5compat6-dev libqt6network6` on Debian (testing/unstable) based systems), if you prefer it.
- Qt Development tools 6.0 or newer (`qt6-base-dev qtchooser qt6-base-dev-tools libqt6core6 libqt6core5compat6-dev libqt6network6` on Debian (testing/unstable) based systems).
- Alternatively, you can also use Qt 5.12 or newer (`qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5` on Debian-based systems), if you prefer it.

- cmake 3.15 or newer (`cmake` on Debian-based system)
- ninja (`ninja-build` on Debian-based systems)
- extra-cmake-modules (`extra-cmake-modules` on Debian-based system)
Expand All @@ -51,7 +52,7 @@ You can use IDEs, like KDevelop, QtCreator or CLion to open the CMake project, i
```bash
cmake -S . -B build -G Ninja \
-DCMAKE_INSTALL_PREFIX=install
# -DLauncher_QT_VERSION_MAJOR="6" # if you want to use Qt 6
# -DLauncher_QT_VERSION_MAJOR="5" # if you want to use Qt 5

cmake --build build
cmake --install build
Expand All @@ -67,7 +68,7 @@ cmake -S . -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="/usr" \ # Use "/usr" when building Linux packages. If building not for package, use "/usr/local"
-DENABLE_LTO=ON # if you want to enable LTO/IPO
# -DLauncher_QT_VERSION_MAJOR="6" # if you want to use Qt 6
# -DLauncher_QT_VERSION_MAJOR="5" # if you want to use Qt 5

cmake --build build
cmake --install build # Optionally specify DESTDIR for packages (i.e. DESTDIR=${pkgdir} cmake --install ...)
Expand Down Expand Up @@ -150,8 +151,8 @@ flatpak-builder --user --install flatbuild org.prismlauncher.PrismLauncher.yml
2. Choose a place to install Qt.
3. Choose the components that you wish install.

- You need Qt 5.12.x 64-bit ticked. (or a newer version)
- Alternatively you can choose Qt 6.0 or newer
- You need Qt 6.0.x 64-bit ticked. (or a newer version)
- Alternatively you can choose Qt 5.12.0 or newer
- You need Tools/Qt Creator ticked.
- Other components are selected by default, you can un-tick them if you don't need them.

Expand All @@ -168,8 +169,8 @@ flatpak-builder --user --install flatbuild org.prismlauncher.PrismLauncher.yml
4. Read the instructions that just popped up about a build location and choose one.
5. You should see "Run CMake" in the window.

- Make sure that Generator is set to "Unix Generator (Desktop Qt 5.12.x GCC 64bit)".
- Alternatively this is probably "Unix Generator (Desktop Qt 6.x.x GCC 64bit)"
- Make sure that Generator is set to "Unix Generator (Desktop Qt 6.x.x GCC 64bit)".
- Alternatively this is probably "Unix Generator (Desktop Qt 5.12.x GCC 64bit)"
- Hit the "Run CMake" button.
- You'll see warnings, and it might not be clear that it succeeded until you scroll to the bottom of the window.
- Hit "Finish" if CMake ran successfully.
Expand All @@ -190,8 +191,8 @@ flatpak-builder --user --install flatbuild org.prismlauncher.PrismLauncher.yml
- [Java Development Kit 8 or later](https://adoptium.net/)
- Make sure that "Set JAVA_HOME variable" is enabled in the Adoptium installer.
- [Qt](https://www.qt.io/download-qt-installer)
- For Qt 5 (Qt 5.15.2 is the recommended one), OpenSSL Toolkit is required
- For Qt 6 (Qt 6.4.0 is the recommended one), 'Qt 5 Compatibility Module' & 'Qt Image Formats' are required
- For Qt 5 (Qt 5.15.2 is the recommended one), OpenSSL Toolkit is required
- If you don't want to use the Qt installer, than you can use [aqt](https://github.com/miurahr/aqtinstall), see [aqt-list](https://ddalcino.github.io/aqt-list-server/) for help with command arguments.

### Compile from command line on Windows using msbuild
Expand All @@ -201,11 +202,11 @@ These instructions assume you are using the `x64 Native Tools Command Prompt` to
All commands are for a debug build, for release builds, replace `Debug` with `Release` in the cmake build and install commands.

1. `cd` into the folder you cloned Prism Launcher to. Put quotation marks around the path.
2. Now we can prepare the build itself: Run `cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install -DENABLE_LTO=ON -DLauncher_QT_VERSION_MAJOR=6 -DCMAKE_PREFIX_PATH=C:\Qt\6.4.0\msvc2019_64\lib\cmake`. These options will copy the final build to the `install` folder after the build.
2. Now we can prepare the build itself: Run `cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install -DENABLE_LTO=ON -DCMAKE_PREFIX_PATH=C:\Qt\6.4.0\msvc2019_64\lib\cmake`. These options will copy the final build to the `install` folder after the build.

- If you have installed Qt in a non-default location, then change the `CMAKE_PREFIX_PATH` to `-DCMAKE_PREFIX_PATH=<Path to Qt Install>\6.4.0\msvc2019_64\lib\cmake`, replacing `<Path to Qt Install>` with the path to your Qt install.
- If you are building for 32bit, change `msvc2019_64` to `msvc2019`.
- If you want to build using Qt 5, then remove the `-DLauncher_QT_VERSION_MAJOR=6` parameter and change `CMAKE_PREFIX_PATH` to point to Qt 5.
- If you want to build using Qt 5, then add the `-DLauncher_QT_VERSION_MAJOR=5` parameter and change `CMAKE_PREFIX_PATH` to point to Qt 5.

3. Now you need to run the build itself: Run `cmake --build build --config Debug -- /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true`.

Expand Down Expand Up @@ -254,10 +255,10 @@ ccache 4.7.x or newer is required for MSVC support.
### Compile from command line on Windows

1. `cd` into the folder you cloned Prism Launcher to. Put quotation marks around the path.
2. Now we can prepare the build itself: Run `cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install -DENABLE_LTO=ON -DLauncher_QT_VERSION_MAJOR=6 -DCMAKE_OBJDUMP=/mingw64/bin/objdump.exe -DCMAKE_BUILD_TYPE=Debug -G Ninja`. These options will copy the final build to the `install` folder after the build.
2. Now we can prepare the build itself: Run `cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install -DENABLE_LTO=ON -DCMAKE_OBJDUMP=/mingw64/bin/objdump.exe -DCMAKE_BUILD_TYPE=Debug -G Ninja`. These options will copy the final build to the `install` folder after the build.

- Replace Debug with Release if you want to build a Release build.
- If you want to build using Qt 5, then remove the `-DLauncher_QT_VERSION_MAJOR=6` parameter
- If you want to build using Qt 5, then add the `-DLauncher_QT_VERSION_MAJOR=5` parameter
- If you want to use [ccache](#ccache) to speed up recompilations, add the parameter `-DCMAKE_CXX_COMPILER_LAUNCHER=ccache`

3. Now you need to run the build itself: Run `cmake --build build`.
Expand Down Expand Up @@ -296,7 +297,7 @@ ccache 4.7.x or newer is required for MSVC support.
- Install the official build of CMake (<https://cmake.org/download/>).
- Install extra-cmake-modules
- Install JDK 8 (<https://adoptium.net/temurin/releases/?variant=openjdk8&jvmVariant=hotspot>).
- Install Qt 5.12 or newer or any version of Qt 6 (recommended)
- Install any version of Qt 6 (recommended) or Qt 5.12 or newer

Using [homebrew](https://brew.sh) you can install these dependencies with a single command:

Expand Down Expand Up @@ -324,14 +325,14 @@ mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX:PATH="$(dirname $PWD)/dist/" \
-DCMAKE_INSTALL_PREFIX="dist" \
-DCMAKE_PREFIX_PATH="/path/to/Qt/" \
-DQt5_DIR="/path/to/Qt/" \
-DQt6_DIR="/path/to/Qt/" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
-DLauncher_QT_VERSION_MAJOR=6 \ # if you want to use Qt 6
-DENABLE_LTO=ON \ # if you want to enable LTO/IPO
-DLauncher_BUILD_PLATFORM=macOS
#-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" # to build a universal binary (not recommended for development)
#-DLauncher_QT_VERSION_MAJOR=5 \ # if you want to use Qt 5
..
make install
```
Expand Down Expand Up @@ -382,6 +383,7 @@ cmake -S . -B build \
-DCMAKE_INSTALL_PREFIX="/usr/local" \ # /usr/local is default in OpenBSD and FreeBSD
-DCMAKE_PREFIX_PATH=/usr/local/lib/qt5/cmake # use linux layout and point to qt5 libs
-DENABLE_LTO=ON # if you want to enable LTO/IPO
-DLauncher_QT_VERSION_MAJOR="5"
cd build
make -j$(nproc) install # Optionally specify DESTDIR for packages (i.e. DESTDIR=${pkgdir})
```
Expand Down Expand Up @@ -420,15 +422,15 @@ Here is an example of what `.vscode/c_cpp_properties.json` looks like on macOS w
"name": "Mac (PrismLauncher)",
"includePath": [
"${workspaceFolder}/**",
"/opt/homebrew/opt/qt@5/include/**"
"/opt/homebrew/opt/qt@6/include/**"
],
"defines": [],
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"compilerArgs": [
"-L/opt/homebrew/opt/qt@5/lib"
"-L/opt/homebrew/opt/qt@6/lib"
],
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"cStandard": "c17",
Expand Down

0 comments on commit 986947f

Please sign in to comment.