Added GTK libs

This commit is contained in:
Markus Koch 2017-01-31 18:18:10 +01:00
parent 9b775df90d
commit 64df3a81b0
2 changed files with 24 additions and 3 deletions

View File

@ -1,4 +1,17 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
project(mdiary) project(mdiary)
add_executable(${PROJECT_NAME} "main.c") #set(CMAKE_BUILD_TYPE Release)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
pkg_check_modules(GOBJECT2 REQUIRED gobject-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} )
LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS})
add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER})
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} ${GTK3_LIBRARIES} ${PC_LIBSOUP_LIBRARIES})

12
main.c
View File

@ -1,7 +1,15 @@
#include <stdio.h> #include <stdio.h>
#include <gtk/gtk.h>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
printf("Hello World!\n"); GtkWidget *mainWindow;
return 0;
gtk_init(&argc, &argv);
mainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(mainWindow);
g_signal_connect (G_OBJECT (mainWindow), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_main();
return 0;
} }