view config.nims @ 483:73a0954beabd

did: improve alotof_triangles example, remove glslang lib, use only binary, easier cross-compilation
author Sam <sam@basx.dev>
date Wed, 11 Jan 2023 00:43:17 +0700
parents 1670f8e70964
children 71bbe11d8de8
line wrap: on
line source

import os

const buildbase = "build"

proc compilerFlags() =
  switch("path", "src")
  switch("mm", "orc")
  switch("experimental", "strictEffects")
  switch("threads", "on")
  switch("app", "gui")

proc compilerFlagsDebug() =
  switch("debugger", "native")
  switch("checks", "on")
  switch("assertions", "on")

proc compilerFlagsRelease() =
  switch("define", "release")
  switch("checks", "off")
  switch("assertions", "off")

proc compilerFlagsDebugWindows() =
  switch("cc", "vcc")
  switch("passC", "/MDd")
  switch("passL", "ucrtd.lib")

proc compilerFlagsReleaseWindows() =
  switch("cc", "vcc")
  switch("passC", "/MD")
  switch("passL", "ucrt.lib")

task build_linux_debug, "build linux debug":
  compilerFlags()
  compilerFlagsDebug()
  buildbase.joinPath("debug/linux").mkDir()
  setCommand "c"

task build_linux_release, "build linux release":
  compilerFlags()
  compilerFlagsRelease()
  buildbase.joinPath("release/linux").mkDir()
  setCommand "c"

task build_windows_debug, "build windows debug":
  compilerFlags()
  compilerFlagsDebug()
  # compilerFlagsDebugWindows()
  switch("define", "mingw")
  buildbase.joinPath("debug/windows").mkDir()
  setCommand "c"

task build_windows_release, "build windows release":
  compilerFlags()
  compilerFlagsRelease()
  # compilerFlagsReleaseWindows()
  switch("define", "mingw")
  buildbase.joinPath("release/windows").mkDir()
  setCommand "c"

compilerFlags()