summaryrefslogtreecommitdiffstats
path: root/source/compiler-core
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-05-03 18:02:31 -0700
committerGitHub <noreply@github.com>2024-05-03 18:02:31 -0700
commit59903ef7e4ddd8885f71567bf0fc85527a88fffc (patch)
tree700a177860d24610780390b35277aa8ff5c47947 /source/compiler-core
parent54153a3681c7c6ef86c6f7a864719d32a1934240 (diff)
Add host shared library target. (#4098)
* Add host shared library target. * Attempt fix. * Fix warnings. * try fix. * Fix test. * Fix.
Diffstat (limited to 'source/compiler-core')
-rw-r--r--source/compiler-core/slang-artifact-desc-util.cpp3
-rw-r--r--source/compiler-core/slang-gcc-compiler-util.cpp4
-rw-r--r--source/compiler-core/slang-visual-studio-compiler-util.cpp1
3 files changed, 6 insertions, 2 deletions
diff --git a/source/compiler-core/slang-artifact-desc-util.cpp b/source/compiler-core/slang-artifact-desc-util.cpp
index 7e3f61915..783833902 100644
--- a/source/compiler-core/slang-artifact-desc-util.cpp
+++ b/source/compiler-core/slang-artifact-desc-util.cpp
@@ -276,6 +276,7 @@ SLANG_HIERARCHICAL_ENUM(ArtifactStyle, SLANG_ARTIFACT_STYLE, SLANG_ARTIFACT_STYL
case SLANG_HOST_CPP_SOURCE: return Desc::make(Kind::Source, Payload::Cpp, Style::Host, 0);
case SLANG_CPP_PYTORCH_BINDING: return Desc::make(Kind::Source, Payload::Cpp, Style::Host, 0);
case SLANG_HOST_EXECUTABLE: return Desc::make(Kind::Executable, Payload::HostCPU, Style::Host, 0);
+ case SLANG_HOST_SHARED_LIBRARY: return Desc::make(Kind::SharedLibrary, Payload::HostCPU, Style::Host, 0);
case SLANG_SHADER_SHARED_LIBRARY: return Desc::make(Kind::SharedLibrary, Payload::HostCPU, Style::Kernel, 0);
case SLANG_SHADER_HOST_CALLABLE: return Desc::make(Kind::HostCallable, Payload::HostCPU, Style::Kernel, 0);
case SLANG_CUDA_SOURCE: return Desc::make(Kind::Source, Payload::CUDA, Style::Kernel, 0);
@@ -357,7 +358,7 @@ SLANG_HIERARCHICAL_ENUM(ArtifactStyle, SLANG_ARTIFACT_STYLE, SLANG_ARTIFACT_STYL
switch (desc.kind)
{
case Kind::Executable: return SLANG_HOST_EXECUTABLE;
- case Kind::SharedLibrary: return SLANG_SHADER_SHARED_LIBRARY;
+ case Kind::SharedLibrary: return desc.style == ArtifactStyle::Host ? SLANG_HOST_SHARED_LIBRARY : SLANG_SHADER_SHARED_LIBRARY;
case Kind::HostCallable: return desc.style == ArtifactStyle::Host ? SLANG_HOST_HOST_CALLABLE : SLANG_SHADER_HOST_CALLABLE;
case Kind::ObjectCode: return SLANG_OBJECT_CODE;
default: break;
diff --git a/source/compiler-core/slang-gcc-compiler-util.cpp b/source/compiler-core/slang-gcc-compiler-util.cpp
index 2bcdfcbfa..52d4a0c29 100644
--- a/source/compiler-core/slang-gcc-compiler-util.cpp
+++ b/source/compiler-core/slang-gcc-compiler-util.cpp
@@ -560,6 +560,7 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS
switch (options.targetType)
{
case SLANG_SHADER_SHARED_LIBRARY:
+ case SLANG_HOST_SHARED_LIBRARY:
{
// Shared library
cmdLine.addArg("-shared");
@@ -639,7 +640,8 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS
// Add the library paths
- if (options.libraryPaths.count && options.targetType == SLANG_HOST_EXECUTABLE)
+ if (options.libraryPaths.count &&
+ (options.targetType == SLANG_HOST_EXECUTABLE))
{
if(PlatformUtil::isFamily(PlatformFamily::Apple, platformKind))
cmdLine.addArg("-Wl,-rpath,@loader_path,-rpath,@loader_path/../lib");
diff --git a/source/compiler-core/slang-visual-studio-compiler-util.cpp b/source/compiler-core/slang-visual-studio-compiler-util.cpp
index 14fad0aec..753d256a6 100644
--- a/source/compiler-core/slang-visual-studio-compiler-util.cpp
+++ b/source/compiler-core/slang-visual-studio-compiler-util.cpp
@@ -189,6 +189,7 @@ static void _addFile(const String& path, const ArtifactDesc& desc, IOSFileArtifa
switch (options.targetType)
{
case SLANG_SHADER_SHARED_LIBRARY:
+ case SLANG_HOST_SHARED_LIBRARY:
{
// Create dynamic link library
if (options.debugInfoType == DebugInfoType::None)