summaryrefslogtreecommitdiffstats
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/slang-compiler.cpp4
-rw-r--r--source/slang/slang-options.cpp22
2 files changed, 18 insertions, 8 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index 8a9c322b2..8205bcf36 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -1313,8 +1313,12 @@ void printDiagnosticArg(StringBuilder& sb, CodeGenTarget val)
if (_isCPUHostTarget(target))
{
options.libraryPaths.add(Path::getParentDirectory(Path::getExecutablePath()));
+
// Set up the library artifact
ComPtr<IArtifact> artifact(new Artifact(ArtifactDesc::make(ArtifactKind::Library, Artifact::Payload::HostCPU), "slang-rt"));
+ ComPtr<IFileArtifactRepresentation> fileRep(new FileArtifactRepresentation(IFileArtifactRepresentation::Kind::NameOnly, "slang-rt", nullptr, nullptr));
+ artifact->addItem(fileRep);
+
options.libraries.add(artifact);
}
}
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index f56395f5b..ab658fe18 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -1488,17 +1488,23 @@ struct OptionsParser
// Seeing as on all targets the baseName doesn't have an extension, and all library types do
// if the name doesn't have an extension we can assume there is no path to it.
- if (Path::getPathExt(path).getLength() > 0)
+ ComPtr<IFileArtifactRepresentation> fileRep;
+ if (Path::getPathExt(path).getLength() <= 0)
{
- // Set the path
- artifact->setPath(Artifact::PathType::Existing, path.getBuffer());
+ // If there is no extension *assume* it is the name of a system level library
+ fileRep = new FileArtifactRepresentation(IFileArtifactRepresentation::Kind::NameOnly, path, nullptr, nullptr);
}
+ else
+ {
+ fileRep = new FileArtifactRepresentation(IFileArtifactRepresentation::Kind::Reference, path, nullptr, nullptr);
+ if (!fileRep->exists())
+ {
+ sink->diagnose(referenceModuleName.loc, Diagnostics::libraryDoesNotExist, path);
+ return SLANG_FAIL;
+ }
+ }
+ artifact->addItem(fileRep);
- // TODO(JS): We might want to check if the artifact exists.
- // If the artifact is a CPU (or downstream compiler) library
- // it may be findable by some other mechanism, so we probably don't want to check existance and just let the
- // downstream compiler handle.
-
SLANG_RETURN_ON_FAIL(_addLibraryReference(requestImpl, artifact));
}
else if (argValue == "-v" || argValue == "-version")