Mercurial > games > semicongine
comparison semiconginev2/old/core/buildconfig.nim @ 1227:4d97cfc4888b
merge
| author | sam <sam@basx.dev> |
|---|---|
| date | Wed, 17 Jul 2024 23:45:43 +0700 |
| parents | 56781cc0fc7c |
| children |
comparison
equal
deleted
inserted
replaced
| 1170:2addc5f6804f | 1227:4d97cfc4888b |
|---|---|
| 1 import std/strutils | |
| 2 import std/logging | |
| 3 import std/os | |
| 4 | |
| 5 import ./constants | |
| 6 | |
| 7 # checks required build options: | |
| 8 static: | |
| 9 assert compileOption("threads"), ENGINENAME & " requires --threads=on" | |
| 10 assert defined(nimPreviewHashRef), ENGINENAME & " requires -d:nimPreviewHashRef" | |
| 11 | |
| 12 if defined(release) or defined(windows): | |
| 13 assert compileOption("app", "gui"), ENGINENAME & " requires --app=gui for release builds and all windows builds" | |
| 14 | |
| 15 | |
| 16 if defined(linux): | |
| 17 assert defined(VK_USE_PLATFORM_XLIB_KHR), ENGINENAME & " requires --d:VK_USE_PLATFORM_XLIB_KHR for linux builds" | |
| 18 elif defined(windows): | |
| 19 assert defined(VK_USE_PLATFORM_WIN32_KHR), ENGINENAME & " requires --d:VK_USE_PLATFORM_WIN32_KHR for windows builds" | |
| 20 else: | |
| 21 assert false, "trying to build on unsupported platform" | |
| 22 | |
| 23 # build configuration | |
| 24 # ===================== | |
| 25 | |
| 26 # compile-time defines, usefull for build-dependent settings | |
| 27 # can be overriden with compiler flags, e.g. -d:Foo=42 -d:Bar=false | |
| 28 # pramas: {.intdefine.} {.strdefine.} {.booldefine.} | |
| 29 | |
| 30 # root of where settings files will be searched | |
| 31 # must be relative (to the directory of the binary) | |
| 32 const DEBUG* {.booldefine.} = not defined(release) | |
| 33 const CONFIGROOT* {.strdefine.}: string = "." | |
| 34 assert not isAbsolute(CONFIGROOT) | |
| 35 | |
| 36 const CONFIGEXTENSION* {.strdefine.}: string = "ini" | |
| 37 | |
| 38 # by default enable hot-reload of runtime-configuration only in debug builds | |
| 39 const CONFIGHOTRELOAD* {.booldefine.}: bool = DEBUG | |
| 40 | |
| 41 # milliseconds to wait between checks for settings hotreload | |
| 42 const CONFIGHOTRELOADINTERVAL* {.intdefine.}: int = 1000 | |
| 43 | |
| 44 # log level | |
| 45 const LOGLEVEL {.strdefine.}: string = "Warn" | |
| 46 const ENGINE_LOGLEVEL* = parseEnum[Level]("lvl" & LOGLEVEL) | |
| 47 | |
| 48 # resource bundleing settings, need to be configured per project | |
| 49 const PACKAGETYPE* {.strdefine.}: string = "exe" # dir, zip, exe | |
| 50 static: | |
| 51 assert PACKAGETYPE in ["dir", "zip", "exe"], ENGINENAME & " requires one of -d:PACKAGETYPE=dir -d:PACKAGETYPE=zip -d:PACKAGETYPE=exe" |
