Skip to content
Snippets Groups Projects
Commit e2fa46ab authored by insert's avatar insert
Browse files

Add binary option

parent 47ea4898
No related merge requests found
{
"name": "gnucc",
"version": "1.1.1",
"version": "1.1.3",
"description": "Wrapper for GCC and G++",
"main": "dist/index.js",
"types": "dist/index.d.ts",
......
......@@ -204,6 +204,12 @@ export interface CompilerOptions extends PreprocessorOptions {
logCompile?: boolean,
/** Any additional arguments */
args?: string[],
/** Binaries to use */
binaries?: {
'gcc'?: string,
'g++'?: string
}
};
export interface LinkerOptions extends CompilerOptions {
......
......@@ -17,15 +17,17 @@ export default async function gpp(opt: GPPOptions): Promise<Result>;
export default async function gpp(optOrInput: GPPOptions | string, output?: string, log: boolean = true) {
let binary = 'g++';
let args: string[] = [binary];
let args: string[] = [];
if (typeof optOrInput === 'string') {
args.push(optOrInput);
output && args.push('-o', output);
} else {
if (optOrInput.binaries && optOrInput.binaries["g++"]) binary = optOrInput.binaries["g++"];
args.push(...ProcessGppOpt(optOrInput));
log = optOrInput.log || false;
}
args.unshift(binary);
return await Run(args, log);
};
\ No newline at end of file
......@@ -17,15 +17,17 @@ export default async function gcc(opt: GCCOptions): Promise<Result>;
export default async function gcc(optOrInput: GCCOptions | string, output?: string, log: boolean = true) {
let binary = 'gcc';
let args: string[] = [binary];
let args: string[] = [];
if (typeof optOrInput === 'string') {
args.push(optOrInput);
output && args.push('-o', output);
} else {
if (optOrInput.binaries && optOrInput.binaries.gcc) binary = optOrInput.binaries.gcc;
args.push(...ProcessGccOpt(optOrInput));
log = optOrInput.log || false;
}
args.unshift(binary);
return await Run(args, log);
};
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment