github.com/metux/go-metabuild@v0.0.0-20240118143255-d9ed5ab697f9/util/compiler/main.go (about) 1 package compiler 2 3 import ( 4 "fmt" 5 6 "github.com/metux/go-metabuild/util/compiler/base" 7 "github.com/metux/go-metabuild/util/compiler/gnu" 8 "github.com/metux/go-metabuild/util/compiler/probe" 9 ) 10 11 const ( 12 LangC = base.LangC 13 LangCxx = base.LangCxx 14 ) 15 16 type ( 17 BinaryFileInfo = base.BinaryFileInfo 18 CompilerArg = base.CompilerArg 19 CompilerInfo = base.CompilerInfo 20 PkgConfigInfo = base.PkgConfigInfo 21 CCompiler = base.CCompiler 22 ) 23 24 var ( 25 ParseMachine = base.ParseMachine 26 DetectCC = probe.DetectCC 27 DetectCXX = probe.DetectCXX 28 PkgConfigQuery = base.PkgConfigQuery 29 ) 30 31 func NewCCompiler(ci base.CompilerInfo, tempdir string) base.CCompiler { 32 switch ci.Id { 33 // assume gcc and clang use the same cmdline args 34 case base.CompilerGCC, base.CompilerClang: 35 return gnu.NewCCompiler(ci, tempdir) 36 } 37 panic(fmt.Sprintf("unsupported compiler type: %s", ci.Id)) 38 return nil 39 }