If you are looking to run mousetrap using Julia, you are in the wrong place. Please visit mousetrap.jl instead.
Standalone C++ component of the mousetrap GUI engine.
While it can be used on its own, this library should be considered the back-end for the Julia component. The C++ -> Julia interface is available here.
Note that documentation is lacking, a full manual and tutorial 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.
Execute, in any public directory:
sudo apt-get install aptitude
sudo aptitude install
cmake \ # install CMake
libgtk-4-dev \ # install GTK4
libadwaita-1-dev \ # install Adwaita
libgl1-mesa-dev \ # install OpenGL
libglm-dev \ # install GLM
libglew-dev # install GLEW
sudo dnf install
cmake \ # install CMake
gtk4-devel \ # install GTK4
libadwaita-devel \ # install Adwaita
glm-devel \ # install GLM
glew-devel \ # install GLEW
Where OpenGL
is usually installed automatically on Fedora.
Install homebrew, then, in any public directory:
sudo brew install
cmake \ # install CMake
gtk4 \ # install GTK4
glm \ # install GLM
glew # install GLEW
Consider following guides linked here, in order to install each of the following dependencies:
To acquire adwaiata, download the already compiled shared library here.
GLM (OpenGL Mathematics) is header-only, download the source code here, then install it such that it can be found by cmake.
OpenGL
will usually be available through the wrapper shared library OPENGL32.dll
, which should come with any Window 10 or newer system.
Enter a bash console, then, in any public directory:
git clone https://github.com/Clemapfel/mousetrap.git
cd mousetrap
mkdir build
cd build
cmake .. -DMOUSETRAP_ENABLE_OPENGL_COMPONENT=ON
sudo make install -j 8
If you would like to use meson instead of CMake, do:
git clone https://github.com/Clemapfel/mousetrap.git
cd mousetrap
meson setup build
cd build
sudo meson install
After which you can include mousetrap in your own CMakeLists.txt
files likes so:
First, create a file main.cpp
:
#include <mousetrap.hpp>
using namespace mousetrap;
int main()
{
auto app = Application("test.app");
app.connect_signal_activate([](Application& app)
{
auto window = Window(app);
auto label = Label("Hello World!");
window.set_child(label);
window.present();
});
return app.run();
}
Then, CMakeLists.txt
:
cmake_minimum_required(VERSION 3.18)
set(TARGET_NAME example_target)
set(PROJECT_NAME example_project)
project(${PROJECT_NAME} VERSION 0.1.0 LANGUAGES CXX)
find_package(mousetrap REQUIRED)
add_executable(${TARGET_NAME} main.cpp)
target_link_libraries(${TARGET_NAME} PRIVATE
${MOUSETRAP_LIBRARIES}
)
target_include_directories(${TARGET_NAME} PRIVATE
${MOUSETRAP_INCLUDE_DIRECTORIES}
)
target_compile_features(${TARGET_NAME} PUBLIC
cxx_std_17
)
Where 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
.
Afterwards, you should be able to build your app using:
# in the same directory as our own `CMakeLists.txt`
mkdir build
cd build
cmake ..
make
# will deposit executable example_project_test
Auto-generated documentation is available here.
Mousetrap is licensed under GNU Lesser General Public License 3.0.
This library was created by C.Cords.