Compare commits

...

2 Commits

Author SHA1 Message Date
21b3836dc0 Add install target 2018-03-17 17:42:17 +01:00
30569fe1a5 Include glade file in binary 2018-03-17 17:38:32 +01:00
3 changed files with 17 additions and 1 deletions

View File

@ -14,6 +14,16 @@ INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS} ${GTK3_INCLU
LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS} ${WEBKIT_LIBRARY_DIRS}) LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS} ${WEBKIT_LIBRARY_DIRS})
add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER} ${WEBKIT_CFLAGS_OTHER}) add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER} ${WEBKIT_CFLAGS_OTHER})
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/resources.c"
COMMAND glib-compile-resources "${CMAKE_CURRENT_SOURCE_DIR}/mdiary.gresource.xml" --target="${CMAKE_CURRENT_BINARY_DIR}/resources.c" --generate-source
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/glade/mainWindow.glade" "${CMAKE_CURRENT_SOURCE_DIR}/mdiary.gresource.xml"
COMMENT "Generating resources"
)
aux_source_directory(./src SRC_LIST) aux_source_directory(./src SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST}) add_executable(${PROJECT_NAME} ${SRC_LIST})
target_sources(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/resources.c")
target_link_libraries(${PROJECT_NAME} ${GTK3_LIBRARIES} ${WEBKIT_LIBRARIES}) target_link_libraries(${PROJECT_NAME} ${GTK3_LIBRARIES} ${WEBKIT_LIBRARIES})
install (TARGETS ${PROJECT_NAME} DESTINATION bin)

6
mdiary.gresource.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gtk/mdiary">
<file preprocess="xml-stripblanks">glade/mainWindow.glade</file>
</gresource>
</gresources>

View File

@ -620,7 +620,7 @@ struct mainWindow *mainWindow_new()
GtkBuilder *builder; GtkBuilder *builder;
struct mainWindow *mainWindow; struct mainWindow *mainWindow;
builder = gtk_builder_new_from_file("glade/mainWindow.glade"); builder = gtk_builder_new_from_resource("/org/gtk/mdiary/glade/mainWindow.glade");
mainWindow = malloc(sizeof(struct mainWindow)); mainWindow = malloc(sizeof(struct mainWindow));
mainWindow->mainWindow = GTK_WIDGET(gtk_builder_get_object(builder, "mainWindow")); mainWindow->mainWindow = GTK_WIDGET(gtk_builder_get_object(builder, "mainWindow"));