diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-12-03 11:45:01 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-03 11:45:01 -0500 |
| commit | da6be80f18014a3972eedf05099cd0066e9eae04 (patch) | |
| tree | 687cb3853e1794b9478ee2a7b0503590f00f4669 /source/compiler-core/windows | |
| parent | f4b86ff23c825f5e776a401f89302bfcd358aae8 (diff) | |
Split out ExecutableLocation (#2041)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Split out ExecutableLocation.
* Fixes for changes to ExecutableLocation.
* Fix issues around Process on windows.
* Improve comments. Kick CI.
Diffstat (limited to 'source/compiler-core/windows')
| -rw-r--r-- | source/compiler-core/windows/slang-win-visual-studio-util.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/source/compiler-core/windows/slang-win-visual-studio-util.cpp b/source/compiler-core/windows/slang-win-visual-studio-util.cpp index dd9656c23..e1a0f6109 100644 --- a/source/compiler-core/windows/slang-win-visual-studio-util.cpp +++ b/source/compiler-core/windows/slang-win-visual-studio-util.cpp @@ -200,7 +200,7 @@ static SlangResult _find(int versionIndex, WinVisualStudioUtil::VersionPath& out String vswherePath = programFilesPath; vswherePath.append("\\Microsoft Visual Studio\\Installer\\vswhere"); - cmd.setExecutableFilename(vswherePath); + cmd.setExecutableLocation(ExecutableLocation(vswherePath)); StringBuilder versionName; WinVisualStudioUtil::append(version, versionName); @@ -305,22 +305,20 @@ static SlangResult _find(int versionIndex, WinVisualStudioUtil::VersionPath& out // To invoke cl we need to run the suitable vcvars. In order to run this we have to have MS CommandLine. // So here we build up a cl command line that is run by first running vcvars, and then executing cl with the parameters as passed to commandLine - CommandLine cmdLine; + // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa + // To run a batch file, you must start the command interpreter; set lpApplicationName to cmd.exe and set lpCommandLine to the + // following arguments: /c plus the name of the batch file. - cmdLine.setExecutableFilename("cmd.exe"); + CommandLine cmdLine; + cmdLine.setExecutableLocation(ExecutableLocation(ExecutableLocation::Type::Name, "cmd.exe")); + { String options[] = { "/q", "/c", "@prompt", "$" }; cmdLine.addArgs(options, SLANG_COUNT_OF(options)); } cmdLine.addArg("&&"); - - { - StringBuilder path; - path << versionPath.vcvarsPath; - path << "\\vcvarsall.bat"; - cmdLine.addArg(path); - } + cmdLine.addArg(Path::combine(versionPath.vcvarsPath, "vcvarsall.bat")); #if SLANG_PTR_IS_32 cmdLine.addArg("x86"); |
