forked from bellard/quickjs
-
Notifications
You must be signed in to change notification settings - Fork 55
/
premake5.lua
154 lines (128 loc) · 3.45 KB
/
premake5.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
(function()
-- generate "quickjs-version.h" using VERSION file
local file = io.open("VERSION", "r")
local vers = file:read()
file:close()
vars = vers:gsub("%s+", "")
file = io.open("quickjs-version.h", "w+")
file:write("#define QUICKJS_VERSION \"" .. vers .. "\"")
file:close()
end)()
newoption {
trigger = "jsx",
description = "Will add JSX support"
}
newoption {
trigger = "storage",
description = "Will add persistent storage support"
}
workspace "quickjs"
-- Premake output folder
location(path.join(".build", _ACTION))
defines {
"JS_STRICT_NAN_BOXING", -- this option enables x64 build on Windows/MSVC
"CONFIG_BIGNUM"
}
if _OPTIONS["jsx"] then
defines { "CONFIG_JSX" } -- native JSX support - enables JSX literals
end
if _OPTIONS["storage"] then
defines { "CONFIG_STORAGE" } -- persistent storage support
end
platforms { "x86", "x64", "arm32", "arm64" }
-- Configuration settings
configurations { "Debug", "Release" }
filter "platforms:x86"
architecture "x86"
filter "platforms:x64"
architecture "x86_64"
filter "platforms:arm32"
architecture "ARM"
filter "platforms:arm64"
architecture "ARM64"
filter "system:windows"
removeplatforms { "arm32" }
-- Debug configuration
filter { "configurations:Debug" }
defines { "DEBUG" }
symbols "On"
optimize "Off"
-- Release configuration
filter { "configurations:Release" }
defines { "NDEBUG" }
optimize "Speed"
inlining "Auto"
-- Should apply only for Visual C++
filter { "language:not C#" and "toolset:msc" }
defines { "_CRT_SECURE_NO_WARNINGS" }
buildoptions { "/std:c++latest" }
systemversion "latest"
filter { }
targetdir ".bin/%{cfg.buildcfg}/%{cfg.platform }"
exceptionhandling "Off"
rtti "Off"
--vectorextensions "AVX2"
-----------------------------------------------------------------------------------------------------------------------
project "quickjs"
language "C"
kind "StaticLib"
files {
"cutils.h",
"cutils.c",
"libregexp.c",
"libunicode.c",
"quickjs.c",
"quickjs-libc.c",
"libbf.c",
"libregexp.h",
"libregexp-opcode.h",
"libunicode.h",
"libunicode-table.h",
"list.h",
"quickjs.h",
"quickjs-atom.h",
"quickjs-libc.h",
"quickjs-opcode.h",
"quickjs-jsx.h",
}
if _OPTIONS["storage"] then
exceptionhandling "On"
files {
"storage/quickjs-storage.c",
"storage/quickjs-storage.h",
"storage/dybase/src/*.cpp",
"storage/dybase/src/*.h",
"storage/dybase/include/*.h"
}
includedirs {
"storage/dybase/include"
}
end
-----------------------------------------------------------------------------------------------------------------------
project "qjsc"
language "C"
kind "ConsoleApp"
links { "quickjs" }
files {
"qjsc.c"
}
filter { "action:gmake*", "toolset:gcc" }
links { "dl", "pthread" }
-----------------------------------------------------------------------------------------------------------------------
project "qjs"
language "C"
kind "ConsoleApp"
links { "quickjs" }
dependson { "qjsc" }
files {
"qjs.c",
"repl.js",
"repl.c",
"qjscalc.js",
"qjscalc.c"
}
filter { "action:gmake*", "toolset:gcc" }
links { "dl", "pthread" }
-- Compile repl.js and save bytecode into repl.c
prebuildcommands { "\"%{cfg.buildtarget.directory}/qjsc.exe\" -c -o \"../../repl.c\" -m \"../../repl.js\"" }
prebuildcommands { "\"%{cfg.buildtarget.directory}/qjsc.exe\" -c -o \"../../qjscalc.c\" -m \"../../qjscalc.js\"" }