forked from EigenlightArts/HEXES
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.nims
43 lines (37 loc) · 1.74 KB
/
config.nims
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os, strutils
import natu/config
import std/algorithm
const main = "./source/HEXES.nim" # path to project file
const name = splitFile(main).name # name of ROM
put "natu.gameTitle", "HEXES" # max 12 chars, uppercase
put "natu.gameCode", "HEXS" # 4 chars, see GBATEK for info
if projectPath() == thisDir() / main:
# This runs only when compiling the project file:
gbaCfg() # set C compiler + linker options for GBA target
switch "os", "standalone"
switch "gc", "arc"
switch "define", "useMalloc"
switch "define", "noSignalHandler"
switch "checks", "on" # toggle assertions, bounds checking, etc.
switch "overflowChecks", "off" # integer overflow (e.g. with a scrolling background)
switch "path", projectDir() # allow imports relative to the main file
switch "header" # output "{project}.h"
switch "nimcache", "nimcache" # output C sources to local directory
switch "cincludes", nimcacheDir() # allow external C files to include "{project}.h"
switch "linedir", "on" # get Nim stack traces instead of C
# warning "UnusedImport", off # ignore unused import warnings, FIXME(Kal): remove after going to final stages of production
task assets, "convert assets":
gfxConvert "graphics.nims"
bgConvert "backgrounds.nims"
mmConvert "audio.nims"
task build, "builds the GBA rom":
let args = commandLineParams()[1..^1].join(" ")
assetsTask()
selfExec "c " & args & " -o:" & name & ".elf " & thisDir() / main
gbaStrip name & ".elf", name & ".gba"
gbaFix name & ".gba"
task clean, "removes build files":
rmDir "nimcache"
rmFile name & ".gba"
rmFile name & ".elf"
rmFile name & ".elf.map"