summaryrefslogtreecommitdiff
path: root/premake5.lua
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-09-28 13:42:40 -0700
committerGitHub <noreply@github.com>2022-09-28 13:42:40 -0700
commiteb5c6b93543ca1423117045dbbfee0b6f653d392 (patch)
treebef912602dc22b2ac624eb5630450d8303e43e0f /premake5.lua
parent7708d205cb186f2b95d8daa2d8e0c655488fc34a (diff)
Make github CI build aarch64 binaries on release. (#2417)
Diffstat (limited to 'premake5.lua')
-rw-r--r--premake5.lua105
1 files changed, 54 insertions, 51 deletions
diff --git a/premake5.lua b/premake5.lua
index 02875fc89..c8c1fbf6f 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -167,6 +167,29 @@ newoption {
allowed = { { "true", "True"}, { "false", "False" } }
}
+ newoption {
+ trigger = "skip-source-generation",
+ description = "(Optional) If true will skip source generation steps.",
+ value = "bool",
+ default = "false",
+ allowed = { { "true", "True"}, { "false", "False" } }
+ }
+
+ newoption {
+ trigger = "deploy-slang-llvm",
+ description = "(Optional) If true will copy slang-llvm to output directory.",
+ value = "bool",
+ default = "true",
+ allowed = { { "true", "True"}, { "false", "False" } }
+ }
+ newoption {
+ trigger = "deploy-slang-glslang",
+ description = "(Optional) If true will copy slang-glslang to output directory.",
+ value = "bool",
+ default = "true",
+ allowed = { { "true", "True"}, { "false", "False" } }
+ }
+
buildLocation = _OPTIONS["build-location"]
executeBinary = (_OPTIONS["execute-binary"] == "true")
buildGlslang = (_OPTIONS["build-glslang"] == "true")
@@ -177,7 +200,9 @@ newoption {
enableProfile = (_OPTIONS["enable-profile"] == "true")
enableEmbedStdLib = (_OPTIONS["enable-embed-stdlib"] == "true")
enableXlib = (_OPTIONS["enable-xlib"] == "true")
- enableExperimental = (_OPTIONS["enable-experimental-projects"] == "true")
+ skipSourceGeneration = (_OPTIONS["skip-source-generation"] == "true")
+ deployLLVM = (_OPTIONS["deploy-slang-llvm"] == "true")
+ deployGLSLang = (_OPTIONS["deploy-slang-glslang"] == "true")
-- If stdlib embedding is enabled, disable stdlib source embedding by default
disableStdlibSource = enableEmbedStdLib
@@ -1052,28 +1077,15 @@ tool "slangd"
kind "ConsoleApp"
links { "core", "slang" }
- function getWinArm64Filter(isArm64)
- if isArm64 then
- return { "system:windows", "platforms:aarch64" }
- else
- return { "system:not windows or platforms:not aarch64" }
- end
- end
-
- function getWinArm64BuildDir(isArm64)
- if isArm64 then
- return "%{wks.location}/bin/windows-x64/%{cfg.buildcfg:lower()}"
- else
- return "%{cfg.targetdir}"
- end
+ function getBuildDir(isArm64)
+
+ return "%{cfg.targetdir}"
end
function astReflectGenerator(isArm64)
- local f = getWinArm64Filter(isArm64)
- local builddir = getWinArm64BuildDir(isArm64)
+ local builddir = getBuildDir()
- table.insert(f, "files:**/slang-ast-reflect.h")
- filter(f)
+ filter("files:**/slang-ast-reflect.h")
buildmessage "C++ Extractor %{file.relpath}"
@@ -1122,12 +1134,10 @@ tool "slangd"
buildinputs(buildInputTable)
end
- function metaSlangGenerator(isArm64)
- local f = getWinArm64Filter(isArm64)
- local builddir = getWinArm64BuildDir(isArm64)
+ function metaSlangGenerator()
+ local builddir = getBuildDir()
- table.insert(f, "files:**.meta.slang")
- filter(f)
+ filter("files:**.meta.slang")
-- Specify the "friendly" message that should print to the build log for the action
buildmessage "slang-generate %{file.relpath}"
@@ -1168,12 +1178,10 @@ tool "slangd"
buildinputs { builddir .. "/slang-generate" .. getExecutableSuffix() }
end
- function preludeGenerator(isArm64)
- local f = getWinArm64Filter(isArm64)
- local builddir = getWinArm64BuildDir(isArm64)
+ function preludeGenerator()
+ local builddir = getBuildDir()
- table.insert(f, "files:prelude/*-prelude.h")
- filter(f)
+ filter("files:prelude/*-prelude.h")
buildmessage "slang-embed %{file.relpath}"
buildcommands { '"' .. builddir .. '/slang-embed" %{file.relpath}' }
@@ -1181,6 +1189,8 @@ tool "slangd"
buildinputs { builddir .. "/slang-embed" .. getExecutableSuffix() }
end
+ if not skipSourceGeneration then
+
generatorProject("run-generators", nil)
-- We make 'source/slang' the location of the source, to make paths to source
@@ -1214,8 +1224,7 @@ tool "slangd"
-- We need to run the C++ extractor to generate some include files
if executeBinary then
- astReflectGenerator(true)
- astReflectGenerator(false)
+ astReflectGenerator()
end
-- Next, we want to add a custom build rule for each of the
@@ -1225,13 +1234,8 @@ tool "slangd"
-- defining custom build commands:
--
if executeBinary then
- metaSlangGenerator(true)
- metaSlangGenerator(false)
- end
-
- if executeBinary then
- preludeGenerator(true)
- preludeGenerator(false)
+ metaSlangGenerator()
+ preludeGenerator()
end
filter { }
@@ -1312,18 +1316,13 @@ tool "slangd"
filter("files:source/slang/slang-stdlib-api.cpp")
-- Note! Has to be an absolute path else doesn't work(!)
buildoutputs { absOutputPath }
- local f = getWinArm64Filter(true)
- table.insert(f, "files:source/slang/slang-stdlib-api.cpp")
- filter(f)
- buildinputs { getWinArm64BuildDir(true) .. '/slangc-bootstrap' .. executableSuffix }
- buildcommands {'"' .. getWinArm64BuildDir(true) .. '/slangc-bootstrap" -archive-type riff-lz4 -save-stdlib-bin-source "%{file.directory}/slang-stdlib-generated.h"' }
- f = getWinArm64Filter(false)
- table.insert(f, "files:source/slang/slang-stdlib-api.cpp")
+ filter("files:source/slang/slang-stdlib-api.cpp")
+
filter(f)
buildinputs { "%{cfg.targetdir}/slangc-bootstrap" .. executableSuffix }
buildcommands { '"%{cfg.targetdir}/slangc-bootstrap" -archive-type riff-lz4 -save-stdlib-bin-source "%{file.directory}/slang-stdlib-generated.h"' }
end
-
+ end -- not skipSourceGeneration
--
-- TODO: Slang's current `Makefile` build does some careful incantations
@@ -1360,7 +1359,9 @@ tool "slangd"
if enableEmbedStdLib then
-- We only have this dependency if we are embedding stdlib
- dependson { "embed-stdlib-generator" }
+ if not skipSourceGeneration then
+ dependson { "embed-stdlib-generator" }
+ end
else
-- Disable StdLib embedding
defines { "SLANG_WITHOUT_EMBEDDED_STD_LIB" }
@@ -1395,12 +1396,14 @@ tool "slangd"
-- to generate. We do this by executing the run-generators 'dummy' project
-- which produces the appropriate source
- dependson { "run-generators" }
-
+ if not skipSourceGeneration then
+ dependson { "run-generators" }
+ end
+
-- If we have slang-llvm copy it
local slangLLVMPath = deps:getProjectRelativePath("slang-llvm", "../../..")
- if slangLLVMPath then
+ if slangLLVMPath and deployLLVM then
filter { "system:linux or macosx or windows" }
local sharedLibName = slangUtil.getSharedLibraryFileName(targetInfo, "slang-llvm")
postbuildcommands {
@@ -1412,7 +1415,7 @@ tool "slangd"
-- If we are not building glslang from source, then be
-- sure to copy a binary copy over to the output directory
- if not buildGlslang then
+ if not buildGlslang and slangGlslangPath~=nil and deployGLSLang then
filter { "system:linux or macosx or windows" }
local sharedLibName = slangUtil.getSharedLibraryFileName(targetInfo, "slang-glslang")
postbuildcommands {