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 ) cmake_minimum_required( VERSION 3.16 )
FIND_PACKAGE ( PkgConfig REQUIRED ) 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} ) INCLUDE_DIRECTORIES ( ${GTK_INCLUDE_DIRS} )

View File

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

View File

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