From b2b4dd2f7313d77894b325b929d30c5327a36777 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sun, 24 Sep 2023 19:46:23 +0200 Subject: [PATCH] Add first version of a Windows installer --- .github/workflows/windows-msys2.yml | 7 +--- configure.ac | 24 ++++++++++-- data/nsis/Makefile.am | 4 +- data/nsis/installer-script.nsi.in | 57 +++++++++++++++++++++++++++++ src/Makefile.am | 2 +- 5 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 data/nsis/installer-script.nsi.in diff --git a/.github/workflows/windows-msys2.yml b/.github/workflows/windows-msys2.yml index 064f8ef9..07556d5f 100644 --- a/.github/workflows/windows-msys2.yml +++ b/.github/workflows/windows-msys2.yml @@ -85,11 +85,7 @@ jobs: --disable-ecasound --disable-intersense CPPFLAGS="-I/ucrt64/include -I`pwd`/../websocketpp -D_WEBSOCKETPP_CPP11_THREAD_" - # TODO: move this to configure.ac: - CFLAGS=-mwin32 LDFLAGS=-L/ucrt64/lib - # TODO: move this to configure.ac: - LIBS="-lws2_32 -lwsock32 -lglu32 -lopengl32" ) ./configure --disable-dependency-tracking "${CONFIGURE_OPTIONS[@]}" - name: upload config.log @@ -109,6 +105,5 @@ jobs: - name: upload installer uses: actions/upload-artifact@v3 with: - # TODO: upload the actual installer name: ssr-installer - path: ssr/windows-installer + path: "ssr/windows-installer/SoundScape Renderer * Installer.exe" diff --git a/configure.ac b/configure.ac index c58da66e..b1ed6f1e 100644 --- a/configure.ac +++ b/configure.ac @@ -51,7 +51,7 @@ AC_CANONICAL_TARGET dnl Compute the canonical host-system type variable, 'host', and its three dnl individual parts 'host_cpu', 'host_vendor', and 'host_os'. -dnl AC_CANONICAL_HOST +AC_CANONICAL_HOST dnl Runs many macros required for proper operation of the generated Makefiles. dnl see http://sources.redhat.com/automake/automake.html#Options for options @@ -123,6 +123,11 @@ dnl AC_DEFINE writes values in config.h dnl AC_DEFINE_UNQUOTED performs additional shell expansions, e.g. substitution dnl of variable with value. + +AS_IF([test "$host_os" = "mingw32"], [ + CXXFLAGS="$CXXFLAGS -mwin32" +]) + ENABLE_AUTO([all], [all renderers (use --enable-xyz to re-enable certain renderers)], [ @@ -496,6 +501,9 @@ ENABLE_FORCED([gui], [graphical user interface (using Qt)], AC_CHECK_HEADER([OpenGL/glu.h], , [have_gui=no]) LIBS="$LIBS -framework OpenGL" ]) + AS_IF([test "$host_os" = "mingw32"], [ + LIBS="$LIBS -lglu32 -lopengl32" + ]) AC_SEARCH_LIBS([gluNewQuadric], [GLU], , [have_gui=no]) # on some systems this is needed, on the others it doesn't hurt: AC_SEARCH_LIBS([glSelectBuffer], [GL], , [have_gui=no]) @@ -562,6 +570,13 @@ ENABLE_AUTO([fudi-interface], [FUDI interface (needs Asio and {fmt})], [have_fudi_interface=no]) ]) +AS_IF([test "$host_os" = "mingw32"], [ + AS_IF([test x$have_ip_interface = xyes -o x$have_websocket_interface = xyes -o x$have_fudi_interface = xyes], +[ + LIBS="$LIBS -lws2_32 -lwsock32" + ]) +]) + ENABLE_FORCED([ecasound], [Ecasound soundfile playback/recording], [ dnl Checking for libecasoundc. It does not provide pkg-config and installs @@ -731,14 +746,14 @@ ENABLE_EXPLICIT([windows-installer], [creation of an installer for Windows], AC_CHECK_PROG([have_nsis], [nsis], [yes], [no]) AC_CHECK_PROG([have_windeployqt], [windeployqt], [yes], [no]) AS_IF([test x$enable_windows_installer = xyes -o x$enable_windows_installer = x], - [WINDOWS_INSTALLER=SoundScapeRenderer-$PACKAGE_VERSION], + [WINDOWS_INSTALLER="SoundScape Renderer $PACKAGE_VERSION Installer"], [WINDOWS_INSTALLER=$enable_windows_installer]) dnl WARNING: any user-specified --prefix, --bindir, ... is overwritten! dnl however, it can still be specified at make time (although kinda useless)! prefix=$(pwd)/windows-installer docdir=\${prefix}/Documentation - pkgdatadir=\${prefix}/PkgData + pkgdatadir=\${prefix}/data ]) ENABLE_AUTO([browser-gui], [creation of HTML/JavaScript files for browser GUI], @@ -772,7 +787,8 @@ AC_SUBST(DEBUGGING_FLAGS) dnl List of output files generated by AC_OUTPUT from their respective *.in files AC_CONFIG_FILES([Makefile src/Makefile man/Makefile browser-gui/Makefile]) -AC_CONFIG_FILES([tests/Makefile data/Makefile data/nsis/Makefile]) +AC_CONFIG_FILES([tests/Makefile data/Makefile]) +AC_CONFIG_FILES([data/nsis/Makefile data/nsis/installer-script.nsi]) dnl AC_OUTPUT should be the last command (except maybe some status messages) dnl It generates and runs config.status, which in turn creates the Makefiles and diff --git a/data/nsis/Makefile.am b/data/nsis/Makefile.am index 1ce6f5fc..81128a31 100644 --- a/data/nsis/Makefile.am +++ b/data/nsis/Makefile.am @@ -19,10 +19,12 @@ install-exec-hook: ## those are copied by windeployqt, but they are not needed: $(RM) -r $(DESTDIR)$(bindir)/styles $(RM) -r $(DESTDIR)$(bindir)/imageformats +## this is assumed to be available on the target system: + $(RM) -r $(DESTDIR)$(bindir)/libjack*.dll # create Windows installer nsis: - @echo "TODO: run NSIS!" + cd $(DESTDIR)$(prefix) && MakeNSIS.exe -NOCD $(abs_builddir)/installer-script.nsi .PHONY: nsis diff --git a/data/nsis/installer-script.nsi.in b/data/nsis/installer-script.nsi.in new file mode 100644 index 00000000..a5f03cb8 --- /dev/null +++ b/data/nsis/installer-script.nsi.in @@ -0,0 +1,57 @@ +# https://nsis.sourceforge.io/Docs/ + +!define APPNAME "SoundScape Renderer @PACKAGE_VERSION@" + +Name "${APPNAME}" + +OutFile "@WINDOWS_INSTALLER@.exe" + +InstallDir "$PROGRAMFILES64\${APPNAME}" + +SetCompressor lzma + +#Page license +#Page components +Page directory +Page instfiles + +UninstPage uninstConfirm +UninstPage instfiles + +Section "Everything" + SetOutPath $INSTDIR + + File /r ".\bin" + File /r ".\data" + + WriteUninstaller "$INSTDIR\uninstall.exe" + + # Set the working directory of the following Start Menu shortcuts: + SetOutPath "$INSTDIR\bin" + + CreateDirectory "$SMPROGRAMS\${APPNAME}" + CreateShortcut "$SMPROGRAMS\${APPNAME}\ssr-binaural.lnk" "cmd" "/k ssr-binaural.exe" + CreateShortcut "$SMPROGRAMS\${APPNAME}\ssr-brs.lnk" "cmd" "/k ssr-brs.exe" + CreateShortcut "$SMPROGRAMS\${APPNAME}\ssr-wfs.lnk" "cmd" "/k ssr-wfs.exe" + CreateShortcut "$SMPROGRAMS\${APPNAME}\ssr-vbap.lnk" "cmd" "/k ssr-vbap.exe" + CreateShortcut "$SMPROGRAMS\${APPNAME}\ssr-aap.lnk" "cmd" "/k ssr-aap.exe" + CreateShortcut "$SMPROGRAMS\${APPNAME}\ssr-dca.lnk" "cmd" "/k ssr-dca.exe" + CreateShortcut "$SMPROGRAMS\${APPNAME}\ssr-generic.lnk" "cmd" "/k ssr-generic.exe" + CreateShortcut "$SMPROGRAMS\${APPNAME}\uninstall.lnk" "$INSTDIR\uninstall.exe" + + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \ + "DisplayName" "${APPNAME}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \ + "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" +SectionEnd + +Section "Uninstall" + RMDir /r "$INSTDIR\bin" + RMDir /r "$INSTDIR\data" + Delete "$INSTDIR\uninstall.exe" + RMDir $INSTDIR + + RMDir /r "$SMPROGRAMS\${APPNAME}" + + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" +SectionEnd diff --git a/src/Makefile.am b/src/Makefile.am index b4b4d045..dbfe92a7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,7 +26,7 @@ AM_CPPFLAGS += -I$(srcdir)/../gml/include AM_CPPFLAGS += -I$(srcdir)/../rapidjson/include if ENABLE_WINDOWS_INSTALLER -AM_CPPFLAGS += -DSSR_DATA_DIR=\"../PkgData\" +AM_CPPFLAGS += -DSSR_DATA_DIR=\"../data\" else AM_CPPFLAGS += -DSSR_DATA_DIR="\"$(pkgdatadir)\"" endif