From 59903ef7e4ddd8885f71567bf0fc85527a88fffc Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 3 May 2024 18:02:31 -0700 Subject: Add host shared library target. (#4098) * Add host shared library target. * Attempt fix. * Fix warnings. * try fix. * Fix test. * Fix. --- source/slang/slang-compiler.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-compiler.cpp') diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index 1f1bed902..b2b765c0e 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -539,6 +539,7 @@ namespace Slang case CodeGenTarget::ShaderSharedLibrary: case CodeGenTarget::HostExecutable: case CodeGenTarget::HostHostCallable: + case CodeGenTarget::HostSharedLibrary: { // We need some C/C++ compiler return PassThroughMode::GenericCCpp; @@ -955,6 +956,7 @@ namespace Slang } case CodeGenTarget::HostHostCallable: case CodeGenTarget::HostExecutable: + case CodeGenTarget::HostSharedLibrary: { return CodeGenTarget::HostCPPSource; } @@ -1279,8 +1281,14 @@ namespace Slang // Set the source type options.sourceLanguage = SlangSourceLanguage(sourceLanguage); - // Disable exceptions and security checks - options.flags &= ~(CompileOptions::Flag::EnableExceptionHandling | CompileOptions::Flag::EnableSecurityChecks); + switch (target) + { + case CodeGenTarget::ShaderHostCallable: + case CodeGenTarget::ShaderSharedLibrary: + // Disable exceptions and security checks + options.flags &= ~(CompileOptions::Flag::EnableExceptionHandling | CompileOptions::Flag::EnableSecurityChecks); + break; + } Profile profile; @@ -1586,6 +1594,7 @@ namespace Slang case CodeGenTarget::ShaderSharedLibrary: case CodeGenTarget::HostExecutable: case CodeGenTarget::HostHostCallable: + case CodeGenTarget::HostSharedLibrary: SLANG_RETURN_ON_FAIL(emitWithDownstreamForEntryPoints(outArtifact)); return SLANG_OK; @@ -1617,6 +1626,7 @@ namespace Slang case CodeGenTarget::ShaderHostCallable: case CodeGenTarget::ShaderSharedLibrary: case CodeGenTarget::HostExecutable: + case CodeGenTarget::HostSharedLibrary: { SLANG_RETURN_ON_FAIL(_emitEntryPoints(outArtifact)); -- cgit v1.2.3