Add gtk77:[experimental]Use cmake to configure the project

This commit is contained in:
daleclack 2021-05-15 15:20:07 +08:00
parent 3e059bd490
commit 92d0078a8f
6 changed files with 158 additions and 0 deletions

View File

@ -0,0 +1,95 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
//For linux amd64 and linux on arm64,some include path may different
//Commet and uncomment these lines to compile on a specificed archtiecture
//Arm64 linux libs
/*
"/usr/lib/aarch64-linux-gnu/dbus-1.0/include/**",
"/usr/lib/aarch64-linux-gnu/glib-2.0/include/**",
"/usr/lib/aarch64-linux-gnu/gtkmm-3.0/include/**",
"/usr/lib/aarch64-linux-gnu/gdkmm-3.0/include/**",
"/usr/lib/aarch64-linux-gnu/giomm-2.4/include/**",
"/usr/lib/aarch64-linux-gnu/pangomm-1.4/include/**",
"/usr/lib/aarch64-linux-gnu/glibmm-2.4/include/**",
"/usr/lib/aarch64-linux-gnu/cairomm-1.0/include/**",
"/usr/lib/aarch64-linux-gnu/sigc++-2.0/include/**",
*/
//amd64 linux libs(For ubuntu)
/*
"/usr/lib/x86_64-linux-gnu/dbus-1.0/include/**",
"/usr/lib/x86_64-linux-gnu/glib-2.0/include/**",
"/usr/lib/x86_64-linux-gnu/gtkmm-3.0/include/**",
"/usr/lib/x86_64-linux-gnu/gdkmm-3.0/include/**",
"/usr/lib/x86_64-linux-gnu/giomm-2.4/include/**",
"/usr/lib/x86_64-linux-gnu/pangomm-1.4/include/**",
"/usr/lib/x86_64-linux-gnu/glibmm-2.4/include/**",
"/usr/lib/x86_64-linux-gnu/cairomm-1.0/include/**",
"/usr/lib/x86_64-linux-gnu/sigc++-2.0/include/**",
*/
//For debian and ubuntu,kali
/*
"/usr/include/gtk-3.0/gtk/**",
"/usr/include/uuid/**",
*/
//For manjaro(Arch linux)
"/usr/lib/dbus-1.0/include/**",
"/usr/lib/glib-2.0/include/**",
"/usr/include/lzo/**",
"/usr/include/cloudproviders/**",
"${workspaceFolder}/**",
"${workspaceFolder}/../**",
"/usr/include/gtk-3.0/**",
"/usr/include/at-spi2-atk/2.0/**",
"/usr/include/at-spi-2.0/**",
"/usr/include/dbus-1.0/**",
"/usr/include/gio-unix-2.0/**",
"/usr/include/cairo/**",
"/usr/include/pango-1.0/**",
"/usr/include/fribidi/**",
"/usr/include/harfbuzz/**",
"/usr/include/atk-1.0/**",
"/usr/include/pixman-1/**",
"/usr/include/freetype2/**",
"/usr/include/libpng16/**",
"/usr/include/gdk-pixbuf-2.0/**",
"/usr/include/libmount/**",
"/usr/include/blkid/**",
"/usr/include/glib-2.0/**",
//Gtkmm libs
"/usr/include/gtkmm-3.0/**",
"/usr/lib/gtkmm-3.0/include/**",
"/usr/include/giomm-2.4/**",
"/usr/lib/giomm-2.4/include/**",
"/usr/include/glibmm-2.4/**",
"/usr/lib/glibmm-2.4/include/**",
"/usr/include/sigc++-2.0/**",
"/usr/lib/sigc++-2.0/include/**",
"/usr/include/cairomm-1.0/**",
"/usr/lib/cairomm-1.0/include/**",
"/usr/include/pangomm-1.4/**",
"/usr/lib/pangomm-1.4/include/**",
"/usr/include/atkmm-1.6/**",
"/usr/lib/atkmm-1.6/include/**",
"/usr/include/gtk-3.0/unix-print/**",
"/usr/include/gdkmm-3.0/**",
"/usr/lib/gdkmm-3.0/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++17",
"intelliSenseMode": "gcc-x64",
"compilerArgs": [
"`pkg-config --cflags --libs gtkmm-3.0`"
],
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}

View File

@ -0,0 +1,5 @@
{
"C_Cpp.errorSquiggles": "Disabled",
"cmake.configureOnOpen": false,
"C_Cpp.dimInactiveRegions": false
}

View File

@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.0.0)
project(gtk77 VERSION 0.1.0)
include(CTest)
enable_testing()
add_executable(gtk77 src/main.cc src/GtkWin.cc)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
set(CMAKE_CXX_STANDARD 17)
include(CPack)
find_package (PkgConfig REQUIRED)
pkg_check_modules (GTKMM3 REQUIRED gtkmm-3.0)
include_directories (${GTKMM3_INCLUDE_DIRS})
link_directories (${GTKMM3_LIBRARY_DIRS})
add_definitions (${GTKMM3_CFLAGS_OTHER})
target_link_libraries (${PROJECT_NAME} ${GTKMM3_LIBRARIES})

View File

@ -0,0 +1,21 @@
#include "GtkWin.hh"
MyWin::MyWin()
:m_paned(Gtk::ORIENTATION_VERTICAL)
{
//Initalize window
set_default_size(400,300);
set_icon_name("org.gtk.daleclack");
//Initalize frames
frame1.set_size_request(200,100);
frame1.set_label("Frame 1");
frame2.set_size_request(200,300);
frame2.set_label("Frame 2");
m_paned.add1(frame1);
m_paned.add2(frame2);
add(m_paned);
show_all();
}
MyWin::~MyWin(){
}

View File

@ -0,0 +1,11 @@
#include <gtkmm.h>
class MyWin : public Gtk::Window{
public:
MyWin();
virtual ~MyWin();
Gtk::Paned m_paned;
Gtk::Frame frame1;
Gtk::Frame frame2;
};

View File

@ -0,0 +1,7 @@
#include "GtkWin.hh"
int main(int argc,char **argv){
auto app=Gtk::Application::create(argc,argv,"org.gtk.daleclack");
MyWin window;
return app->run(window);
}