diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-compiler.cpp | 2 | ||||
| -rw-r--r-- | source/slang/slang-options.cpp | 22 | ||||
| -rw-r--r-- | source/slang/slang-serialize-container.cpp | 27 | ||||
| -rw-r--r-- | source/slang/slang.cpp | 2 |
4 files changed, 28 insertions, 25 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index 78aa4a18b..3f5351ff4 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -1948,7 +1948,7 @@ namespace Slang } // If IR emitting is enabled, add IR to the artifacts - if (m_emitIr) + if (m_emitIr && (m_containerFormat == ContainerFormat::SlangModule)) { OwnedMemoryStream stream(FileAccess::Write); SlangResult res = writeContainerToStream(&stream); diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index e3ccec36a..d9441e6da 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -990,17 +990,11 @@ void OptionsParser::addOutputPath(char const* inPath) ext == toSlice("zip")) { // These extensions don't indicate a artifact container, just that we want to emit IR - if (ext == toSlice("slang-module") || - ext == toSlice("slang-lib")) - { - // We want to emit IR - m_requestImpl->m_emitIr = true; - } - else - { - // We want to write out in an artfact "container", that can hold multiple artifacts. - m_compileRequest->setOutputContainerFormat(SLANG_CONTAINER_FORMAT_SLANG_MODULE); - } + // We want to emit IR + m_requestImpl->m_emitIr = true; + + // We want to write out in an artfact "container", that can hold multiple artifacts. + m_compileRequest->setOutputContainerFormat(SLANG_CONTAINER_FORMAT_SLANG_MODULE); m_requestImpl->m_containerOutputPath = path; } @@ -2525,11 +2519,7 @@ SlangResult OptionsParser::_parse( // If there are no targets and no outputs if (m_rawOutputs.getCount() == 0) { - // And we have a container for output, then enable emitting SlangIR module - if (m_requestImpl->m_containerFormat != ContainerFormat::None) - { - m_requestImpl->m_emitIr = true; - } + m_requestImpl->m_emitIr = true; } else { diff --git a/source/slang/slang-serialize-container.cpp b/source/slang/slang-serialize-container.cpp index 2454256c2..50b9061e3 100644 --- a/source/slang/slang-serialize-container.cpp +++ b/source/slang/slang-serialize-container.cpp @@ -149,17 +149,25 @@ namespace Slang { // If the dependnet file is the same as the module's file path, store it as a relative path // with respect to the search directory discovered above. - if (canonicalFilePath == canonicalModulePath) + if (file->getPathInfo().hasFileFoundPath()) { - auto relativeModulePath = Path::getRelativePath(linkageRoot, canonicalModulePath); - dstModule.dependentFiles.add(relativeModulePath); + if (canonicalFilePath == canonicalModulePath) + { + auto relativeModulePath = Path::getRelativePath(linkageRoot, canonicalModulePath); + dstModule.dependentFiles.add(relativeModulePath); + } + else + { + // For all other dependnet files, store them as relative paths with respect + // to the module's path. + canonicalFilePath = Path::getRelativePath(moduleDir, canonicalFilePath); + dstModule.dependentFiles.add(canonicalFilePath); + } } else { - // For all other dependnet files, store them as relative paths with respect - // to the module's path. - canonicalFilePath = Path::getRelativePath(moduleDir, canonicalFilePath); - dstModule.dependentFiles.add(canonicalFilePath); + // If the module is coming from string instead of an actual file, store it as is. + dstModule.dependentFiles.add(canonicalModulePath); } } else @@ -193,6 +201,11 @@ namespace Slang { // Output the parsed modules. addFrontEndRequestToData(request->getFrontEndReq(), options, out); + // If we are skipping code generation, then we are done. + if(request->getOptionSet().getBoolOption(CompilerOptionName::SkipCodeGen)) + { + return SLANG_OK; + } // auto program = request->getSpecializedGlobalAndEntryPointsComponentType(); diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 0db833c7a..1896008b0 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -6270,7 +6270,7 @@ ISlangMutableFileSystem* EndToEndCompileRequest::getCompileRequestResultAsFileSy // Filter the containerArtifact into things that can be written ComPtr<IArtifact> writeArtifact; - if (SLANG_SUCCEEDED(ArtifactContainerUtil::filter(m_containerArtifact, writeArtifact))) + if (SLANG_SUCCEEDED(ArtifactContainerUtil::filter(m_containerArtifact, writeArtifact)) && writeArtifact) { if (SLANG_SUCCEEDED(ArtifactContainerUtil::writeContainer(writeArtifact, "", fileSystem))) { |
