-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.nims
More file actions
88 lines (79 loc) · 2.85 KB
/
Copy pathconfig.nims
File metadata and controls
88 lines (79 loc) · 2.85 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import os, strformat, strutils
const RootDir = thisDir()
switch("path", RootDir & "/src")
switch("path", RootDir & "/../mummy/src")
switch("path", RootDir & "/../paddy/src")
switch("path", RootDir & "/../whisky/src")
when defined(profileTracePath):
switch("path", RootDir & "/../fluffy/src")
switch("outdir", thisDir() & "/out")
when defined(emscripten):
const OutputDir = RootDir / "among_them" / "emscripten"
if not dirExists(OutputDir):
mkDir(OutputDir)
switch("nimcache", OutputDir / "tmp")
switch("threads", "off")
--os:linux
--cpu:wasm32
--cc:clang
when defined(windows):
--clang.exe:emcc.bat
--clang.linkerexe:emcc.bat
--clang.cpp.exe:emcc.bat
--clang.cpp.linkerexe:emcc.bat
else:
--clang.exe:emcc
--clang.linkerexe:emcc
--clang.cpp.exe:emcc
--clang.cpp.linkerexe:emcc
--listCmd
--gc:arc
--exceptions:goto
--define:noSignalHandler
--debugger:native
--define:noAutoGLerrorCheck
--define:release
# Nim's bundled allocator corrupts the heap under emscripten/wasm32: with
# ALLOW_MEMORY_GROWTH it hands out overlapping blocks, overwriting live data
# (found in coworld-ctf's replay viewer as spurious hash-mismatch banners,
# frozen playback, and OOB/RangeDefect crashes). Route every allocation
# through emscripten's malloc instead.
--define:useMalloc
switch(
"passL",
(&"""
-o {OutputDir / projectName()}.html
--preload-file {RootDir / "client" / "data"}@client/data
--preload-file {RootDir / "client" / "dist"}@client/dist
--preload-file {RootDir / "among_them" / "map.json"}@among_them/map.json
--preload-file {RootDir / "among_them" / "skeld2.aseprite"}@among_them/skeld2.aseprite
--preload-file {RootDir / "among_them" / "spritesheet.aseprite"}@among_them/spritesheet.aseprite
--preload-file {RootDir / "among_them" / "ascii.png"}@among_them/ascii.png
--preload-file {RootDir / "among_them" / "darkbg.aseprite"}@among_them/darkbg.aseprite
--preload-file {RootDir / "among_them" / "tiny5.aseprite"}@among_them/tiny5.aseprite
--shell-file {OutputDir / "shell.html"}
-s ASYNCIFY
-s FETCH
-s USE_WEBGL2=1
-s MAX_WEBGL_VERSION=2
-s MIN_WEBGL_VERSION=1
-s FULL_ES3=1
-s GL_ENABLE_GET_PROC_ADDRESS=1
-s ALLOW_MEMORY_GROWTH
""").replace("\n", " ")
)
if paramStr(1) == "run" or paramStr(1) == "r":
setCommand("c")
echo "To run emscripten, use:"
echo "emrun " & OutputDir / (projectName() & ".html")
else:
switch("nimcache", getCurrentDir() & "/nimcache")
switch("threads", "on")
switch("mm", "orc")
when not defined(debug):
--define:release
--define:noAutoGLerrorCheck
# std/net dlopens libssl on first SSL use, so this is free for binaries
# that don't actually open TLS connections — but it's required for any
# that do (wss:// for the bots, https:// for italkalot's OpenAI calls).
--define:ssl