diff config.nims @ 46:9e81f06a5c57

add: some changes to build on windows host
author Sam <sam@basx.dev>
date Thu, 19 Jan 2023 00:42:40 +0700
parents 5a6aadf6c464
children 4c3891eb9ef9
line wrap: on
line diff
--- a/config.nims	Thu Jan 19 00:41:41 2023 +0700
+++ b/config.nims	Thu Jan 19 00:42:40 2023 +0700
@@ -42,22 +42,26 @@
 task single_windows_debug, "build windows debug":
   compilerFlags()
   compilerFlagsDebug()
-  # for some the --define:mingw does not work from inside here...
-  # so we need to set it when calling the task and use "/" to prevent
-  # the use of backslash while crosscompiling
-  switch("define", "mingw")
   switch("outdir", BUILDBASE & "/" & DEBUG & "/" & WINDOWS)
   setCommand "c"
   mkDir(BUILDBASE & "/" & DEBUG & "/" & WINDOWS)
 
+
 task single_windows_release, "build windows release":
   compilerFlags()
   compilerFlagsRelease()
   switch("outdir", BUILDBASE & "/" & RELEASE & "/" & WINDOWS)
-  switch("define", "mingw")
   setCommand "c"
   mkDir(BUILDBASE & "/" & RELEASE & "/" & WINDOWS)
 
+task single_crosscompile_windows_debug, "build crosscompile windows debug":
+  switch("define", "mingw")
+  single_windows_debugTask()
+
+task single_crosscompile_windows_release, "build crosscompile windows release":
+  switch("define", "mingw")
+  single_windows_releaseTask()
+
 task build_all_linux_debug, "build all examples with linux/debug":
   for file in listFiles("examples"):
     if file.endsWith(".nim"):
@@ -120,9 +124,6 @@
   exec &"mv {dirname}/bin/glslangValidator.exe examples/"
   exec &"rm -rf {dirname}"
 
-if getCommand() in ["c", "compile", "r", "dump", "check", "idetools"]:
-  compilerFlags()
-
 task run_all , "Run all binaries":
   for file in listFiles("build/debug/linux"):
     exec file
@@ -132,3 +133,6 @@
     exec &"wine {file}"
   for file in listFiles("build/release/windows"):
     exec &"wine {file}"
+
+if getCommand() in ["c", "compile", "r", "dump", "check", "idetools"]:
+  compilerFlags()