From d1bec4dba8315cee1ceae2ef7c088ccac0144104 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Mon, 6 Mar 2023 15:07:49 -0500 Subject: [PATCH] Downgraded example to work with gtkmm 3, 4 is not installing on older ubuntu --- CMakeLists.txt | 2 +- install.sh | 1 + main.cpp | 18 ++++++------------ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b71ad3f..fbb5c8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} ) diff --git a/install.sh b/install.sh index fe5e33b..d5bb961 100644 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/main.cpp b/main.cpp index 13b5c1d..12c36f9 100644 --- a/main.cpp +++ b/main.cpp @@ -1,16 +1,10 @@ #include -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(argc, argv); +int main(int argc, char* argv[]) { + auto application = Application::create(argc, argv); + Window window; + return application->run(window); } \ No newline at end of file