import "android.googlesource.com/platform/tools/gpu/build/cpp"
const ( NoOptimization = iota // Use to disable optimization. Useful for debugging. FullOptimization // Full optimizations enabled. Fastest option. )
func Compile(sources build.FileSet, cfg Config, env build.Environment) (build.FileSet, error)
Compile compiles the list of source files into object files using the Config and build Environment. Compile returns the list of object files.
func DynamicLibrary(inputs build.FileSet, cfg Config, env build.Environment) (build.File, error)
DynamicLibrary links the list of input files into an dynamically-linked library using the Config and build Environment. The inputs can be a combination of source files, object files and / or library files. DynamicLibrary returns the output dynamic-library file file.
func Executable(inputs build.FileSet, cfg Config, env build.Environment) (build.File, error)
Executable links the list of input files into an executable using the Config and build Environment. The inputs can be a combination of source files, object files and / or library files. Executable returns the output executable file.
func IntermediatePath(source build.File, ext string, cfg Config, env build.Environment) build.File
IntermediatePath returns a File in the intermediate directory for generating a file built from source using cfg and env.
func ParseDepFile(file build.File, env build.Environment) (deps build.FileSet, depsValid bool)
ParseDepFile loads and parses the makefile dependency file generated by the C++ compiler. If parsing succeeds and all dependencies exist then ParseDepFile returns the list of file dependencies in deps and depsValid is true, otherwise depsValid is false.
func StaticLibrary(inputs build.FileSet, cfg Config, env build.Environment) (build.File, error)
StaticLibrary archives the list of input files into an static library using the Config and build Environment. The inputs can be a combination of source files and / or object files. StaticLibrary returns the output static library file.
func Triplet(cfg Config) string
Triplet returns a string combining the os, architecture and flavour of cfg.
type Config struct { Name string // The name that may be mangled to produce the output file. OutputExt *string // The output file extension. If nil, a toolchain default is used. OutputDir build.File // The output directory Toolchain *Toolchain // The toolchain used to build. OptimizationLevel OptimizationLevel // The optimization level to use. OS string // The target operating system, e.g. "windows". Architecture string // The target architecture, e.g. "x64". Flavor string // Flavor is used to separate different build configurations, e.g. "release". Defines map[string]string // The list of defines used for compilation. CompilerArgs []string // Custom complier flags. ArchiverArgs []string // Custom archiver flags. LinkerArgs []string // Custom linker flags. Libraries build.FileSet // The list of libraries used by the linker. LibrarySearchPaths build.FileSet // The list of library search paths. IncludeSearchPaths build.FileSet // The list of include search paths. AdditionalSources build.FileSet // Additional list of source files to compile. Permissions []string // APK required permissions (NDK only). ModuleDefinition build.File // An optional module definition file for dlls. }
Config is the configuration for a C++, C or Objective-C++ build.
func (c Config) Extend(n Config) Config
Extend returns a new Config based on this Config, but with field added or replaced by any non-default fields of n.
type OptimizationLevel int
OptimisationLevel is an enumerator of optimisation levels to use by a toolchain.
type Toolchain struct { Compiler sisotool // Tool used to compile source to object files. Archiver misotool // Tool used to package object files into archives. DllLinker misotool // Tool used to link objects and packages into dynamic libraries. ExeLinker misotool // Tool used to link objects and packages into executables. DepsFor depsFor // Returns the list of dependencies for the given file. LibName func(Config) string // Returns the name of the emitted static library file. DllName func(Config) string // Returns the name of the emitted dynamic library file. ExeName func(Config) string // Returns the name of the emitted executable. ObjExt func(Config) string // Extension used for object files. }
Toolchain is a collection of tools used to build objects, libraries and programs.
func (t Toolchain) LibExt(cfg Config) string