MCPcopy Index your code
hub / github.com/celer-pkg/celer / readMSVCEnvs

Method readMSVCEnvs

buildsystems/buildconfig.go:1030–1061  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1028}
1029
1030func (b BuildConfig) readMSVCEnvs() (map[string]string, error) {
1031 toolchain := b.Ctx.Platform().GetToolchain()
1032
1033 // Read MSVC environment variables.
1034 // TODO: the `x64` may be different depending on the platform.
1035 command := fmt.Sprintf(`call "%s" x64 && set`, toolchain.GetMSVC().VCVars)
1036 title := fmt.Sprintf("[read msvc envs: %s]", b.PortConfig.nameVersion())
1037 executor := cmd.NewExecutor(title, command)
1038 output, err := executor.ExecuteOutput()
1039 if err != nil {
1040 return nil, err
1041 }
1042
1043 // Parse environment variables from output.
1044 var msvcEnvs = make(map[string]string)
1045 lines := strings.SplitSeq(output, "\n")
1046 for line := range lines {
1047 line = strings.TrimSpace(line)
1048 if line != "" && strings.Contains(line, "=") {
1049 parts := strings.Split(line, "=")
1050
1051 // Unify "Path" to "PATH".
1052 if parts[0] == "Path" {
1053 parts[0] = "PATH"
1054 }
1055 msvcEnvs[parts[0]] = parts[1]
1056 color.Printf(color.Hint, "-- %s=%s\n", parts[0], parts[1])
1057 }
1058 }
1059
1060 return msvcEnvs, nil
1061}
1062
1063// removeLaFiles remove la files generated by libtool.
1064func (b BuildConfig) removeLaFiles(root string) error {

Callers 4

msvcEnvsMethod · 0.95
preConfigureMethod · 0.80
preConfigureMethod · 0.80
preConfigureMethod · 0.80

Calls 8

NewExecutorFunction · 0.92
PrintfFunction · 0.92
SprintfMethod · 0.80
nameVersionMethod · 0.80
ExecuteOutputMethod · 0.80
GetToolchainMethod · 0.65
PlatformMethod · 0.65
GetMSVCMethod · 0.65

Tested by

no test coverage detected