Mercurial > games > semicongine
annotate config.nims @ 496:b41733878bc6
add: support for instance data
author | Sam <sam@basx.dev> |
---|---|
date | Mon, 16 Jan 2023 00:35:41 +0700 |
parents | 0c18638c7217 |
children | 2979b69eef55 |
rev | line source |
---|---|
494
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
1 import std/strformat |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
2 import std/strutils |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
3 import std/os |
479 | 4 |
494
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
5 const BUILDBASE = "build" |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
6 const DEBUG = "debug" |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
7 const RELEASE = "release" |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
8 const LINUX = "linux" |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
9 const WINDOWS = "windows" |
479 | 10 |
11 proc compilerFlags() = | |
12 switch("path", "src") | |
13 switch("mm", "orc") | |
14 switch("experimental", "strictEffects") | |
15 switch("threads", "on") | |
16 switch("app", "gui") | |
17 | |
18 proc compilerFlagsDebug() = | |
19 switch("debugger", "native") | |
20 switch("checks", "on") | |
21 switch("assertions", "on") | |
22 | |
23 proc compilerFlagsRelease() = | |
24 switch("define", "release") | |
25 switch("checks", "off") | |
26 switch("assertions", "off") | |
27 | |
494
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
28 task single_linux_debug, "build linux debug": |
482
1670f8e70964
add: clean examples, update build configs
Sam <sam@basx.dev>
parents:
480
diff
changeset
|
29 compilerFlags() |
479 | 30 compilerFlagsDebug() |
494
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
31 switch("outdir", BUILDBASE / DEBUG / LINUX) |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
32 setCommand "c" |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
33 mkDir(BUILDBASE / DEBUG / LINUX) |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
34 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
35 task single_linux_release, "build linux release": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
36 compilerFlags() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
37 compilerFlagsRelease() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
38 switch("outdir", BUILDBASE / RELEASE / LINUX) |
479 | 39 setCommand "c" |
494
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
40 mkDir(BUILDBASE / RELEASE / LINUX) |
479 | 41 |
494
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
42 task single_windows_debug, "build windows debug": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
43 compilerFlags() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
44 compilerFlagsDebug() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
45 # for some the --define:mingw does not work from inside here... |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
46 # so we need to set it when calling the task and use "/" to prevent |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
47 # the use of backslash while crosscompiling |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
48 switch("define", "mingw") |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
49 switch("outdir", BUILDBASE & "/" & DEBUG & "/" & WINDOWS) |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
50 setCommand "c" |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
51 mkDir(BUILDBASE & "/" & DEBUG & "/" & WINDOWS) |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
52 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
53 task single_windows_release, "build windows release": |
482
1670f8e70964
add: clean examples, update build configs
Sam <sam@basx.dev>
parents:
480
diff
changeset
|
54 compilerFlags() |
479 | 55 compilerFlagsRelease() |
494
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
56 switch("outdir", BUILDBASE & "/" & RELEASE & "/" & WINDOWS) |
483
73a0954beabd
did: improve alotof_triangles example, remove glslang lib, use only binary, easier cross-compilation
Sam <sam@basx.dev>
parents:
482
diff
changeset
|
57 switch("define", "mingw") |
482
1670f8e70964
add: clean examples, update build configs
Sam <sam@basx.dev>
parents:
480
diff
changeset
|
58 setCommand "c" |
494
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
59 mkDir(BUILDBASE & "/" & RELEASE & "/" & WINDOWS) |
482
1670f8e70964
add: clean examples, update build configs
Sam <sam@basx.dev>
parents:
480
diff
changeset
|
60 |
494
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
61 task build_all_linux_debug, "build all examples with linux/debug": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
62 for file in listFiles("examples"): |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
63 if file.endsWith(".nim"): |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
64 selfExec(&"single_linux_debug {file}") |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
65 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
66 task build_all_linux_release, "build all examples with linux/release": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
67 for file in listFiles("examples"): |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
68 if file.endsWith(".nim"): |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
69 selfExec(&"single_linux_release {file}") |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
70 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
71 task build_all_windows_debug, "build all examples with windows/debug": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
72 for file in listFiles("examples"): |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
73 if file.endsWith(".nim"): |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
74 exec(&"nim single_windows_debug --define:mingw {file}") |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
75 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
76 task build_all_windows_release, "build all examples with windows/release": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
77 for file in listFiles("examples"): |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
78 if file.endsWith(".nim"): |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
79 exec(&"nim single_windows_release --define:mingw {file}") |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
80 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
81 task build_all_debug, "build all examples with */debug": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
82 build_all_linux_debugTask() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
83 build_all_windows_debugTask() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
84 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
85 task build_all_release, "build all examples with */release": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
86 build_all_linux_releaseTask() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
87 build_all_windows_releaseTask() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
88 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
89 task build_all_linux, "build all examples with linux/*": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
90 build_all_linux_debugTask() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
91 build_all_linux_releaseTask() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
92 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
93 task build_all_windows, "build all examples with windows/*": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
94 build_all_windows_debugTask() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
95 build_all_windows_releaseTask() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
96 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
97 task build_all, "build all examples": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
98 build_all_linuxTask() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
99 build_all_windowsTask() |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
100 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
101 task clean, "remove all build files": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
102 exec(&"rm -rf {BUILDBASE}") |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
103 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
104 task publish, "publish all build": |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
105 exec("rsync -rv build/ basx.dev:/var/www/public.basx.dev/zamikongine") |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
106 |
0c18638c7217
did: refactoring, move more from make to nimscript
Sam <sam@basx.dev>
parents:
485
diff
changeset
|
107 |
496 | 108 if getCommand() in ["c", "compile", "r", "dump", "check"]: |
482
1670f8e70964
add: clean examples, update build configs
Sam <sam@basx.dev>
parents:
480
diff
changeset
|
109 compilerFlags() |