-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpremake5.lua
114 lines (92 loc) · 2.19 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
-- options
newoption {
trigger = "lib-dir",
description = "Sets the path for the dependencies",
value = "PATH"
}
newoption {
trigger = "clean-functions",
description = "Compiles only used functions"
}
newoption {
trigger = "clean-symbols",
description = "Cleans up the symbol table from unused symbols"
}
if not _OPTIONS["lib-dir"] then
_OPTIONS["lib-dir"] = "lib"
end
-- main workspace
workspace "ssc"
configurations { "Debug", "Release" }
targetdir "bin/%{cfg.buildcfg}"
libdirs { _OPTIONS["lib-dir"] }
startproject "frontend"
filter "configurations:Debug"
defines { "DEBUG" }
flags { "Symbols" }
filter "configurations:Release"
defines { "RELEASE" }
optimize "On"
-- sunscript compiler API library
project "ssc"
kind "SharedLib"
language "C#"
namespace "arookas"
location "ssc"
links { "System", "arookas", "grammatica-1.6" }
-- apply options
if _OPTIONS["clean-functions"] then
defines { "SSC_CLEAN_FUNCTIONS" }
end
if _OPTIONS["clean-symbols"] then
defines { "SSC_CLEAN_SYMBOLS" }
end
files {
"ssc/**.cs",
"ssc/**.grammar",
"ssc/**.bat",
}
excludes {
"ssc/bin/**",
"ssc/obj/**",
}
prebuildcommands {
-- regenerate grammatica classes before compilation begins
'{CHDIR} "%{prj.location}"',
'java -jar grammatica.jar "sunscript.grammar" --csoutput ".\\generated" --csnamespace "arookas" --csclassname "__sun"',
}
-- frontend project (example command-line interface)
project "frontend"
kind "ConsoleApp"
language "C#"
entrypoint "arookas.SSC"
namespace "arookas"
location "frontend"
links { "System", "arookas", "SSC" }
files {
"frontend/**.cs",
}
excludes {
"frontend/bin/**",
"frontend/obj/**",
}
postbuildcommands {
-- copy stdlib to frontend output so users can import the scripts
'{RMDIR} "%{cfg.buildtarget.directory}ssc"',
'{COPY} "%{wks.location}stdlib" "%{cfg.buildtarget.directory}ssc"',
}
-- sbdump utility
project "sbdump"
kind "ConsoleApp"
language "C#"
entrypoint "arookas.sbdump"
namespace "arookas"
location "sbdump"
links { "System", "arookas" }
files {
"sbdump/**.cs",
}
excludes {
"sbdump/bin/**",
"sbdump/obj/**",
}