135 lines
3 KiB
Lua
135 lines
3 KiB
Lua
-- 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
|
|
|
|
-- clean
|
|
newaction {
|
|
trigger = "clean",
|
|
description = "clean the software",
|
|
execute = function ()
|
|
print("Clean the build...")
|
|
os.rmdir("./bin")
|
|
os.rmdir("./ssc/obj")
|
|
os.rmdir("./frontend/obj")
|
|
os.rmdir("./sbdump/obj")
|
|
print("Done.")
|
|
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 "On" }
|
|
|
|
filter "configurations:Release"
|
|
defines { "RELEASE" }
|
|
optimize "On"
|
|
|
|
-- sunscript compiler API library
|
|
project "ssc"
|
|
kind "SharedLib"
|
|
language "C#"
|
|
namespace "arookas"
|
|
location "ssc"
|
|
|
|
links { "System.dll", "System.Core.dll", "arookas.dll", "grammatica-1.6.dll" }
|
|
|
|
-- 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"
|
|
|
|
libdirs { "$(TARGETDIR)" }
|
|
links { "System.dll", "System.Core.dll", "arookas.dll", "ssc.dll" }
|
|
|
|
files {
|
|
"frontend/**.cs",
|
|
}
|
|
|
|
excludes {
|
|
"frontend/bin/**",
|
|
"frontend/obj/**",
|
|
}
|
|
|
|
postbuildcommands {
|
|
-- copy stdlib to frontend output so users can import the scripts
|
|
'{MKDIR} "%{cfg.buildtarget.directory}/ssc"',
|
|
'{RMDIR} "%{cfg.buildtarget.directory}/ssc"',
|
|
'{MKDIR} "%{cfg.buildtarget.directory}/ssc-sup39"',
|
|
'{RMDIR} "%{cfg.buildtarget.directory}/ssc-sup39"',
|
|
'{COPY} "%{wks.location}/stdlib" "%{cfg.buildtarget.directory}/ssc"',
|
|
'{COPY} "%{wks.location}/stdlib-sup39" "%{cfg.buildtarget.directory}/ssc-sup39"',
|
|
'{COPY} "%{wks.location}/lib/*.dll" "%{cfg.buildtarget.directory}/"',
|
|
'{COPY} "%{wks.location}/utils/*" "%{cfg.buildtarget.directory}/"',
|
|
}
|
|
|
|
-- sbdump utility
|
|
project "sbdump"
|
|
kind "ConsoleApp"
|
|
language "C#"
|
|
entrypoint "arookas.sbdump"
|
|
namespace "arookas"
|
|
location "sbdump"
|
|
|
|
links { "System.dll", "System.Core.dll", "arookas.dll" }
|
|
|
|
files {
|
|
"sbdump/**.cs",
|
|
}
|
|
|
|
excludes {
|
|
"sbdump/bin/**",
|
|
"sbdump/obj/**",
|
|
}
|