From 657a206711c4f262b4445767402c3db545b60a69 Mon Sep 17 00:00:00 2001 From: akshay-c Date: Tue, 27 Nov 2018 10:18:44 +0530 Subject: Packaging with inline icon --- .gitignore | 1 + ldmicro/CMakeLists.txt | 28 +++++++++++++++++++++++++--- ldmicro/LDMicro.desktop | 9 +++++++++ ldmicro/includes/ldmicroVC.h | 4 ++-- ldmicro/ldmicro.cpp | 11 ++++++----- 5 files changed, 43 insertions(+), 10 deletions(-) create mode 100755 ldmicro/LDMicro.desktop diff --git a/.gitignore b/.gitignore index 7a7c460..395385e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ /ldmicro/testMain.cpp /ldmicro/reg/results/* /ldmicro/includes/testMain.h +/ldmicro/includes/ldlogo.h LDMicro-linux-Workspace.code-workspace ldmicro/reg/t.pl diff --git a/ldmicro/CMakeLists.txt b/ldmicro/CMakeLists.txt index 8175484..140e94b 100644 --- a/ldmicro/CMakeLists.txt +++ b/ldmicro/CMakeLists.txt @@ -67,14 +67,21 @@ IF(UNIX) COMMAND perl txt2c.pl > ${OBJDIR}/helptext.cpp DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/manual*.txt") + add_custom_command( + OUTPUT ldlogo.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/includes + COMMAND gdk-pixbuf-csource --raw --name=LD_LOGO ${CMAKE_CURRENT_SOURCE_DIR}/ldmicro.ico > ldlogo.h + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/ldmicro.ico") + set(SCRIPT_GENERATED_FILES ${OBJDIR}/helptext.cpp - ${OBJDIR}/lang-tables.h) + ${OBJDIR}/lang-tables.h + ldlogo.h) add_custom_target(LDMicro_SCRIPT_GENERATED_FILES DEPENDS ${SCRIPT_GENERATED_FILES}) ## Version control - set (LDMicro_VERSION_MAJOR 1) - set (LDMicro_VERSION_MINOR 0) + set (LDMicro_VERSION_MAJOR 2) + set (LDMicro_VERSION_MINOR 2) ## configure a header file to pass some of the CMake settings ## to the source code @@ -143,6 +150,21 @@ IF(UNIX) target_link_libraries (LDMicro LinuxUI) target_link_libraries (LDMicro FreezeLD) + INSTALL(TARGETS LDMicro DESTINATION /usr/local/bin/ldmicro) + INSTALL(FILES ldmicro.ico DESTINATION /usr/local/bin/ldmicro) + INSTALL(FILES LDMicro.desktop DESTINATION /usr/share/applications) + + ##Debian package creation + set(CPACK_GENERATOR "DEB") + set(CPACK_PACKAGE_VERSION_MAJOR "2") + set(CPACK_PACKAGE_VERSION_MINOR "2") + set(CPACK_PACKAGE_VERSION_PATCH "0") + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) + set(CPACK_PACKAGE_DESCRIPTION "Ladder Logic editor, simulator and compiler for 8 bit microcontrollers") + set(CPACK_PACKAGE_CONTACT "Akshay Chipkar akshaychipkar@yahoo.co.in") + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/Debian/postinst") + + include(CPack) ## Add tests MESSAGE( STATUS "Adding tests.." ) add_custom_command( diff --git a/ldmicro/LDMicro.desktop b/ldmicro/LDMicro.desktop new file mode 100755 index 0000000..3d93818 --- /dev/null +++ b/ldmicro/LDMicro.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Terminal=false +Icon[en_IN]=/usr/local/bin/ldmicro/ldmicro.ico +Name[en_IN]=LDMicro +Exec=/usr/local/bin/ldmicro/LDMicro +Name=LDMicro +Icon=/usr/local/bin/ldmicro/ldmicro.ico diff --git a/ldmicro/includes/ldmicroVC.h b/ldmicro/includes/ldmicroVC.h index 400bc42..67e0d9c 100644 --- a/ldmicro/includes/ldmicroVC.h +++ b/ldmicro/includes/ldmicroVC.h @@ -1,3 +1,3 @@ /// version control -#define LDMicro_VERSION_MAJOR 1 -#define LDMicro_VERSION_MINOR 0 +#define LDMicro_VERSION_MAJOR 2 +#define LDMicro_VERSION_MINOR 2 diff --git a/ldmicro/ldmicro.cpp b/ldmicro/ldmicro.cpp index c41862c..1e8c93d 100644 --- a/ldmicro/ldmicro.cpp +++ b/ldmicro/ldmicro.cpp @@ -25,7 +25,7 @@ // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- #include "linuxUI.h" - +#include #include #include #include "ldmicro.h" @@ -1255,10 +1255,11 @@ int main(int argc, char** argv) gtk_window_move(GTK_WINDOW(MainWindow), 10, 10); /*gtk_widget_override_background_color(GTK_WIDGET(MainWindow), GTK_STATE_FLAG_NORMAL, ((HBRUSH)GetStockObject(BLACK_BRUSH)));*/ - gtk_window_set_default_icon(LoadImage(Instance, LDMICRO_ICON, - IMAGE_ICON, 32, 32, 0)); - gtk_window_set_icon(GTK_WINDOW(MainWindow), LoadImage(Instance, LDMICRO_ICON, - IMAGE_ICON, 32, 32, 0)); + GdkPixbuf* pixbuf = gdk_pixbuf_new_from_inline (-1, LD_LOGO, FALSE, NULL); +// GtkWidget* logo = gtk_image_new_from_pixbuf(pixbuf); + + gtk_window_set_default_icon(pixbuf); + gtk_window_set_icon(GTK_WINDOW(MainWindow), pixbuf); /// Make main window - end MakeMainWindowMenus(); -- cgit