diff options
| -rw-r--r-- | premake5.lua | 20 | ||||
| -rw-r--r-- | source/slang/slang-stdlib.cpp | 5 |
2 files changed, 22 insertions, 3 deletions
diff --git a/premake5.lua b/premake5.lua index a1661e611..8b4348cfa 100644 --- a/premake5.lua +++ b/premake5.lua @@ -150,15 +150,23 @@ newoption { value = "bool", default = "true", allowed = { { "true", "True"}, { "false", "False" } } - } + } - newoption { + newoption { trigger = "enable-experimental-projects", description = "(Optional) If true include experimental projects in build.", value = "bool", default = "false", allowed = { { "true", "True"}, { "false", "False" } } - } + } + + newoption { + trigger = "disable-stdlib-source", + description = "(Optional) If true stdlib source will not be included in binary.", + value = "bool", + default = "false", + allowed = { { "true", "True"}, { "false", "False" } } + } buildLocation = _OPTIONS["build-location"] executeBinary = (_OPTIONS["execute-binary"] == "true") @@ -171,6 +179,8 @@ newoption { enableEmbedStdLib = (_OPTIONS["enable-embed-stdlib"] == "true") enableXlib = (_OPTIONS["enable-xlib"] == "true") enableExperimental = (_OPTIONS["enable-experimental-projects"] == "true") + disableStdlibSource = (_OPTIONS["disable-stdlib-source"] == "true") + -- Determine the target info targetInfo = slangUtil.getTargetInfo() @@ -1304,6 +1314,10 @@ tool "slangd" -- defines { "SLANG_DYNAMIC_EXPORT" } + if disableStdlibSource then + defines { "SLANG_DISABLE_STDLIB_SOURCE" } + end + if enableEmbedStdLib then -- We only have this dependency if we are embedding stdlib dependson { "embed-stdlib-generator" } diff --git a/source/slang/slang-stdlib.cpp b/source/slang/slang-stdlib.cpp index e0727f19a..2bbf3c1c0 100644 --- a/source/slang/slang-stdlib.cpp +++ b/source/slang/slang-stdlib.cpp @@ -225,6 +225,7 @@ namespace Slang String Session::getCoreLibraryCode() { +#if !defined(SLANG_DISABLE_STDLIB_SOURCE) if (coreLibraryCode.getLength() > 0) return coreLibraryCode; @@ -235,11 +236,14 @@ namespace Slang #include "core.meta.slang.h" coreLibraryCode = sb.ProduceString(); +#endif + return coreLibraryCode; } String Session::getHLSLLibraryCode() { +#if !defined(SLANG_DISABLE_STDLIB_SOURCE) if (hlslLibraryCode.getLength() > 0) return hlslLibraryCode; @@ -250,6 +254,7 @@ namespace Slang #include "hlsl.meta.slang.h" hlslLibraryCode = sb.ProduceString(); +#endif return hlslLibraryCode; } } |
