diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-08-09 10:31:22 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-09 10:31:22 -0400 |
| commit | c0733be56dc24ef0eb67b26fe0c49d3419e75773 (patch) | |
| tree | e094e31981c69e887ff9df84df07defe9eb77bf5 /source/slang | |
| parent | 2db8c15c04f2aade49636e42f0adee636afb3b73 (diff) | |
Support for Items on IArtifact (#2347)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP with hierarchical enums.
* Some small fixes and improvements around artifact desc related types.
* Improvements around hierarchical enum.
* Fixes to get Artifact types refactor to be able to execute tests.
* Attempt to better categorize PTX.
* Work around for potentially unused function warning.
* Typo fix.
* Simplify Artifact header.
* Small improvements around Artifact kind/payload/style.
* Added IDestroyable/ICastable
* Add IArtifactList.
* First impl of IArtifactUtil.
* Use the ICastable interface for IArtifactRepresentation.
* Added IArtifactRepresentation & IArtifactAssociated.
* Add SLANG_OVERRIDE to avoid gcc/clang warning.
* Fix calling convention issue on win32.
* Fix missing SLANG_OVERRIDE.
* First attempt at file abstraction around Artifact.
* Added creation of lock file.
* Move functionality for determining file paths to the IArtifactUtil.
Add casting to ICastable.
* Added some casting/finding mechanisms.
* Simplify IArtifact interface, and use Items for file reps.
* Fix problem with libraries on DXIL.
Diffstat (limited to 'source/slang')
| -rw-r--r-- | source/slang/slang-compiler.cpp | 4 | ||||
| -rw-r--r-- | source/slang/slang-options.cpp | 22 |
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") |
