changeset 53:4c3891eb9ef9

add: improve build on windows
author Sam <sam@basx.dev>
date Thu, 19 Jan 2023 22:49:12 +0700
parents 5ab7fb4d9ee9
children a24c6b87ae83
files config.nims src/semicongine/platform/windows/win32.nim src/semicongine/shader.nim
diffstat 3 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/config.nims	Thu Jan 19 17:39:32 2023 +0700
+++ b/config.nims	Thu Jan 19 22:49:12 2023 +0700
@@ -108,6 +108,15 @@
 task publish, "publish all build":
   exec("rsync -rv build/ basx.dev:/var/www/public.basx.dev/semicongine")
 
+  for file in listFiles("build/debug/linux"):
+    exec(&"scp {file} sam@mail.basx.dev:/var/www/public.basx.dev/semicongine/debug/linux/")
+  for file in listFiles("build/release/linux"):
+    exec(&"scp {file} sam@mail.basx.dev:/var/www/public.basx.dev/semicongine/release/linux/")
+  for file in listFiles("build/debug/windows"):
+    exec(&"scp {file} sam@mail.basx.dev:/var/www/public.basx.dev/semicongine/debug/windows/")
+  for file in listFiles("build/release/windows"):
+    exec(&"scp {file} sam@mail.basx.dev:/var/www/public.basx.dev/semicongine/release/windows/")
+
 task glslangValidator, "Download glslangValidator (required for linux compilation)":
   let dirname="/tmp/glslang_download"
   exec &"mkdir -p {dirname}"
--- a/src/semicongine/platform/windows/win32.nim	Thu Jan 19 17:39:32 2023 +0700
+++ b/src/semicongine/platform/windows/win32.nim	Thu Jan 19 22:49:12 2023 +0700
@@ -75,7 +75,7 @@
       DWORD(0),
       windowClassName,
       windowName,
-      DWORD(WS_OVERLAPPEDWINDOW),
+      DWORD(WS_POPUP or WS_THICKFRAME or WS_SYSMENU or WS_MAXIMIZEBOX or WS_MINIMIZEBOX),
       CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
       HMENU(0),
       HINSTANCE(0),
@@ -100,5 +100,6 @@
   var msg: MSG
   # fill queue
   while PeekMessage(addr(msg), window.hwnd, 0, 0, PM_REMOVE):
+    TranslateMessage(addr(msg))
     DispatchMessage(addr(msg))
   return currentEvents
--- a/src/semicongine/shader.nim	Thu Jan 19 17:39:32 2023 +0700
+++ b/src/semicongine/shader.nim	Thu Jan 19 22:49:12 2023 +0700
@@ -45,8 +45,12 @@
   let (output, exitCode_glsl) = gorgeEx(command=fmt"{projectPath}/glslangValidator --entry-point {entrypoint} -V --stdin -S {stagename} -o {shaderfile}", input=shaderSource)
   if exitCode_glsl != 0:
     raise newException(Exception, output)
-  let shaderbinary = staticRead shaderfile
-  # removeFile(shaderfile) TODO: remove file at compile time?
+
+  when defined(mingw): # required for crosscompilation, path separators get messed up
+    let shaderbinary = staticRead shaderfile.replace("\\", "/")
+  else:
+    let shaderbinary = staticRead shaderfile
+  # removeFile(shaderfile) TODO: remove file at compile time? how to do in cross-platform consistent way?
 
   var i = 0
   while i < shaderbinary.len: