From 42ca6758046e11451b0788092f9c95fc7f788da6 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Wed, 16 Mar 2022 08:28:01 -0700 Subject: Add -depfile option to save dependency info (#2161) --- source/slang/slang-options.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/slang/slang-options.cpp') 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[=], -D [=]: Insert a preprocessor macro.\n" + " -depfile : Save the source file dependency list in a file.\n" " -entry : 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; -- cgit v1.2.3