Write file descriptions to .exe files for the Windows task manager.
authorCarl Hetherington <cth@carlh.net>
Sun, 28 Apr 2024 18:34:52 +0000 (20:34 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 28 Apr 2024 20:40:05 +0000 (22:40 +0200)
DEVELOP.md
src/tools/wscript

index e36c5260ebbe28a08bb13b56bc3e6f372d30adca..5c16c6a1879b3b382b1b341b8bdb80d45cac7e44 100644 (file)
@@ -126,7 +126,7 @@ Files to edit:
 - `cscript`
 - `wscript`
 - `src/lib/variant.cc`
+- `src/tools/wscript`
 - `platform/osx/make_dmg.sh`
 - `platform/windows/wscript`
 - `platform/osx/wscript`
-
index d23b6e16111bdc2a277c9729d352ab4c312e9d60..2188e5debc48637f52d62f5590cb47cf5f6965b7 100644 (file)
@@ -22,7 +22,21 @@ import glob
 from waflib import Logs
 import i18n
 
-def make_rc(tool, icon):
+
+def description(tool, variant):
+    descriptions = {
+        'dcpomatic': 'DCP-o-matic',
+        'dcpomatic_batch': 'DCP-o-matic Batch Converter',
+        'dcpomatic_server': 'DCP-o-matic Encode Server',
+        'dcpomatic_kdm': 'DCP-o-matic KDM Creator',
+        'dcpomatic_player': 'DCP-o-matic Player',
+        'dcpomatic_playlist': 'DCP-o-matic Playlist Editor',
+        'dcpomatic_combiner': 'DCP-o-matic Combiner',
+    }
+    return descriptions[tool] if tool in descriptions else tool
+
+
+def make_rc(tool, icon, variant):
     filename = f'build/src/tools/{tool}.rc'
     with open(filename, 'w') as rc:
         if tool == 'dcpomatic_disk_writer':
@@ -43,8 +57,35 @@ def make_rc(tool, icon):
     </trustInfo>
 </assembly>""", file=manifest)
         else:
-            print(f'id ICON "../../graphics/windows/{icon}"', file=rc)
-            print('#include "wx-3.1/wx/msw/wx.rc"', file=rc)
+            print(f"""
+id ICON "../../graphics/windows/{icon}"
+#include "wx-3.1/wx/msw/wx.rc"'
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION    0,0,0,2
+ PRODUCTVERSION 0,0,0,2
+ FILEFLAGSMASK 0x3fL
+ #ifdef _DEBUG
+ FILEFLAGS 0x1L
+ #else
+ FILEFLAGS 0x0L
+ #endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+{{
+    BLOCK "StringFileInfo"
+    {{
+        BLOCK "040904b0"
+        {{
+            VALUE "FileDescription", "{description(tool, variant)}\\0"
+        }}
+    }}
+    BLOCK "VarFileInfo"
+    {{
+        VALUE "Translation", 0x409, 1200
+    }}
+}}
+    """, file=rc)
     return filename
 
 def configure(conf):
@@ -83,7 +124,7 @@ def build(bld):
         obj.use    = ['libdcpomatic2']
         obj.source = '%s.cc' % t
         if (bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32) and t == 'dcpomatic_disk_writer':
-            obj.source += f' ../../{make_rc(t, None)}'
+            obj.source += f' ../../{make_rc(t, None, bld.env.VARIANT)}'
             # Prevent a console window opening when we start dcpomatic2_disk_writer
             obj.env.append_value('LINKFLAGS', '-Wl,-subsystem,windows')
         obj.target = t.replace('dcpomatic', 'dcpomatic2')
@@ -120,7 +161,7 @@ def build(bld):
         obj.use    = ['libdcpomatic2', 'libdcpomatic2-wx']
         obj.source = '%s.cc' % t
         if bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32:
-            obj.source += f' ../../{make_rc(t, t.replace("dcpomatic", "dcpomatic2") + ".ico")}'
+            obj.source += f' ../../{make_rc(t, t.replace("dcpomatic", "dcpomatic2") + ".ico", bld.env.VARIANT)}'
         obj.target = t.replace('dcpomatic', 'dcpomatic2')
 
     i18n.po_to_mo(os.path.join('src', 'tools'), 'dcpomatic2', bld)