From 742eba2cd64fdac65275213d2b2773f8a82b5164 Mon Sep 17 00:00:00 2001 From: Jerry Jacobs Date: Wed, 11 May 2016 07:33:41 +0200 Subject: [PATCH] Reorganize stlink-gui and update README, add building gui with Travis CI on linux --- .travis.sh | 8 ++++++-- CMakeLists.txt | 6 +++--- Makefile.am | 2 +- README | 3 ++- configure.ac | 16 ++++++++-------- {gui => src/tools/gui}/Makefile.am | 6 +++--- {gui => src/tools/gui}/stlink-gui.c | 2 +- {gui => src/tools/gui}/stlink-gui.h | 0 {gui => src/tools/gui}/stlink-gui.ui | 0 9 files changed, 24 insertions(+), 19 deletions(-) rename {gui => src/tools/gui}/Makefile.am (89%) rename {gui => src/tools/gui}/stlink-gui.c (99%) rename {gui => src/tools/gui}/stlink-gui.h (100%) rename {gui => src/tools/gui}/stlink-gui.ui (100%) diff --git a/.travis.sh b/.travis.sh index 6b69c63..13d2c1d 100755 --- a/.travis.sh +++ b/.travis.sh @@ -1,7 +1,7 @@ #!/bin/bash if [ "$TRAVIS_OS_NAME" != "osx" ]; then sudo apt-get update -qq || true - sudo apt-get install -qq -y --no-install-recommends libusb-1.0.0-dev + sudo apt-get install -qq -y --no-install-recommends libusb-1.0.0-dev libgtk-3-dev else brew install libusb fi @@ -13,6 +13,10 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then make else ./autogen.sh - ./configure + if [ "$TRAVIS_OS_NAME" == "osx" ]; then + ./configure + else + ./configure --with-gtk-gui + fi make fi diff --git a/CMakeLists.txt b/CMakeLists.txt index f75ce61..1c56ed4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,8 +97,8 @@ endif() if(gtk_FOUND) include_directories(${gtk_INCLUDE_DIRS}) - set(GUI_SOURCES gui/stlink-gui.c - gui/stlink-gui.h) + set(GUI_SOURCES src/tools/gui/stlink-gui.c + src/tools/gui/stlink-gui.h) add_executable(stlink-gui-local ${GUI_SOURCES}) set_target_properties(stlink-gui-local PROPERTIES @@ -113,6 +113,6 @@ if(gtk_FOUND) install(TARGETS stlink-gui RUNTIME DESTINATION bin) - install(FILES gui/stlink-gui.ui + install(FILES src/tools/gui/stlink-gui.ui DESTINATION ${INSTALLED_UI_DIR}) endif() diff --git a/Makefile.am b/Makefile.am index fc95184..7494913 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ # Makefile.am -- Process this file with automake to produce Makefile.in -SUBDIRS = . $(MAYBE_GUI) +SUBDIRS = . $(STLINK_HAS_GUI) AUTOMAKE_OPTIONS = subdir-objects diff --git a/README b/README index 90bc084..89bb188 100644 --- a/README +++ b/README @@ -21,6 +21,7 @@ Two different transport layers are used: * `pkg-config` * `libusb-1.0` (plus development headers for building, on debian based distros `libusb-1.0.0-dev` package) +* (optional) for `stlink-gui` we need libgtk-3-dev ## For STLINKv1 @@ -48,7 +49,7 @@ following steps will build the project for you. ``` $ ./autogen.sh -$ ./configure +$ ./configure --with-gtk-gui $ make ``` diff --git a/configure.ac b/configure.ac index f374717..7a101d5 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([stlink],[0.5.6],[davem@devkitpro.org]) +AC_INIT([stlink],[1.2.0],[davem@devkitpro.org]) AC_CONFIG_SRCDIR([src/common.c]) AC_CONFIG_LIBOBJ_DIR([src]) AM_INIT_AUTOMAKE([1.10]) @@ -44,15 +44,15 @@ case "${host}" in AM_CONDITIONAL(MINGW, false) esac -MAYBE_GUI= -AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk], [enable GTK+ gui])) -if test "x$with_gtk" = "xyes"; then - PKG_CHECK_MODULES([GTK], [gtk+-3.0]) +STLINK_HAS_GUI= +AC_ARG_WITH([gtk_gui], AS_HELP_STRING([--with-gtk-gui], [enable GTK3+ gui])) +if test "x$with_gtk_gui" = "xyes"; then + PKG_CHECK_MODULES([GTK3], [gtk+-3.0]) PKG_CHECK_MODULES([GLIB], [glib-2.0 > 2.32.0]) - MAYBE_GUI=gui - AC_CONFIG_FILES([gui/Makefile]) + STLINK_HAS_GUI=src/tools/gui + AC_CONFIG_FILES([src/tools/gui/Makefile]) fi -AC_SUBST([MAYBE_GUI]) +AC_SUBST([STLINK_HAS_GUI]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/gui/Makefile.am b/src/tools/gui/Makefile.am similarity index 89% rename from gui/Makefile.am rename to src/tools/gui/Makefile.am index 97b780e..23e582f 100644 --- a/gui/Makefile.am +++ b/src/tools/gui/Makefile.am @@ -5,10 +5,10 @@ stlink_gui_SOURCES = \ stlink-gui.h stlink_gui_CPPFLAGS = \ - -I$(top_srcdir) \ + -I$(top_srcdir)/include \ $(AM_CPPFLAGS) \ -I$(top_srcdir)/src \ - @GTK_CFLAGS@ + @GTK3_CFLAGS@ stlink_gui_CFLAGS = \ $(WARN_CFLAGS) \ @@ -21,7 +21,7 @@ stlink_gui_LDFLAGS = \ stlink_gui_LDADD = \ $(INTLLIBS) \ $(top_builddir)/libstlink.a \ - @GTK_LIBS@ + @GTK3_LIBS@ uidir = $(pkgdatadir)/ui ui_DATA = stlink-gui.ui diff --git a/gui/stlink-gui.c b/src/tools/gui/stlink-gui.c similarity index 99% rename from gui/stlink-gui.c rename to src/tools/gui/stlink-gui.c index 93f92c4..944ad13 100644 --- a/gui/stlink-gui.c +++ b/src/tools/gui/stlink-gui.c @@ -3,7 +3,7 @@ #include #include -#include "stlink-common.h" +#include #include "stlink-gui.h" #define MEM_READ_SIZE 1024 diff --git a/gui/stlink-gui.h b/src/tools/gui/stlink-gui.h similarity index 100% rename from gui/stlink-gui.h rename to src/tools/gui/stlink-gui.h diff --git a/gui/stlink-gui.ui b/src/tools/gui/stlink-gui.ui similarity index 100% rename from gui/stlink-gui.ui rename to src/tools/gui/stlink-gui.ui -- 2.47.2