{"id":15136909,"url":"https://github.com/shekeraoleksandr/breakoutgame","last_synced_at":"2025-07-01T02:33:51.016Z","repository":{"id":163971321,"uuid":"639405101","full_name":"shekeraoleksandr/breakoutGame","owner":"shekeraoleksandr","description":"C++ Conan CMake Qt6 Breakout game","archived":false,"fork":false,"pushed_at":"2023-07-11T12:03:07.000Z","size":1178,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T17:03:25.663Z","etag":null,"topics":["cmake","conan","qt6","ubuntu"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shekeraoleksandr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-11T12:08:56.000Z","updated_at":"2023-07-18T08:40:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"78e55604-307d-4b0a-b42c-ffabe666857e","html_url":"https://github.com/shekeraoleksandr/breakoutGame","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shekeraoleksandr/breakoutGame","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shekeraoleksandr%2FbreakoutGame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shekeraoleksandr%2FbreakoutGame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shekeraoleksandr%2FbreakoutGame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shekeraoleksandr%2FbreakoutGame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shekeraoleksandr","download_url":"https://codeload.github.com/shekeraoleksandr/breakoutGame/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shekeraoleksandr%2FbreakoutGame/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262883906,"owners_count":23379278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmake","conan","qt6","ubuntu"],"created_at":"2024-09-26T06:41:45.736Z","updated_at":"2025-07-01T02:33:50.817Z","avatar_url":"https://github.com/shekeraoleksandr.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![ubuntu](https://github.com/shekeraoleksandr/breakoutGame/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/shekeraoleksandr/breakoutGame/actions/workflows/ubuntu.yml)\n# C++ Conan CMake Qt6 Breakout game\nThis project uses C++20 and Qt 6.1.2.\n\n* `[x]` Using Qt6 with CMake and Conan\n* `[x]` Using a custom static library\n* `[x]` Github actions to build on Ubuntu\n* `[x]` A unit test environment\n\n# Building\n\nFirst, we clone the GitHub repository:\n\n```bash\ngit clone https://github.com/shekeraoleksandr/breakoutGame.git\n```\n\nThen create a build folder inside of the repository's folder and navigate into it:\n\n```bash\ncd breakoutGame \u0026\u0026 mkdir build \u0026\u0026 cd build\n```\n\nOnce we've created the build directory, we can run Conan and CMake in one step:\n\n```bash\ncmake .. -DCMAKE_BUILD_TYPE=Debug\n```\n\nIn this case, we have configured our build system to compile debug versions of the binaries. Now we can build with the following command:\n\n```bash\ncmake --build .\n```\n\nTo execute the program:\n```bash\n./bin/breakoutSrc \n```\n\n# Details\n\u003e **Warning**:\n\u003e Qt6 works only with the Conan version \u003c 2.0.\n\nTo reinstall Conan:\n```bash\npip install --force-reinstall -v \"conan==1.60.0\"\n```\n## Using Qt6 with CMake and Conan\nThe only way I could get Qt6 to work with Conan and CMake was by including the `conan.cmake` file from: https://github.com/conan-io/cmake-conan\n\nThe main problems that I ran into were:\n\n### Wayland conflict:\n```bash\nERROR: Conflict in wayland/1.21.0:\n'wayland/1.21.0' requires 'libffi/3.4.4' while 'glib/2.73.0' requires 'libffi/3.4.3'.\n```\n\nTo fix it I had to specify the version of `libffi` I wanted to use in the root *CMakeLists.txt*:\n\n```cmake\nconan_cmake_run(REQUIRES\n        qt/6.1.2\n        libffi/3.4.2\n    ...\n```\n\n### Package manager mode install:\n\n```bash\nxorg/system: ERROR: while executing system_requirements(): \nSystem requirements: 'libx11-xcb-dev, ...' are missing but can't install because tools.system.package_manager:mode is 'check'.\nPlease update packages manually or set 'tools.system.package_manager:mode' to 'install' in the [conf] section of the profile, \nor in the command line using '-c tools.system.package_manager:mode=install'\n```\n\nTo fix it I had to add `tools.system.package_manager:mode=install` in the conf section of my profile, in my case profiles are located in `/home/user/.conan/profiles/` but your path can be different.\nAlso I created my profile using `conan_cmake_profile` in the root *CMakeLists.txt*:\n\n```cmake\nconan_cmake_profile(FILEPATH    \"${CMAKE_BINARY_DIR}/profile\"\n                    SETTINGS    os=Linux\n                                os_build=Linux\n                                arch=x86_64\n                                arch_build=x86_64\n                                compiler=gcc\n                                compiler.version=9\n                                compiler.libcxx=libstdc++11\n                                build_type=Release\n                    OPTIONS     qt:shared=True\n                    CONF        \"tools.system.package_manager:mode=install\"\n                                \"tools.system.package_manager:sudo=True\")    \n```\nTo use this profile over default I added `PROFILE profile` to the root *CMakeLists.txt*:\n\n```cmake\nconan_cmake_run(REQUIRES\n        ...\n        PROFILE profile)\n```\n\n### Xcb plugin not found:\n\n```bash\nqt.qpa.xcb: could not connect to display\nqt.qpa.plugin: Could not load the Qt platform plugin \"xcb\" in \"\" even though it was found.\nThis application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.\n```\n\nThere may be several solutions to this problem, discussed [here](https://askubuntu.com/questions/308128/failed-to-load-platform-plugin-xcb-while-launching-qt5-app-on-linux-without). \n\nI personally added `qt:shared=True` to the `OPTIONS` section of the profile that creates in the root *CMakeLists.txt*:\n\n```cmake\nconan_cmake_profile(FILEPATH    \"${CMAKE_BINARY_DIR}/profile\"\n                    ...\n                    OPTIONS     qt:shared=True\n                    ...\n```\n\nIt can also be added to the `conan_cmake_run`:\n\n```cmake\nconan_cmake_run(REQUIRES\n        ...\n        OPTIONS qt:shared=True\n        ...\n```\n\n## Using a custom library\nThe library is called `BreakoutLib` it exist `include/`.\n\nEven though no linking is actually done when building the library by itself, this line must still be included in the library's CMake file:\n\n```cmake\ntarget_link_libraries(MyLib PRIVATE\n    Qt6::Core\n)\n```\n\n## Unit Tests and GitHub Actions\nI could only get Qt6 to build on Github Actions if I used `ubuntu-latest`.\n\nI faced the `xcb` error and to solve it I specified a virtual display for the CTest execution.\n\n```yaml\n- name: Install xvfb\n  run: sudo apt install xvfb\n\n- name: Run Tests with xvfb\n  run: xvfb-run ctest --rerun-failed --output-on-failure\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshekeraoleksandr%2Fbreakoutgame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshekeraoleksandr%2Fbreakoutgame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshekeraoleksandr%2Fbreakoutgame/lists"}