blob: 34be8473de29eef02e18a12c4e5ea58d88c51117 (
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
65
66
67
68
|
#ifndef SLANG_WIN_VISUAL_STUDIO_UTIL_H
#define SLANG_WIN_VISUAL_STUDIO_UTIL_H
#include "../slang-list.h"
#include "../slang-string.h"
#include "../slang-process-util.h"
#include "../slang-cpp-compiler.h"
namespace Slang {
struct WinVisualStudioUtil
{
enum class Version: uint32_t
{
Unknown = 0, ///< This is an unknown (and not later) version
Future = 0xff * 10, ///< This is a version 'from the future' - that isn't specifically known. Will be treated as latest
};
struct VersionPath
{
Version version; ///< The visual studio version
String vcvarsPath; ///< The path to vcvars bat files, that need to be executed before executing the compiler
};
/// Find all the installations
static SlangResult find(List<VersionPath>& outVersionPaths);
/// Given a version find it's path
static SlangResult find(Version version, VersionPath& outPath);
/// Find and add to the set (if not already there)
static SlangResult find(CPPCompilerSet* set);
/// Create the cmdLine to start compiler for specified path
static void calcExecuteCompilerArgs(const VersionPath& versionPath, CommandLine& outCmdLine);
/// Run visual studio on specified path with the parameters specified on the command line. Output placed in outResult.
static SlangResult executeCompiler(const VersionPath& versionPath, const CommandLine& commandLine, ExecuteResult& outResult);
/// Get all the known version numbers
static void getVersions(List<Version>& outVersions);
/// Gets the msc compiler used to compile this version. Returning Version(0) means unknown
static Version getCompiledVersion();
/// Create a version from a high and low indices
static Version makeVersion(int high, int low = 0) { SLANG_ASSERT(low >= 0 && low <= 9); return Version(high * 10 + low); }
/// Convert a version number into a string
static void append(Version version, StringBuilder& outBuilder);
/// Get version as desc
static CPPCompiler::Desc getDesc(Version version)
{
CPPCompiler::Desc desc;
desc.type = CPPCompiler::CompilerType::VisualStudio;
desc.majorVersion = Int(version) / 10;
desc.minorVersion = Int(version) % 10;
return desc;
}
};
} // namespace Slang
#endif
|