-
Notifications
You must be signed in to change notification settings - Fork 2k
New: Usr: Added gtkmm/2.24.5 #3410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"2.24.5": | ||
sha256: 0680a53b7bf90b4e4bf444d1d89e6df41c777e0bacc96e9c09fc4dd2f5fe6b72 | ||
url: https://download.gnome.org/sources/gtkmm/2.24/gtkmm-2.24.5.tar.xz | ||
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,80 @@ | ||||||||||||||||||||||||
import os | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
from conans import ConanFile, tools, AutoToolsBuildEnvironment | ||||||||||||||||||||||||
from conans.errors import ConanException | ||||||||||||||||||||||||
bverhagen marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
class ConanGTK(ConanFile): | ||||||||||||||||||||||||
bverhagen marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||
name = "gtkmm" | ||||||||||||||||||||||||
url = "https://github.com/conan-io/conan-center-index" | ||||||||||||||||||||||||
license = "LGPL-2.1-or-later" | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is also a |
||||||||||||||||||||||||
homepage = "https://www.gtk.org" | ||||||||||||||||||||||||
description = "The C++ API for GTK." | ||||||||||||||||||||||||
settings = {"os": "Linux"} | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||
options = {"version": [2]} | ||||||||||||||||||||||||
default_options = {"version": 2} | ||||||||||||||||||||||||
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This option depends on the value Also, I don't see you using this gtk version value anywhere in the recipe. I would do the following:
Suggested change
and use |
||||||||||||||||||||||||
topics = ("gui", "widget", "graphical") | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
settings = "os", "compiler", "build_type", "arch" | ||||||||||||||||||||||||
options = {"shared": [True, False], | ||||||||||||||||||||||||
"fPIC": [True, False], | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
default_options = {"shared": False, | ||||||||||||||||||||||||
"fPIC": True} | ||||||||||||||||||||||||
generators = "pkg_config" | ||||||||||||||||||||||||
_autoconf = None | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
@property | ||||||||||||||||||||||||
def _source_subfolder(self): | ||||||||||||||||||||||||
return "source_subfolder" | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
@property | ||||||||||||||||||||||||
def _build_subfolder(self): | ||||||||||||||||||||||||
return "build_subfolder" | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
def config_options(self): | ||||||||||||||||||||||||
if self.settings.os == "Windows": | ||||||||||||||||||||||||
del self.options.fPIC | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
def configure(self): | ||||||||||||||||||||||||
if self.settings.compiler == "Visual Studio" and \ | ||||||||||||||||||||||||
"MT" in str(self.settings.compiler.runtime) and self.options.shared: | ||||||||||||||||||||||||
raise ConanInvalidConfiguration("Visual Studio and Runtime MT is not supported for shared library.") | ||||||||||||||||||||||||
if self.options.shared: | ||||||||||||||||||||||||
del self.options.fPIC | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
def source(self): | ||||||||||||||||||||||||
tools.get(**self.conan_data["sources"][self.version]) | ||||||||||||||||||||||||
extracted_dir = self.name + "-" + self.version | ||||||||||||||||||||||||
os.rename(extracted_dir, self._source_subfolder) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
def requirements(self): | ||||||||||||||||||||||||
self.requires('gtk/system') | ||||||||||||||||||||||||
self.requires('libsigcpp/3.0.0') | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
def _configure_build(self): | ||||||||||||||||||||||||
if self._autoconf: | ||||||||||||||||||||||||
return self._autoconf | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
self._autoconf = AutoToolsBuildEnvironment(self) | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gtkmm has meson support. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I preferred to use Meson too, but the |
||||||||||||||||||||||||
return self._autoconf | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
def build(self): | ||||||||||||||||||||||||
tools.replace_in_file(self._source_subfolder + '/configure', "gtk+-2.0 >= 2.24.0", "gtk+-2.0") | ||||||||||||||||||||||||
bverhagen marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
autoconf = self._configure_build() | ||||||||||||||||||||||||
autoconf.configure(configure_dir=self._source_subfolder, | ||||||||||||||||||||||||
vars = { | ||||||||||||||||||||||||
'cross_compiling': 'no' | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
) | ||||||||||||||||||||||||
autoconf.make() | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
def package(self): | ||||||||||||||||||||||||
self.copy("LICENSE", dst="licenses", src=self._source_subfolder) | ||||||||||||||||||||||||
autoconf = self._configure_build() | ||||||||||||||||||||||||
autoconf.install() | ||||||||||||||||||||||||
tools.rmdir(os.path.join(self.package_folder, "share")) | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I see a lot of html files in res/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not. Are we talking about the same package? |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
def package_info(self): | ||||||||||||||||||||||||
self.cpp_info.includedirs = ['include', 'include/gtkmm-2.4', 'include/gdkmm-2.4'] | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you know how this |
||||||||||||||||||||||||
self.cpp_info.libs = tools.collect_libs(self) | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not see that file. Are we talking about the same package ( |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
/* Application main window | ||
* | ||
* Demonstrates a typical application window, with menubar, toolbar, statusbar. | ||
*/ | ||
|
||
#include <gtkmm.h> | ||
|
||
class Example_AppWindow : public Gtk::Window | ||
{ | ||
public: | ||
Example_AppWindow(); | ||
virtual ~Example_AppWindow(); | ||
|
||
protected: | ||
//Signal handlers: | ||
virtual void on_menu_item(); | ||
virtual void on_text_changed(); | ||
virtual void on_text_mark_set(const Gtk::TextBuffer::iterator& new_location, const Glib::RefPtr<Gtk::TextBuffer::Mark>& mark); | ||
|
||
//Member widgets: | ||
Gtk::Table m_Table; | ||
Gtk::Menu m_Menubar; | ||
Gtk::Toolbar m_Toolbar; | ||
Gtk::ScrolledWindow m_ScrolledWindow; | ||
Gtk::TextView m_TextView; | ||
Gtk::Statusbar m_Statusbar; | ||
}; | ||
|
||
|
||
//Called by DemoWindow; | ||
Gtk::Window* do_appwindow() | ||
{ | ||
return new Example_AppWindow(); | ||
} | ||
|
||
|
||
Example_AppWindow::Example_AppWindow() | ||
: m_Table(1, 4) | ||
{ | ||
set_title("Application Window"); | ||
|
||
add(m_Table); | ||
|
||
/* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the commented-out code not working? Or can it be removed/re-enabled? |
||
//Menu: | ||
{ | ||
using namespace Gtk::Menu_Helpers; | ||
|
||
//File menu: | ||
Gtk::Menu* pMenuFile = Gtk::manage( new Gtk::Menu() ); | ||
MenuList& list_file = pMenuFile->items(); | ||
list_file.push_back( MenuElem("_New", "<control>N", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
list_file.push_back( MenuElem("_Open", "<control>O", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
list_file.push_back( MenuElem("_Save", "<control>S", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
list_file.push_back( MenuElem("Save _As", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
list_file.push_back(SeparatorElem()); | ||
list_file.push_back( MenuElem("_Quit", "<control>Q", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
|
||
//Preferences menu: | ||
Gtk::Menu* pMenuPreferences = Gtk::manage( new Gtk::Menu() ); | ||
MenuList& list_preferences = pMenuPreferences->items(); | ||
|
||
// Create a submenu | ||
Gtk::Menu* pMenuSub_Color = Gtk::manage( new Gtk::Menu()); | ||
MenuList& list_sub = pMenuSub_Color->items(); | ||
list_sub.push_back( MenuElem("_Red", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
list_sub.push_back( MenuElem("_Green", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
list_sub.push_back( MenuElem("_Blue", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
|
||
list_preferences.push_back( MenuElem("_Color", *pMenuSub_Color) ); | ||
|
||
// Create a submenu | ||
Gtk::Menu* pMenuSub_Shape = Gtk::manage( new Gtk::Menu()); | ||
list_sub = pMenuSub_Shape->items(); | ||
list_sub.push_back( MenuElem("_Square", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
list_sub.push_back( MenuElem("_Rectangle", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
list_sub.push_back( MenuElem("_Oval", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
|
||
list_preferences.push_back( MenuElem("_Shape", *pMenuSub_Shape) ); | ||
|
||
//Help menu: | ||
Gtk::Menu* pMenuHelp = Gtk::manage( new Gtk::Menu() ); | ||
MenuList& list_help = pMenuHelp->items(); | ||
list_help.push_back( MenuElem("_About", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)) ); | ||
|
||
|
||
//Create the menu bar | ||
MenuList& list_bar = m_Menubar.items(); | ||
list_bar.push_front(MenuElem("_Help", *pMenuHelp)); | ||
list_bar.front()->set_right_justified(); | ||
list_bar.push_front(MenuElem("_Preferences", *pMenuPreferences)); | ||
list_bar.push_front(MenuElem("_File", *pMenuFile)); | ||
|
||
//Add the menu bar to the Table: | ||
m_Table.attach(m_Menubar, | ||
// X direction Y direction | ||
0, 1, 0, 1, | ||
Gtk::FILL|Gtk::EXPAND, Gtk::AttachOptions(0) | ||
); | ||
} //menu | ||
|
||
*/ | ||
//Toolbar: | ||
{ | ||
m_Table.attach(m_Toolbar, | ||
/* X direction */ /* Y direction */ | ||
0, 1, 1, 2, | ||
Gtk::FILL|Gtk::EXPAND, Gtk::AttachOptions(0) | ||
); | ||
} | ||
|
||
|
||
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); | ||
m_ScrolledWindow.set_shadow_type(Gtk::SHADOW_IN); | ||
m_Table.attach(m_ScrolledWindow, | ||
/* X direction */ /* Y direction */ | ||
0, 1, 2, 3); | ||
|
||
set_default_size(200, 200); | ||
|
||
m_ScrolledWindow.add(m_TextView); | ||
|
||
|
||
/* Create statusbar */ | ||
|
||
m_Table.attach(m_Statusbar, | ||
/* X direction */ /* Y direction */ | ||
0, 1, 3, 4, | ||
Gtk::FILL|Gtk::EXPAND, Gtk::AttachOptions(0) | ||
); | ||
|
||
|
||
/* Show text widget info in the statusbar */ | ||
Glib::RefPtr<Gtk::TextBuffer> refTextBuffer = m_TextView.get_buffer(); | ||
refTextBuffer->signal_changed().connect(sigc::mem_fun(*this, &Example_AppWindow::on_text_changed)); | ||
refTextBuffer->signal_mark_set().connect(sigc::mem_fun(*this, &Example_AppWindow::on_text_mark_set)); | ||
on_text_changed(); | ||
|
||
show_all(); | ||
} | ||
|
||
Example_AppWindow::~Example_AppWindow() | ||
{ | ||
} | ||
|
||
void Example_AppWindow::on_menu_item() | ||
{ | ||
Gtk::MessageDialog dialog(*this, "You selected or toggled the menu item", false, | ||
Gtk::MESSAGE_INFO, Gtk::BUTTONS_CLOSE); | ||
dialog.run(); | ||
} | ||
|
||
void Example_AppWindow::on_text_changed() | ||
{ | ||
m_Statusbar.pop(); | ||
|
||
Glib::RefPtr<Gtk::TextBuffer> refBuffer = m_TextView.get_buffer(); | ||
gint count = refBuffer->get_char_count(); | ||
|
||
Gtk::TextBuffer::iterator iter = refBuffer->get_iter_at_mark(refBuffer->get_insert()); | ||
|
||
gint row = iter.get_line(); | ||
gint col = iter.get_line_offset(); | ||
|
||
gchar* msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document", | ||
row, col, count); | ||
m_Statusbar.push(msg); | ||
g_free (msg); | ||
} | ||
|
||
|
||
void Example_AppWindow::on_text_mark_set(const Gtk::TextBuffer::iterator&, const Glib::RefPtr<Gtk::TextBuffer::Mark>&) | ||
{ | ||
on_text_changed(); | ||
} | ||
|
||
int main (int argc, char *argv[]) | ||
{ | ||
Gtk::Main kit(argc, argv); | ||
|
||
Example_AppWindow window; | ||
|
||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"2.24.5": | ||
folder: "2.x.x" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this actually co-operate with the current cci
gtk/system
recipe?We don't have a gtk recipe built from sources (yet).