()
| 41 | } |
| 42 | |
| 43 | func (b *b2) preConfigure() error { |
| 44 | toolchain := b.Ctx.Platform().GetToolchain() |
| 45 | |
| 46 | // `clang` inside visual studio cannot be used to compile b2 project. |
| 47 | if runtime.GOOS == "windows" && strings.Contains(toolchain.GetAbsDir(), "Microsoft Visual Studio") { |
| 48 | if toolchain.GetName() == "clang" { |
| 49 | return fmt.Errorf("visual studio's clang cannot be used to compile b2 project, msvc or clang-cl is required") |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | // For MSVC build, we need to set PATH, INCLUDE and LIB env vars. |
| 54 | if runtime.GOOS == "windows" { |
| 55 | if toolchain.GetName() == "msvc" || toolchain.GetName() == "clang-cl" { |
| 56 | msvcEnvs, err := b.readMSVCEnvs() |
| 57 | if err != nil { |
| 58 | return err |
| 59 | } |
| 60 | |
| 61 | b.envBackup.setenv("PATH", msvcEnvs["PATH"]) |
| 62 | b.envBackup.setenv("INCLUDE", msvcEnvs["INCLUDE"]) |
| 63 | b.envBackup.setenv("LIB", msvcEnvs["LIB"]) |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return nil |
| 68 | } |
| 69 | |
| 70 | func (b b2) configured() bool { |
| 71 | b2file := expr.If(runtime.GOOS == "windows", "b2.exe", "b2") |
nothing calls this directly
no test coverage detected