module battery.detect.llvm

Detect LLVM toolchains.

Code Map

//! Detect LLVM toolchains.
module battery.detect.llvm;


//! Which llvm commands that are needed.
struct Needed
{
public:
	config: bool;
	ar: bool;
	clang: bool;
	ld: bool;
	link: bool;
	wasm: bool;
}

//! Used as a argument when supplying a command on the command line.
struct FromArgs
{
public:
	//! The llvm-config command.
	configCmd: string;
	//! The arguments for llvm-config.
	configArgs: string[];
	//! The llvm-ar command.
	arCmd: string;
	//! The arguments for llvm-ar.
	arArgs: string[];
	//! The clang command.
	clangCmd: string;
	//! The arguments for clang.
	clangArgs: string[];
	//! The ld.lld command.
	ldCmd: string;
	//! The arguments for ld.lld.
	ldArgs: string[];
	//! The lld-link command.
	linkCmd: string;
	//! The arguments for lld-link.
	linkArgs: string[];
	//! The wasm-ld command.
	wasmCmd: string;
	//! The arguments for wasm-ld.
	wasmArgs: string[];
}

//! Results from the detection code.
struct Result
{
public:
	//! From where is this result?
	from: string;
	//! LLVM Version.
	ver: semver.Release;
	//! The llvm-config command.
	configCmd: string;
	//! The arguments for llvm-config.
	configArgs: string[];
	//! The llvm-ar command.
	arCmd: string;
	//! The arguments for llvm-ar.
	arArgs: string[];
	//! The clang command.
	clangCmd: string;
	//! The arguments for clang.
	clangArgs: string[];
	//! The ld.lld command.
	ldCmd: string;
	//! The arguments for ld.lld.
	ldArgs: string[];
	//! The lld-link command.
	linkCmd: string;
	//! The arguments for lld-link.
	linkArgs: string[];
	//! The wasm-ld command.
	wasmCmd: string;
	//! The arguments for wasm-ld.
	wasmArgs: string[];
}

//! Detect LLVM toolchains.
fn detectFrom(path: string, confPaths: string[], results: Result[]) bool { }
//! Detect llvm from arguments.
fn detectFromArgs(fromArgs: FromArgs, result: Result) bool { }
//! Check the battery config for gdc.
fn detectFromBatConf(batConf: BatteryConfig, result: Result) bool { }
//! Add extra arguments to the command, any given args are appended after
//! the extra arguments.
fn addArgs(from: Result, arch: Arch, platform: Platform, res: Result) { }
struct Needed

Which llvm commands that are needed.

struct FromArgs

Used as a argument when supplying a command on the command line.

configCmd: string

The llvm-config command.

configArgs: string[]

The arguments for llvm-config.

arCmd: string

The llvm-ar command.

arArgs: string[]

The arguments for llvm-ar.

clangCmd: string

The clang command.

clangArgs: string[]

The arguments for clang.

ldCmd: string

The ld.lld command.

ldArgs: string[]

The arguments for ld.lld.

linkCmd: string

The lld-link command.

linkArgs: string[]

The arguments for lld-link.

wasmCmd: string

The wasm-ld command.

wasmArgs: string[]

The arguments for wasm-ld.

struct Result

Results from the detection code.

from: string

From where is this result?

ver: semver.Release

LLVM Version.

configCmd: string

The llvm-config command.

configArgs: string[]

The arguments for llvm-config.

arCmd: string

The llvm-ar command.

arArgs: string[]

The arguments for llvm-ar.

clangCmd: string

The clang command.

clangArgs: string[]

The arguments for clang.

ldCmd: string

The ld.lld command.

ldArgs: string[]

The arguments for ld.lld.

linkCmd: string

The lld-link command.

linkArgs: string[]

The arguments for lld-link.

wasmCmd: string

The wasm-ld command.

wasmArgs: string[]

The arguments for wasm-ld.

fn detectFrom(path: string, confPaths: string[], results: Result[]) bool

Detect LLVM toolchains.

fn detectFromArgs(fromArgs: FromArgs, result: Result) bool

Detect llvm from arguments.

fn detectFromBatConf(batConf: BatteryConfig, result: Result) bool

Check the battery config for gdc.

fn addArgs(from: Result, arch: Arch, platform: Platform, res: Result)

Add extra arguments to the command, any given args are appended after the extra arguments.

fn getLLVMTargetString(arch: Arch, platform: Platform) string

configs used with LLVM tools, Clang and Volta.