-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathxmake.lua
106 lines (98 loc) · 3.49 KB
/
xmake.lua
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
add_requires("sdl2", {system=true,optional=true})
add_requires("dl", {system=true,optional=true})
add_requires("pthread", {system=true,optional=true})
add_requires("x11", {system=true,optional=true})
add_requires("xext", {system=true,optional=true})
option("backend")
set_default("x11")
set_values("x11", "sdl2", "sdl2-core", "sdl2-core-wasm")
option_end()
target("meui")
set_kind("binary")
set_rundir("$(projectdir)")
if is_mode("release") then
set_symbols("hidden")
if is_plat("wasm") then
add_cxflags("-Oz")
else
add_cxflags("-O3")
end
set_strip("all")
end
set_languages("gnu11")
add_cflags("-Wall -Werror=implicit-function-declaration -Wno-unused-function \
-Werror=return-type -Wno-unused-variable \
-Werror=incompatible-pointer-types")
add_includedirs("include")
add_files("src/*.c")
add_files("src/element/*.c")
add_files("src/bind/*.c")
add_files("src/bind/element/*.c")
add_files("src/cache/*.c")
add_files("src/utils/*.c")
-- stb
add_includedirs("lib/stb/include")
add_files("lib/stb/*.c")
-- pulogovg
add_includedirs("lib/plutovg/include")
add_includedirs("lib/plutovg/3rdparty/software")
add_files("lib/plutovg/source/*.c")
add_files("lib/plutovg/3rdparty/software/*.c")
-- pulogosvg
add_includedirs("lib/plutosvg/include")
add_files("lib/plutosvg/source/*.c")
-- flex
add_includedirs("lib/flex/include")
add_files("lib/flex/*.c")
-- QuickJS
add_includedirs("lib/QuickJS")
add_files("lib/QuickJS/quickjs.c")
add_files("lib/QuickJS/libregexp.c")
add_files("lib/QuickJS/libunicode.c")
add_files("lib/QuickJS/cutils.c")
add_defines("_GNU_SOURCE", "CONFIG_VERSION=\"2021-03-27\"", "alloca=__builtin_alloca")
-- hashmap
add_includedirs("lib/hashmap/include")
add_files("lib/hashmap/src/*.c")
-- pqueue
add_includedirs("lib/pqueue")
add_files("lib/pqueue/*.c")
add_packages("m")
if get_config("backend") == "x11" then
add_files("lib/QuickJS/quickjs-libc.c")
add_files("src/platform/x11/*.c")
add_packages("pthread", "dl", "x11", "xext")
end
if get_config("backend") == "sdl2" then
add_files("lib/QuickJS/quickjs-libc.c")
add_files("src/platform/sdl2/*.c")
add_packages("pthread", "dl", "sdl2")
end
if get_config("backend") == "test" then
add_files("lib/QuickJS/quickjs-libc.c")
add_files("src/platform/test/*.c")
add_packages("pthread", "dl")
end
if get_config("backend") == "sdl2-core" then
add_files("src/platform/sdl2-core/*.c")
add_packages("sdl2")
end
if get_config("backend") == "sdl2-core-wasm" then
add_files("src/platform/sdl2-core-wasm/*.c")
add_defines("EMSCRIPTEN")
add_cxflags("-s USE_SDL=2")
add_ldflags("-s LLD_REPORT_UNDEFINED")
add_ldflags("-s STRICT_JS=1")
add_ldflags("-s SINGLE_FILE=0")
add_ldflags("-s EXPORT_ES6=1")
add_ldflags("-s ASSERTIONS")
add_ldflags("-s ALLOW_MEMORY_GROWTH=1")
add_ldflags("-s MODULARIZE=1")
add_ldflags("-s EXIT_RUNTIME=0")
add_ldflags("-s USE_SDL=2")
add_ldflags("-s EXPORTED_FUNCTIONS=_js_cancel_main_loop,_main", { force = true})
add_ldflags("-s EXPORTED_RUNTIME_METHODS=FS,callMain,abort,ccall,cwrap")
add_cxflags("-fno-exceptions")
set_extension(".js")
end
add_options("backend")