summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-visual-studio-compiler-util.h
blob: 77227ce97a91d6659e62adeb7e2f66db1640d9b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef SLANG_VISUAL_STUDIO_COMPILER_UTIL_H
#define SLANG_VISUAL_STUDIO_COMPILER_UTIL_H

#include "slang-downstream-compiler-util.h"

namespace Slang
{


struct VisualStudioCompilerUtil : public DownstreamCompilerUtilBase
{
    /// Calculate Visual Studio family compilers cmdLine arguments from options
    static SlangResult calcArgs(const CompileOptions& options, CommandLine& cmdLine);
    /// Parse Visual Studio exeRes into CPPCompiler::Output
    static SlangResult parseOutput(const ExecuteResult& exeRes, IArtifactDiagnostics* outOutput);

    static SlangResult calcCompileProducts(
        const CompileOptions& options,
        ProductFlags flags,
        IOSFileArtifactRepresentation* lockFile,
        List<ComPtr<IArtifact>>& outArtifacts);

    static SlangResult locateCompilers(
        const String& path,
        ISlangSharedLibraryLoader* loader,
        DownstreamCompilerSet* set);
};

class VisualStudioDownstreamCompiler : public CommandLineDownstreamCompiler
{
public:
    typedef CommandLineDownstreamCompiler Super;
    typedef VisualStudioCompilerUtil Util;

    // CommandLineDownstreamCompiler impl  - just forwards to the Util
    virtual SlangResult calcArgs(const CompileOptions& options, CommandLine& cmdLine) SLANG_OVERRIDE
    {
        return Util::calcArgs(options, cmdLine);
    }
    virtual SlangResult parseOutput(
        const ExecuteResult& exeResult,
        IArtifactDiagnostics* diagnostics) SLANG_OVERRIDE
    {
        return Util::parseOutput(exeResult, diagnostics);
    }
    virtual SlangResult calcCompileProducts(
        const CompileOptions& options,
        DownstreamProductFlags productFlags,
        IOSFileArtifactRepresentation* lockFile,
        List<ComPtr<IArtifact>>& outArtifacts) SLANG_OVERRIDE
    {
        return Util::calcCompileProducts(options, productFlags, lockFile, outArtifacts);
    }

    VisualStudioDownstreamCompiler(const Desc& desc)
        : Super(desc)
    {
    }
};


} // namespace Slang

#endif