{"id":18008266,"url":"https://github.com/clemapfel/mousetrap","last_synced_at":"2025-03-26T12:32:07.697Z","repository":{"id":155325362,"uuid":"629554720","full_name":"Clemapfel/mousetrap","owner":"Clemapfel","description":"Stand-alone C++ Back End of https://github.com/Clemapfel/mousetrap.jl","archived":false,"fork":false,"pushed_at":"2024-02-22T17:13:04.000Z","size":7971,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-19T22:42:30.584Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://clemens-cords.com/mousetrap_cpp","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Clemapfel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-04-18T14:46:04.000Z","updated_at":"2023-08-20T18:22:36.000Z","dependencies_parsed_at":"2024-02-22T18:30:46.589Z","dependency_job_id":"5c154702-4d06-4fe7-aee0-091aa24250e6","html_url":"https://github.com/Clemapfel/mousetrap","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clemapfel%2Fmousetrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clemapfel%2Fmousetrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clemapfel%2Fmousetrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clemapfel%2Fmousetrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Clemapfel","download_url":"https://codeload.github.com/Clemapfel/mousetrap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245654336,"owners_count":20650850,"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":[],"created_at":"2024-10-30T01:18:05.865Z","updated_at":"2025-03-26T12:32:06.891Z","avatar_url":"https://github.com/Clemapfel.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mousetrap: GTK4-based GUI Engine\n\n\u003e **If you are looking to run mousetrap using Julia, you are in the wrong place. Please visit [mousetrap.jl](https://github.com/Clemapfel/mousetrap.jl) instead.**\n\nStandalone C++ component of the mousetrap GUI engine. \n\nWhile it can be used on its own, this library should be considered the back-end for the Julia component. The C++ -\u003e Julia interface is available [here](https://github.com/Clemapfel/mousetrap_julia_binding/).\n\nNote that documentation is lacking, a [full manual and tutorial](https://clemens-cords.com/mousetrap) is available for the Julia component only, which was the focus of development and polish. Autogenerated documentation as a well as a few examples can be found [here](https://clemens-cords.com/mousetrap_cpp).\n\n---\n\n## Installation\n\n### Dependencies\n\n##### Linux: Debian / Ubuntu\n\nExecute, in any public directory:\n\n```shell\nsudo apt-get install aptitude   \nsudo aptitude install \n cmake \\             # install CMake\n libgtk-4-dev \\      # install GTK4\n libadwaita-1-dev \\  # install Adwaita\n libgl1-mesa-dev  \\  # install OpenGL\n libglm-dev  \\       # install GLM\n libglew-dev         # install GLEW\n```\n\n##### Fedora\n\n```shell\nsudo dnf install \n  cmake \\             # install CMake\n  gtk4-devel \\        # install GTK4\n  libadwaita-devel \\  # install Adwaita\n  glm-devel  \\        # install GLM\n  glew-devel \\       # install GLEW\n```\n\nWhere `OpenGL` is usually installed automatically on Fedora.\n\n##### MacOS\n\nInstall [homebrew](https://brew.sh/), then, in any public directory:\n\n```shell\nsudo brew install \n  cmake \\  # install CMake\n  gtk4 \\   # install GTK4\n  glm  \\   # install GLM\n  glew     # install GLEW\n```\n\n##### Windows\n\nConsider following guides linked here, in order to install each of the following dependencies:\n\n+ [GTK4](https://www.gtk.org/docs/installations/windows)\n+ [OpenGL](https://medium.com/swlh/setting-opengl-for-windows-d0b45062caf)\n+ [GLEW](https://glew.sourceforge.net/install.html)\n\nTo acquire adwaiata, download the already compiled shared library [here](https://github.com/JuliaBinaryWrappers/libadwaita_jll.jl/releases/).\n\nGLM (OpenGL Mathematics) is header-only, download the source code [here](https://github.com/g-truc/glm), then install it such that it can be found by cmake.\n\n`OpenGL` will usually be available through the wrapper shared library `OPENGL32.dll`, which should come with any Window 10 or newer system.\n\n### Compiling\n\nEnter a bash console, then, in any public directory:\n\n```shell\ngit clone https://github.com/Clemapfel/mousetrap.git\ncd mousetrap\nmkdir build\ncd build\ncmake .. -DMOUSETRAP_ENABLE_OPENGL_COMPONENT=ON\nsudo make install -j 8\n```\n\nIf you would like to use meson instead of CMake, do:\n\n```shell\ngit clone https://github.com/Clemapfel/mousetrap.git\ncd mousetrap\nmeson setup build\ncd build\nsudo meson install\n```\n\nAfter which you can include mousetrap in your own `CMakeLists.txt` files likes so:\n\n### Linking \n\nFirst, create a file `main.cpp`:\n\n```cpp\n#include \u003cmousetrap.hpp\u003e\nusing namespace mousetrap;\n\nint main()\n{\n    auto app = Application(\"test.app\");\n    app.connect_signal_activate([](Application\u0026 app)\n    {\n        auto window = Window(app);\n        auto label = Label(\"Hello World!\");\n        \n        window.set_child(label);\n        window.present();\n    });\n\n    return app.run();\n}\n```\n\nThen, `CMakeLists.txt`:\n\n```cmake\ncmake_minimum_required(VERSION 3.18)\n\nset(TARGET_NAME example_target)\nset(PROJECT_NAME example_project)\n\nproject(${PROJECT_NAME} VERSION 0.1.0 LANGUAGES CXX)\n\nfind_package(mousetrap REQUIRED)\n\nadd_executable(${TARGET_NAME} main.cpp)\n\ntarget_link_libraries(${TARGET_NAME} PRIVATE\n    ${MOUSETRAP_LIBRARIES}\n)\n\ntarget_include_directories(${TARGET_NAME} PRIVATE\n    ${MOUSETRAP_INCLUDE_DIRECTORIES}\n)\n\ntarget_compile_features(${TARGET_NAME} PUBLIC\n    cxx_std_17\n)\n```\n\nWhere `find_package(mousetrap)` sets two variables, `MOUSETRAP_LIBRARIES` and `MOUSETRAP_INCLUDE_DIRECTORIES`, which we made available to the new executable using `target_link_libraries` and `target_include_directories`.\n\nAfterwards, you should be able to build your app using:\n\n```shell\n# in the same directory as our own `CMakeLists.txt`\nmkdir build\ncd build\ncmake ..\nmake\n# will deposit executable example_project_test\n```\n\n---\n\n## Documentation\n\nAuto-generated documentation is available [here](https://clemens-cords.com/mousetrap_cpp).\n\n---\n\n## License\n\nMousetrap is licensed under [GNU Lesser General Public License 3.0](https://www.gnu.org/licenses/lgpl-3.0.en.html#license-text).\n\n---\n\n## Credits\n\nThis library was created by [C.Cords](https://clemens-cords.com). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclemapfel%2Fmousetrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclemapfel%2Fmousetrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclemapfel%2Fmousetrap/lists"}