diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2024-04-11 21:54:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-11 21:54:05 -0700 |
| commit | 1afb9cb43d3ab3d55ac5125ef8b5e6cd482f3f85 (patch) | |
| tree | 5d8430b8e5c87a42bccfe02d5f3f4e2b773f003c /source/slang/slang-serialize-container.cpp | |
| parent | 2a5d126c32d459c9ed6cec005b2a4351e18ed04b (diff) | |
Fix the issues when compiling slang to library (#3936)
Diffstat (limited to 'source/slang/slang-serialize-container.cpp')
| -rw-r--r-- | source/slang/slang-serialize-container.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
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(); |
