ssc/premake5.lua

136 lines
3 KiB
Lua
Raw Permalink Normal View History

2015-12-28 16:48:13 +09:00
-- options
2016-02-13 12:39:25 +09:00
newoption {
trigger = "lib-dir",
description = "Sets the path for the dependencies",
value = "PATH"
}
2016-02-14 08:15:18 +09:00
newoption {
trigger = "clean-functions",
description = "Compiles only used functions"
}
newoption {
trigger = "clean-symbols",
description = "Cleans up the symbol table from unused symbols"
}
2016-02-13 12:39:25 +09:00
if not _OPTIONS["lib-dir"] then
_OPTIONS["lib-dir"] = "lib"
end
2022-02-23 09:32:28 +09:00
-- 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
}
2015-12-28 16:48:13 +09:00
-- main workspace
2015-12-13 07:41:54 +09:00
workspace "ssc"
configurations { "Debug", "Release" }
targetdir "bin/%{cfg.buildcfg}"
2016-02-13 12:39:25 +09:00
libdirs { _OPTIONS["lib-dir"] }
2015-12-13 07:41:54 +09:00
startproject "frontend"
filter "configurations:Debug"
defines { "DEBUG" }
2022-02-23 09:32:28 +09:00
flags { symbols "On" }
2015-12-13 07:41:54 +09:00
filter "configurations:Release"
defines { "RELEASE" }
optimize "On"
-- sunscript compiler API library
project "ssc"
kind "SharedLib"
language "C#"
namespace "arookas"
location "ssc"
2022-02-23 09:32:28 +09:00
links { "System.dll", "System.Core.dll", "arookas.dll", "grammatica-1.6.dll" }
2015-12-13 07:41:54 +09:00
2015-12-28 16:48:13 +09:00
-- apply options
2016-02-14 08:15:18 +09:00
if _OPTIONS["clean-functions"] then
defines { "SSC_CLEAN_FUNCTIONS" }
end
if _OPTIONS["clean-symbols"] then
defines { "SSC_CLEAN_SYMBOLS" }
end
2015-12-28 16:48:13 +09:00
2015-12-28 14:48:47 +09:00
files {
2015-12-13 07:41:54 +09:00
"ssc/**.cs",
"ssc/**.grammar",
"ssc/**.bat",
}
2015-12-28 14:48:47 +09:00
excludes {
2015-12-13 07:41:54 +09:00
"ssc/bin/**",
"ssc/obj/**",
}
2015-12-28 14:48:47 +09:00
prebuildcommands {
2015-12-13 07:41:54 +09:00
-- regenerate grammatica classes before compilation begins
2016-02-20 04:04:40 +09:00
'{CHDIR} "%{prj.location}"',
'java -jar grammatica.jar "sunscript.grammar" --csoutput ".\\generated" --csnamespace "arookas" --csclassname "__sun"',
2015-12-13 07:41:54 +09:00
}
-- frontend project (example command-line interface)
project "frontend"
kind "ConsoleApp"
language "C#"
entrypoint "arookas.SSC"
namespace "arookas"
location "frontend"
2022-02-23 09:32:28 +09:00
libdirs { "$(TARGETDIR)" }
links { "System.dll", "System.Core.dll", "arookas.dll", "ssc.dll" }
2015-12-13 07:41:54 +09:00
2015-12-28 14:48:47 +09:00
files {
2015-12-13 07:41:54 +09:00
"frontend/**.cs",
}
2015-12-28 14:48:47 +09:00
excludes {
2015-12-13 07:41:54 +09:00
"frontend/bin/**",
"frontend/obj/**",
}
2015-12-28 14:48:47 +09:00
postbuildcommands {
2015-12-13 07:41:54 +09:00
-- copy stdlib to frontend output so users can import the scripts
2022-02-23 09:32:28 +09:00
'{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}/"',
2015-12-13 07:41:54 +09:00
}
2015-12-31 12:28:52 +09:00
-- sbdump utility
project "sbdump"
kind "ConsoleApp"
language "C#"
entrypoint "arookas.sbdump"
namespace "arookas"
location "sbdump"
2022-02-23 09:32:28 +09:00
links { "System.dll", "System.Core.dll", "arookas.dll" }
2015-12-31 12:28:52 +09:00
files {
"sbdump/**.cs",
}
excludes {
"sbdump/bin/**",
"sbdump/obj/**",
}