Build Instructions
Contents
Getting the source
Clone the source code using git, and grab all the submodules:
git clone --recursive https://github.com/PrismLauncher/PrismLauncher.git
cd PrismLauncher
The rest of the documentation assumes you have already cloned the repository.
Building With MSVC
Dependencies
- Visual Studio - Software Distribution and Building Platform for Windows
- If you don't want install the Visual Studio IDE, go to 'Tools For Visual Studio' and download 'Build Tools for Visual Studio' instead
- Select 'Desktop development with C++', note that in the optional components (right side) CMake will be selected
- Java Development Kit 8 or later
- Make sure that "Set JAVA_HOME variable" is enabled in the Adoptium installer.
- Qt
Compile from command line on Windows using msbuild
You will need to run commands from x64 Native Tools Command Prompt
or x86 Native Tools Command Prompt
depending on if you are building 64bit or 32bit.
These instructions assume you are using the x64 Native Tools Command Prompt
to build for 64bit.
All commands are for a debug build, for release builds, replace Debug
with Release
in the cmake build and install commands.
-
cd
into the folder you cloned Prism Launcher to. Put quotation marks around the path. -
Now we can prepare the build itself: Run
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install -DENABLE_LTO=ON -DCMAKE_PREFIX_PATH=C:\Qt\6.6.2\msvc2019_64\lib\cmake
. These options will copy the final build to theinstall
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.6.2\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
tomsvc2019
. - If you want to build using Qt 5, then add the
-DLauncher_QT_VERSION_MAJOR=5
parameter and changeCMAKE_PREFIX_PATH
to point to Qt 5.
- If you have installed Qt in a non-default location, then change the
-
Now you need to run the build itself: Run
cmake --build build --config Debug -- /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true
.- If preferred,
UseMultiToolTask
&EnforceProcessCountAcrossBuilds
can be set as environment variables instead of passing as arguments.
- If preferred,
-
Now, wait for it to compile. This could take some time, so hopefully it compiles properly.
-
Run the command
cmake --install build --config Debug
, and it should install Prism Launcher to whatever the-DCMAKE_INSTALL_PREFIX
was. -
If you don't want Prism Launcher to store its data in
%APPDATA%
, runcmake --install build --config Debug --component portable
after the install process. -
When building on Qt 5, whenever compiling, the OpenSSL DLLs aren't put into the directory to where Prism Launcher installs which are necessary in that case, meaning that you cannot log in. The best way to fix this, is just to do
robocopy D:/Qt/Tools/OpenSSL/Win_x64/bin/ install libcrypto-1_1-x64.dll libssl-1_1-x64.dll
. This should copy the required OpenSSL DLLs to log in. When building on Qt 6 this is not necessary because it can use schannel, the Windows tls library.- Replace
<Path to Qt Install>
with the path to your Qt install. - If building for 32bit, replace
Win_x64
withWin_x86
and remove-x64
from the dlls names.
- Replace
Using ccache
CMake with the msbuild generator currently does not support CMAKE_CXX_COMPILER_LAUNCHER
, so the process of setting up ccache differs from other build systems.
ccache 4.7.x or newer is required for MSVC support.
-
Copy
ccache.exe
and rename that copy tocl.exe
-
In the build command, add
/p:TrackFileAccess=false /p:CLToolExe=cl.exe /p:CLToolPath=<path to ccache cl>
to the end of the build arguments- Replace
<path to ccache cl>
with the path to the copy ofccache.exe
you renamed tocl.exe
- Replace
If this doesn't work for you, please let us know on our Discord sever, or Matrix Space.
Building with MSYS2
Dependencies
- MSYS2 - Software Distribution and Building Platform for Windows
- Java Development Kit 8 or later
- Make sure that "Set JAVA_HOME variable" is enabled in the Adoptium installer.
Preparing MSYS2
-
Open one of the shortcuts from the MSYS2 folder in the Start menu
- We recommend building using the CLANG64 msystem of MSYS2, as it compiles considerably faster and with a few less bugs.
-
Install helpers: Run
pacman -Syu pactoys git mingw-w64-x86_64-binutils
in the MSYS2 shell. -
Install all build dependencies using
pacboy
: Runpacboy -S toolchain:p cmake:p ninja:p qt6-base:p qt6-5compat:p qt6-svg:p qt6-imageformats:p quazip-qt6:p extra-cmake-modules:p ninja:p ccache:p
.- Alternatively you can use Qt 5 (for older Windows versions), by running the following command instead:
pacboy -S toolchain:p cmake:p ninja:p qt5-base:p qt5-svg:p qt5-imageformats:p quazip-qt5:p extra-cmake-modules:p ninja:p ccache:p
- This might take a while, as it will install Qt and all the build tools required.
- Alternatively you can use Qt 5 (for older Windows versions), by running the following command instead:
Compile from command line on Windows
-
cd
into the folder you cloned Prism Launcher to. Put quotation marks around the path. -
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 theinstall
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 add the
-DLauncher_QT_VERSION_MAJOR=5
parameter - If you want to use ccache to speed up recompilations, add the parameter
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-
Now you need to run the build itself: Run
cmake --build build
. -
Now, wait for it to compile. This could take some time, so hopefully it compiles properly.
-
Run the command
cmake --install build
, and it should install Prism Launcher to whatever the-DCMAKE_INSTALL_PREFIX
was. -
If you don't want Prism Launcher to store its data in
%APPDATA%
, runcmake --install build --component portable
after the install process -
When building on Qt 5, whenever compiling, the OpenSSL DLLs aren't put into the directory to where Prism Launcher installs which are necessary in that case, meaning that you cannot log in. The best way to fix this, is just to do
cp /(msystem)/bin/libcrypto-1_1.dll /(msystem)/bin/libssl-1_1.dll install
. This should copy the required OpenSSL DLLs to log in. When building on Qt 6 this is not necessary because it can use schannel, the Windows tls library.- Replace
(msystem)
with the msystem you're using (e.g. clang64). On 64-bit msystems, like MSYS2 CLANG64, you have to add-x64
to the dlls.
- Replace
If this doesn't work for you, please let us know on our Discord sever, or Matrix Space.
IDEs and Tooling
There are a few tools that you can set up to make your development workflow smoother. In addition, some IDEs also require a bit more setup to work with Qt and CMake.
ccache
ccache is a compiler cache. It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again.
You can download it here. After setting up, builds will be incremental, and the builds after the first one will be much faster.
VS Code
To set up VS Code, you can download the C/C++ extension, since it provides IntelliSense auto complete, linting, formatting, and various other features.
Then, you need to set up the configuration. Go into the command palette and open up C/C++: Edit Configurations (UI). There, add a new configuration for PrismLauncher.
- Add the path to your Qt
include
folder toincludePath
- Add
-L/{path to your Qt installation}/lib
tocompilerArgs
- Set
compileCommands
to${workspaceFolder}/build/compile_commands.json
- Set
cppStandard
toc++14
or higher.
For step 3 to work, you also have to reconfigure CMake to generate a compile_commands.json
file. To do this, add -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
to the end of your CMake configuration command and run it again. You should see a file at build/compile_commands.json
.
Now the VS Code setup should be fully working. To test, open up some files and see if any error squiggles appear. If there are none, it's working properly!
Here is an example of what .vscode/c_cpp_properties.json
looks like on macOS with Qt installed via Homebrew:
{
"configurations": [
{
"name": "Mac (PrismLauncher)",
"includePath": [
"${workspaceFolder}/**",
"/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@6/lib"
],
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-arm64"
}
],
"version": 4
}
CLion
- Open CLion
- Choose
File->Open
- Navigate to the source folder
- Go to settings
Ctrl+Alt+S
- Navigate to
Toolchains
inBuild, Execution, Deployment
- Set the correct build tools (see here)
- CMake:
cmake
(optional) - Make:
make
(optional) - C Compiler:
gcc
- C++ Compiler:
g++
- Debugger:
gdb
(optional)
- Navigate to
CMake
inBuild, Execution, Deployment
- Set
Build directory
tobuild
- Set
- Navigate to
Edit Configurations
(see here)- Create a new configuration
- Name:
All
- Target:
All targets
- Choose the newly added configuration as default
Now you should be able to build and test Prism Launcher with the Build
and Run
buttons.
Qt Creator
-
Install Qt Creator within MSYS2 using
pacboy -S qt-creator:p
if building with it, otherwise you may use the regular installer or your package manager of choice (e.g. scoop)- NOTE: If you install or run Qt Creator outside of MSYS2 when compiling through it, Qt Creator will fail to find the compiler.
-
(Optional) Create a shortcut to
C:\msys64\(msystem).exe qtcreator
- Replace
(msystem)
with the msystem you're using (e.g. clang64).
- Replace
-
Open Qt Creator (with the
qtcreator
command in MSYS2). -
Choose
File->Open File or Project
. -
Navigate to the Launcher source folder you cloned and choose
CMakeLists.txt
. -
When prompted to configure the project, scroll past the many Desktop Qt options without changing anything and click "Configure Project" at the bottom right.
-
Cross your fingers, and press the "Run" button (bottom left of Qt Creator).
- If the project builds successfully it will run and the Launcher window will pop up.
Pages in Build Instructions:
Comment Rules
By submitting a comment, you agree to uphold the Prism Launcher Code of Conduct.
✅ What user-contributed comments are for
- Share additional information relevant to the article.
- Mention a workaround for a common issue.
- Link to useful third-party resources that are relevant to the current page, such as tutorials or articles.
- It is allowed to occasionally link to resources you've created. When doing so, you must disclose your affiliation with the resource in some way. However, linking to resources you've created should not represent the majority of your interactions with user notes. Excessive self-promotion is not allowed and will be moderated away.
🚫 What user-contributed comments are not for
- Do not point out something in the documentation being incorrect or outdated.
- Instead, open an issue on the prismlauncher.org issue tracker. If you can, please open a pull request to improve the documentation.
- You can use the Edit button at the bottom of each documentation page for this purpose.
- Do not ask support questions. Please use other community platforms instead.
- Do not submit bug reports. Please use the main Prism Launcher repository's issue tracker instead.
- Do not submit feature requests. Please use the Prism Launcher repository's issue tracker repository instead.
- Do not post off-topic comments. Comments must be strictly related to the page they are linked to.
Comments not following the above rules will be removed.
Licensing of user-contributed comments
Launcher contributors may occasionally go through the comments and may incorporate information from them in the documentation. By submitting a comment, you accept that it may be incorporated in unmodified or modified form in the launcher and/or documentation, subject to the GPL-3.0 license for the launcher and AGPL-3.0 license for the documentation.