summaryrefslogtreecommitdiff
path: root/source/slang/slang-options.cpp
diff options
context:
space:
mode:
authorAlexey Panteleev <alpanteleev@nvidia.com>2022-03-16 08:28:01 -0700
committerGitHub <noreply@github.com>2022-03-16 08:28:01 -0700
commit42ca6758046e11451b0788092f9c95fc7f788da6 (patch)
treea377c6b9c7081230ac0385ad14b778b7f700a077 /source/slang/slang-options.cpp
parent8533dd2344d8be040a992a86f23e7cf696d59c4a (diff)
Add -depfile option to save dependency info (#2161)
Diffstat (limited to 'source/slang/slang-options.cpp')
-rw-r--r--source/slang/slang-options.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index 5d8d52a09..b40dedc99 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -501,6 +501,7 @@ struct OptionsParser
"General options:\n"
"\n"
" -D<name>[=<value>], -D <name>[=<value>]: Insert a preprocessor macro.\n"
+ " -depfile <path>: Save the source file dependency list in a file.\n"
" -entry <name>: Specify the name of an entry-point function.\n"
" Multiple -entry options may be used in a single invocation.\n"
" If no -entry options are given, compiler will use [shader(...)]\n"
@@ -1259,6 +1260,22 @@ struct OptionsParser
addOutputPath(outputPath.value.getBuffer());
}
+ // A -depfile option is used to specify the file name where the dependency lists will be written
+ else if (argValue == "-depfile")
+ {
+ CommandLineArg dependencyPath;
+ SLANG_RETURN_ON_FAIL(reader.expectArg(dependencyPath));
+
+ if (requestImpl->m_dependencyOutputPath.getLength() == 0)
+ {
+ requestImpl->m_dependencyOutputPath = dependencyPath.value;
+ }
+ else
+ {
+ sink->diagnose(dependencyPath.loc, Diagnostics::duplicateDependencyOutputPaths);
+ return SLANG_FAIL;
+ }
+ }
else if(argValue == "-matrix-layout-row-major")
{
defaultMatrixLayoutMode = kMatrixLayoutMode_RowMajor;