From 8cf4100c871b83e1f55d431ec22b3425a99e2660 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 22 Dec 2020 22:52:28 -0500 Subject: [PATCH] meson: fix resource file compilation This enables video to load correctly in Windows builds --- src/meson.build | 27 +++++++++++++++++++++++++++ src/res/res.rc | 20 +++----------------- tools/version.ps1 | 4 ++-- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/meson.build b/src/meson.build index 29dfe2169..90c981792 100644 --- a/src/meson.build +++ b/src/meson.build @@ -188,6 +188,33 @@ elif host_machine.system() == 'windows' else error('Missing Windows SDK Uniscribe Library (usp10.h / usp10.lib)') endif + + res_inc = include_directories('bitmaps/windows') + res_dep_files = files( + 'bitmaps/windows/icon.ico', + 'bitmaps/windows/eyedropper.cur', + ) + windows = import('windows') + if wx_dep.type_name() != 'not-found' # system wx + raw_wx_windres_args = wx_dep.get_variable(configtool: 'rescomp').split() + wx_windres_args = [] + foreach arg: raw_wx_windres_args + if arg != 'windres' + wx_windres_args += arg + endif + endforeach + aegisub_src += windows.compile_resources('res/res.rc', + args: wx_windres_args, + depend_files: res_dep_files, + depends: version_h, + include_directories: [res_inc, version_inc]) + else # subproject + wx_inc = wx.include_directories('wxmono') + aegisub_src += windows.compile_resources('res/res.rc', + depend_files: res_dep_files, + depends: version_h, + include_directories: [res_inc, version_inc, wx_inc]) + endif elif conf.get('WITH_FONTCONFIG') == '1' aegisub_src += 'font_file_lister_fontconfig.cpp' endif diff --git a/src/res/res.rc b/src/res/res.rc index 45616b8cb..26f268165 100644 --- a/src/res/res.rc +++ b/src/res/res.rc @@ -23,23 +23,9 @@ eyedropper_cursor CURSOR "../bitmaps/windows/eyedropper.cur" #define wxUSE_NO_MANIFEST 1 #include "wx/msw/wx.rc" -#include "../../build/git_version.h" +#include "git_version.h" #include -#ifdef _DEBUG - #ifdef _WIN64 - #define AGI_RC_FILENAME "aegisub64d" - #else - #define AGI_RC_FILENAME "aegisub32d" - #endif -#else - #ifdef _WIN64 - #define AGI_RC_FILENAME "aegisub64" - #else - #define AGI_RC_FILENAME "aegisub32" - #endif -#endif - #ifdef _DEBUG #define AGI_RC_FLAG_DEBUG VS_FF_DEBUG #else @@ -68,8 +54,8 @@ BEGIN VALUE "CompanyName", "Aegisub" VALUE "FileDescription", "Aegisub subtitle editor" VALUE "FileVersion", BUILD_GIT_VERSION_STRING - VALUE "InternalName", AGI_RC_FILENAME - VALUE "OriginalFilename", AGI_RC_FILENAME ".exe" + VALUE "InternalName", "aegisub" + VALUE "OriginalFilename", "aegisub.exe" VALUE "ProductName", "Aegisub" VALUE "ProductVersion", BUILD_GIT_VERSION_STRING END diff --git a/tools/version.ps1 b/tools/version.ps1 index 13e51b4f2..7a05b7bf5 100644 --- a/tools/version.ps1 +++ b/tools/version.ps1 @@ -62,7 +62,7 @@ if ($exactGitTag -match $semVerMatch) { $tag = git -C $repositoryRootPath describe --exact-match --tags $rev 2>$null if ($tag -match $semVerMatch) {# $version['TAGGED_RELEASE'] = $false - $version['RESOURCE_BASE_VERSION'] = $Matches[1..3] + $gitRevision + $version['RESOURCE_BASE_VERSION'] = $Matches[1..3] $version['INSTALLER_VERSION'] = ($Matches[1..3] -join '.') break; } @@ -85,5 +85,5 @@ $version.GetEnumerator() | %{ {"`"$($value.ToString())`""} } } - "#define $($_.Key) $($fmtValue)" + "`n#define $($_.Key) $($fmtValue)" } | Out-File -FilePath $gitVersionHeaderPath -Encoding utf8