From 8a531f9d7468461a24f9ae8b244a115149be0b5c Mon Sep 17 00:00:00 2001
From: Dominic Canare <dom@dominiccanare.com>
Date: Thu, 28 Nov 2024 10:00:25 -0500
Subject: [PATCH] Adds missing windows dll

---
 deployment/pupil_core.spec | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/deployment/pupil_core.spec b/deployment/pupil_core.spec
index aff93189a..76a4bc86f 100644
--- a/deployment/pupil_core.spec
+++ b/deployment/pupil_core.spec
@@ -6,6 +6,7 @@ import pathlib
 import platform
 import sys
 from importlib.resources import files
+from pathlib import Path
 
 import PyInstaller
 from PyInstaller.utils.hooks import collect_all
@@ -68,10 +69,15 @@ def main():
         all_binaries.extend(binaries)
         all_hidden_imports.extend(hiddenimports)
 
+    runtime_hooks = []
     if current_platform == SupportedPlatform.linux:
-        runtime_hooks = ["runtime_hook_sounddevice.py"]
-    else:
-        runtime_hooks = []
+        runtime_hooks.append("runtime_hook_sounddevice.py")
+
+    elif current_platform == SupportedPlatform.windows:
+        import pyglui
+
+        pyglui_lib_path = str(Path(pyglui.__file__).parent) + '.libs'
+        all_binaries.append((os.path.join(pyglui_lib_path, 'msvcp140.dll'), 'pyglui.libs'))
 
     a = Analysis(
         ["../pupil_src/main.py"],