Skip to content

Commit

Permalink
Add first version of a Windows installer
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Nov 21, 2024
1 parent b1f198a commit b2b4dd2
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 12 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/windows-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
24 changes: 20 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)],
[
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion data/nsis/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
57 changes: 57 additions & 0 deletions data/nsis/installer-script.nsi.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# https://nsis.sourceforge.io/Docs/

!define APPNAME "SoundScape Renderer @PACKAGE_VERSION@"

Name "${APPNAME}"

OutFile "@[email protected]"

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
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b2b4dd2

Please sign in to comment.