From d07deb3f7f820c9ea6cee87c4e018d77c2c5fd08 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Sat, 15 Mar 2014 01:34:37 +0000 Subject: [PATCH] [WINDOWS] Ensure an icon is embedded in the executable. This is particularly important for display of an icon only in the task bar on Win 7 onwards. --- configure.ac | 14 ++++++++++++++ src/Makefile.am | 5 +++++ win32/configure_and_make.bat | 7 ++++--- win32/installer.bat | 7 +------ win32/make.bat | 10 +++++++++- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 7ff8d443..338bfd31 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,20 @@ AC_CHECK_LIB(m, tan) AC_CHECK_LIB(z, inflate) AC_CHECK_LIB(X11, XSetErrorHandler) +# ATM not running automake under Windows +#AC_CHECK_PROG(USE_WINDOWS, cmd.exe, yes, no) +#AM_CONDITIONAL([WINDOWS], [test x$USE_WINDOWS = xyes]) +# So pass in as an option instead +# This is only to perform slightly different build steps +# (the code uses standard WINDOWS defines for any specific different behaviour) +AC_ARG_ENABLE(windows, AC_HELP_STRING([--enable-windows], + [Perform specific Windows build steps (default is no)]), + [ac_cv_enable_windows=$enableval], + [ac_cv_enable_windows=no]) +AC_CACHE_CHECK([whether to enable Windows build steps], + [ac_cv_enable_windows], [ac_cv_enable_windows=no]) +AM_CONDITIONAL([WINDOWS], [test x$ac_cv_enable_windows = xyes]) + # Expat AM_WITH_EXPAT diff --git a/src/Makefile.am b/src/Makefile.am index 77494bf4..03d80e90 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -201,6 +201,11 @@ endif viking_SOURCES = main.c LDADD = libviking.a $(PACKAGE_LIBS) @EXPAT_LIBS@ @LIBCURL@ icons/libicons.a +if WINDOWS +LDADD += \ + ../win32/installer/pixmaps/viking_icon.o +endif + AM_CFLAGS = -Wall -g -D_GNU_SOURCE \ $(PACKAGE_CFLAGS) \ @EXPAT_CFLAGS@ @LIBCURL_CPPFLAGS@ diff --git a/win32/configure_and_make.bat b/win32/configure_and_make.bat index 6c11ee31..fe91504b 100644 --- a/win32/configure_and_make.bat +++ b/win32/configure_and_make.bat @@ -5,6 +5,7 @@ :: either via part of the source download or via separate generation - e.g. using wine :: set PATH=%PATH%;%SystemDrive%\Mingw\bin;%SystemDrive%\msys\1.0\bin -cd ..\ -sh configure CFLAGS="-DWINDOWS -mwindows" LIBCURL=-lcurldll LIBS=-lzdll --disable-realtime-gps-tracking --disable-scrollkeeper -make +pushd .. +sh configure CFLAGS="-DWINDOWS -mwindows" LIBCURL=-lcurldll LIBS=-lzdll --disable-realtime-gps-tracking --disable-scrollkeeper --enable-windows +popd +make.bat diff --git a/win32/installer.bat b/win32/installer.bat index 3f391671..b05c691c 100644 --- a/win32/installer.bat +++ b/win32/installer.bat @@ -5,14 +5,9 @@ :: echo STARTING INSTALLER PROCESS... -:: For windres + strip +:: For strip set PATH=%PATH%;%SystemDrive%\MinGW\bin -echo Create Icon -pushd installer\pixmaps -windres.exe viking_icon.rc -o viking_icon.o -popd - echo Remove debugging symbols pushd ..\src strip.exe -g viking.exe diff --git a/win32/make.bat b/win32/make.bat index 42a4f5ba..fb83f3f0 100644 --- a/win32/make.bat +++ b/win32/make.bat @@ -1,5 +1,13 @@ :: License: CC0 :: Standard build set PATH=%PATH%;%SystemDrive%\MinGW\bin;%SystemDrive%\msys\1.0\bin -cd ..\src + +:: The icon needs creating first as it will get embedded in the generated executable +echo Create Icon +pushd installer\pixmaps +windres.exe viking_icon.rc -o viking_icon.o +popd + +:: Change to root directory and build +cd .. make -- 2.39.5