This project is a Tetris game implementation in C++ using modern CMake. It consists of various modules such as model, console view, QT view, tools, and controller, each responsible for different aspects of the game.
- CMake 3.27 or higher
- C++ compiler with C++20 support
- QT6 (optional, only needed for the QT view)
This project uses modern CMake to manage the build process. The project is composed of 5 libraries that can be built separately and a main executable that links all the libraries together.
We need to create a build directory and configure the project using CMake. It's in this directory that the build files will be generated and where the following other build commands need to be executed.
mkdir build
cd build
cmake ..Now that the project is configured, we can build the project by running the following command in the build directory:
cmake --build .If you want to build each library separately, you can do so by specifying the target name. Please note that all target will not compile the library and not link it with the main executable.
As the build all command, it needs to be executed in the build directory.
The libraries format are OS specific !
cmake --build . --target tetris_model cmmake --build . --target tetris_toolscmake --build . --target tetris_view_consolecmake --build . --target tetris_view_qtAppcmake --build . --target tetris_controllercmake --build . --target tetrisThe main executable will link all the libraries together. If you compile it with Qt, the main executable will automatically launch the QT view. In this case, you can specify -c to launch the console view instead.
cmake --build . --target tetris_testAfter building the project, you can run the main executable by running the following command:
cd src/
./tetrisIf you want to run the console view instead of the QT view, you can specify the -c option: ./tetris -c
After building the project, you can run the test executable by running the following command:
cd test/
./tetris_testDocumentation for the project can be generated using Doxygen. Follow these steps to generate the documentation:
- Ensure Doxygen is installed on your system.
- Run the following commands from the root directory of the project :
cd build/
cmake --build . --target doc_doxygen- Open the generated documentation by opening the following file in a web browser.
Note : The documentation is generated in the "documentation/gen_doxygen/html" folder in the root directory of the project.
This project is licensed under the MIT License - see the LICENSE file for details.