diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index b9a6aae7..4ce39e3d 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -82,9 +82,20 @@ jobs:
find $BUILD_PREFIX/lib/clapper-0.0/ -name '*\.dll' -type f -exec ldd "{}" \; | grep '\/mingw.*\.dll' -o | xargs -I{} cp -n "{}" $BUILD_PREFIX/bin
find $BUILD_PREFIX/lib/gstreamer-1.0/ -name '*\.dll' -type f -exec ldd "{}" \; | grep '\/mingw.*\.dll' -o | xargs -I{} cp -n "{}" $BUILD_PREFIX/bin
find $BUILD_PREFIX/lib/gio/ -name '*\.dll' -type f -exec ldd "{}" \; | grep '\/mingw.*\.dll' -o | xargs -I{} cp -n "{}" $BUILD_PREFIX/bin
+ - name: Cleanup
+ run: |
+ BUILD_PREFIX="$GITHUB_WORKSPACE/clapper-win-${{ matrix.arch }}"
+
+ rm -rf $BUILD_PREFIX/include
+ rm -rf $BUILD_PREFIX/lib/pkgconfig
+ - name: Installer
+ uses: Minionguyjpro/Inno-Setup-Action@v1.2.5
+ with:
+ path: builddir/pkgs/windows-installer/clapper.iss
+ options: /O+
- name: Upload
uses: actions/upload-artifact@v4
with:
name: clapper-win-${{ matrix.arch }}
- path: clapper-win-${{ matrix.arch }}
+ path: builddir/pkgs/windows-installer/InstallerOutput/Clapper*.exe
if-no-files-found: error
diff --git a/meson.build b/meson.build
index 1d5298f3..c5e7a9dc 100644
--- a/meson.build
+++ b/meson.build
@@ -130,6 +130,7 @@ endif
subdir('src')
subdir('doc')
+subdir('pkgs')
meson.add_devenv(devenv)
diff --git a/pkgs/meson.build b/pkgs/meson.build
new file mode 100644
index 00000000..a44c9a8f
--- /dev/null
+++ b/pkgs/meson.build
@@ -0,0 +1,5 @@
+is_windows = ['windows'].contains(host_machine.system())
+
+if is_windows
+ subdir('windows-installer')
+endif
diff --git a/pkgs/windows-installer/clapper.iss.in b/pkgs/windows-installer/clapper.iss.in
new file mode 100644
index 00000000..79e6d768
--- /dev/null
+++ b/pkgs/windows-installer/clapper.iss.in
@@ -0,0 +1,31 @@
+[Setup]
+AppName=Clapper
+AppVersion=@CLAPPER_APP_VERSION@
+AppVerName=Clapper @CLAPPER_APP_VERSION@
+VersionInfoVersion=@CLAPPER_APP_VERSION@.0
+ArchitecturesAllowed=x64compatible
+ArchitecturesInstallIn64BitMode=x64compatible
+WizardStyle=modern
+DefaultDirName={autopf}\Clapper
+DefaultGroupName=Clapper
+DisableProgramGroupPage=yes
+ChangesAssociations=yes
+Compression=lzma2
+SolidCompression=yes
+OutputDir=InstallerOutput
+OutputBaseFilename=Clapper_@CLAPPER_APP_VERSION@
+SetupIconFile=@PROJECT_ROOT@\src\bin\clapper-app\windows\clapper.ico
+LicenseFile=@PROJECT_ROOT@\COPYING-GPL
+
+[Tasks]
+Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
+
+[Files]
+Source: "@CLAPPER_APP_DEST@\*"; DestDir: "{app}"; Flags: recursesubdirs replacesameversion
+
+[Icons]
+Name: "{autoprograms}\Clapper"; Filename: "{app}\bin\clapper.exe"
+Name: "{autodesktop}\Clapper"; Filename: "{app}\bin\clapper.exe"; Tasks: desktopicon
+
+[Registry]
+@CLAPPER_APP_REG_ENTRIES@
diff --git a/pkgs/windows-installer/meson.build b/pkgs/windows-installer/meson.build
new file mode 100644
index 00000000..cd2a59c8
--- /dev/null
+++ b/pkgs/windows-installer/meson.build
@@ -0,0 +1,44 @@
+# Same as "clapper-app-utils.c"
+# FIXME: Have these in one place only
+win_extensions = [
+ 'avi', 'claps', 'm2ts', 'mkv', 'mov',
+ 'mp4', 'webm', 'wmv'
+]
+reg_entries = []
+
+foreach ext : win_extensions
+ ext_id = 'Clapper.' + ext
+ exe_path = '{app}\\bin\\clapper.exe'
+
+ subkey = 'Software\\Classes\\.' + ext + '\\OpenWithProgids'
+ reg_entries += 'Root: HKA; Subkey: "@0@"; ValueType: string; ValueName: "@1@"; ValueData: ""; Flags: uninsdeletevalue'.format(subkey, ext_id)
+
+ subkey = 'Software\\Classes\\' + ext_id
+ reg_entries += 'Root: HKA; Subkey: "@0@"; ValueType: string; ValueName: ""; ValueData: "@1@"; Flags: uninsdeletekey'.format(subkey, ext)
+
+ subkey = 'Software\\Classes\\' + ext_id + '\\DefaultIcon'
+ reg_entries += 'Root: HKA; Subkey: "@0@"; ValueType: string; ValueName: ""; ValueData: "@1@,0"'.format(subkey, exe_path)
+
+ subkey = 'Software\\Classes\\' + ext_id + '\\shell\\open\\command'
+ reg_entries += 'Root: HKA; Subkey: "@0@"; ValueType: string; ValueName: ""; ValueData: """@1@"" ""%1"""'.format(subkey, exe_path)
+
+ reg_entries += '' # Empty line for clarity
+endforeach
+
+# NOTE: In meson replacing "@@" vars after "\" sign does not work.
+# For this reason we do not pass app name here.
+iss_conf = configuration_data()
+iss_conf.set('CLAPPER_APP_VERSION', meson.project_version())
+iss_conf.set('CLAPPER_APP_REG_ENTRIES', '\n'.join(reg_entries))
+iss_conf.set('PROJECT_ROOT', meson.project_source_root())
+
+# NOTE: We also need to package other dependencies, hence using whole prefix.
+# Workaround to reduce package size is to set prefix to some custom dir, install,
+# then determine the rest with "ldd" and copy remaining files manually there.
+iss_conf.set('CLAPPER_APP_DEST', prefix.replace('/', '\\'))
+
+configure_file(
+ input: 'clapper.iss.in',
+ output: 'clapper.iss',
+ configuration: iss_conf,
+)
diff --git a/src/bin/clapper-app/clapper-app-utils.c b/src/bin/clapper-app/clapper-app-utils.c
index 202e4255..74b1308e 100644
--- a/src/bin/clapper-app/clapper-app-utils.c
+++ b/src/bin/clapper-app/clapper-app-utils.c
@@ -61,9 +61,10 @@ clapper_app_utils_win_enforce_hi_res_clock (void)
{
#ifdef HAVE_WIN_PROCESS_THREADS_API
PROCESS_POWER_THROTTLING_STATE PowerThrottling;
- RtlZeroMemory (&PowerThrottling, sizeof (PowerThrottling));
gboolean success;
+ RtlZeroMemory (&PowerThrottling, sizeof (PowerThrottling));
+
PowerThrottling.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
PowerThrottling.ControlMask = PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION;
PowerThrottling.StateMask = 0; // Always honor timer resolution requests
diff --git a/src/bin/clapper-app/meson.build b/src/bin/clapper-app/meson.build
index c63b5bb2..83f3946c 100644
--- a/src/bin/clapper-app/meson.build
+++ b/src/bin/clapper-app/meson.build
@@ -94,6 +94,7 @@ if is_windows
clapperapp_deps += winmm_dep
clapperapp_c_args += ['-DHAVE_WIN_TIME_API']
endif
+ subdir('windows')
endif
executable(
diff --git a/src/bin/clapper-app/windows/clapper.exe.manifest b/src/bin/clapper-app/windows/clapper.exe.manifest
new file mode 100644
index 00000000..0f4c5895
--- /dev/null
+++ b/src/bin/clapper-app/windows/clapper.exe.manifest
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
diff --git a/src/bin/clapper-app/windows/clapper.ico b/src/bin/clapper-app/windows/clapper.ico
new file mode 100644
index 00000000..61199159
Binary files /dev/null and b/src/bin/clapper-app/windows/clapper.ico differ
diff --git a/src/bin/clapper-app/windows/clapper.rc.in b/src/bin/clapper-app/windows/clapper.rc.in
new file mode 100644
index 00000000..037e077e
--- /dev/null
+++ b/src/bin/clapper-app/windows/clapper.rc.in
@@ -0,0 +1,56 @@
+/* Clapper Application
+ * Copyright (C) 2024 Rafał Dzięgiel
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+
+#define VER_CLAPPERVERSION @VER_CLAPPERVERSION@
+#define VER_NONE 0x0L
+
+MAIN_ICON ICON "clapper.ico"
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION VER_CLAPPERVERSION
+PRODUCTVERSION VER_CLAPPERVERSION
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+FILEFLAGS VER_NONE
+FILEOS VOS__WINDOWS32
+FILETYPE VFT_APP
+FILESUBTYPE VER_NONE
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "CompanyName", "Rafostar"
+ VALUE "FileDescription", @CLAPPER_APP_NAME@
+ VALUE "FileVersion", @PACKAGE_VERSION@
+ VALUE "InternalName", @PACKAGE@
+ VALUE "LegalCopyright", "Copyright (C) Rafal Dziegiel"
+ VALUE "OriginalFilename", @CLAPPER_EXE@
+ VALUE "ProductName", @CLAPPER_APP_NAME@
+ VALUE "ProductVersion", @PACKAGE_VERSION@
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
+
+#ifdef __MINGW32__
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "clapper.exe.manifest"
+#endif
diff --git a/src/bin/clapper-app/windows/meson.build b/src/bin/clapper-app/windows/meson.build
new file mode 100644
index 00000000..14bccb92
--- /dev/null
+++ b/src/bin/clapper-app/windows/meson.build
@@ -0,0 +1,20 @@
+rc_conf = configuration_data()
+rc_conf.set('VER_CLAPPERVERSION', clapper_version.replace('.', ',') + ',0')
+rc_conf.set_quoted('PACKAGE', meson.project_name())
+rc_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+rc_conf.set_quoted('PACKAGE_ORIGIN', 'https://github.com/Rafostar/clapper')
+rc_conf.set_quoted('CLAPPER_APP_NAME', 'Clapper')
+rc_conf.set_quoted('CLAPPER_EXE', meson.project_name() + '.exe')
+
+clapperapp_rc = configure_file(
+ input: 'clapper.rc.in',
+ output: 'clapper.rc',
+ configuration: rc_conf,
+)
+
+windres = find_program('windres', required: true)
+clapperapp_sources += custom_target('clapper.o',
+ input: clapperapp_rc,
+ output: 'clapper.o',
+ command: [windres, '-I', '@CURRENT_SOURCE_DIR@', '-o', '@OUTPUT@', '@INPUT@']
+)