From 4f14efc9752d9ebc8538a2e29ed154a00dc99682 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 1 Jun 2022 20:37:43 -0400 Subject: Disable stdlib source via premake (#2259) * #include an absolute path didn't work - because paths were taken to always be relative. * Added ability to compile slang without stdlib source. It's not requried if stdlib is available if embedded, or is a binary on the file system. Co-authored-by: Yong He --- source/slang/slang-stdlib.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source') 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; } } -- cgit v1.2.3