Skip to content

Linux build instructions

adazem009 edited this page Apr 14, 2024 · 3 revisions

Installing Qt

ScratchCPP Player needs Qt 6.6. You can use the aqt-install tool to install it (make sure you have Python installed):

pip install -U pip
pip install aqtinstall

aqt install-qt linux desktop 6.6 gcc_64 -m qtimageformats --outputdir ~/Qt

Qt will be installed in the ~/Qt directory.

Alternatively, the official Qt installer can be used. Just make sure you check the required Qt modules (Qt Image Formats).

Building (Qt Creator)

Install Qt Creator. It can usually be installed using your distribution's package manager, for example:

sudo apt update
sudo apt install qtcreator

Alternatively, use aqt-install or the official Qt installer:

aqt install-tool linux desktop tools_qtcreator qt.tools.qtcreator --outputdir ~/Qt

Qt Creator should now be in your applications. If you used aqt-install, launch it from the command line:

~/Qt/Tools/QtCreator/bin/qtcreator

Go to Edit -> Preferences -> Kits -> Qt Versions and click on the Add button. Then select the ~/Qt/{Qt version}/gcc_64/bin/qmake file in the dialog.

Qt Versions

Go to the Kits tab and click on the Add button. Choose a name for the kit and make sure to select the newly added Qt version in the dropdown menu.

Qt Kits

Clone the ScratchCPP Player repository:

git clone https://github.com/scratchcpp/scratchcpp-player --recurse-submodules
cd scratchcpp-player

Open the CMakeLists.txt file in the cloned repository in Qt Creator and go to the Projects tab. Make sure your kit is enabled for the project.

Project kits

To reduce build time, disable unit tests (you might need them if you're going to contribute to the project). To do this, type unit into the Filter box and uncheck the SCRATCHCPP_PLAYER_BUILD_UNIT_TESTS option. Then click on the Run CMake button.

Disable unit tests

To build and run the application, click on the play button in the bottom left corner.

Build & run button

Building (command line)

Clone the ScratchCPP Player repository:

git clone https://github.com/scratchcpp/scratchcpp-player --recurse-submodules
cd scratchcpp-player

Create a build directory:

mkdir build_files
cd build_files

Tell CMake to use the Qt installation you've installed and configure the project:

export CMAKE_PREFIX_PATH=$(echo ~/Qt/*/gcc_64):$CMAKE_PREFIX_PATH # replace the asterisk with the installed Qt version if you have more versions installed
cmake ..

And to build and run the application:

cmake --build . -j$(nproc --all)
./src/scratchcpp-player
Clone this wiki locally