Downgraded example to work with gtkmm 3, 4 is not installing on older ubuntu

This commit is contained in:
Matt McWilliams 2023-03-06 15:07:49 -05:00
parent 6a9a821356
commit d1bec4dba8
3 changed files with 8 additions and 13 deletions

View File

@ -3,7 +3,7 @@ PROJECT ( example )
cmake_minimum_required( VERSION 3.16 )
FIND_PACKAGE ( PkgConfig REQUIRED )
PKG_CHECK_MODULES( GTK REQUIRED gtkmm-4.0)
PKG_CHECK_MODULES( GTK REQUIRED gtkmm-3.0)
INCLUDE_DIRECTORIES ( ${GTK_INCLUDE_DIRS} )

View File

@ -34,6 +34,7 @@ if [ ! -d cairomm ]; then
git clone https://github.com/freedesktop/cairomm.git
fi
cd cairomm
cp README.md README
./autogen.sh --prefix=/usr
make -j`nproc --ignore=2`
sudo make install

View File

@ -1,16 +1,10 @@
#include <gtkmm.h>
class GTKExample : public Gtk::Window {
public:
GTKExample();
};
using namespace Glib;
using namespace Gtk;
GTKExample::GTKExample(){
set_title("GTK Example");
set_default_size(800, 450);
}
int main(int argc, char ** argv){
auto app = Gtk::Application::create("com.example.gtk");
return app->make_window_and_run<GTKExample>(argc, argv);
int main(int argc, char* argv[]) {
auto application = Application::create(argc, argv);
Window window;
return application->run(window);
}