forked from ovr/StaticScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.ts
More file actions
27 lines (21 loc) · 673 Bytes
/
utils.ts
File metadata and controls
27 lines (21 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as child_process from "child_process";
import * as path from "path";
let llvmBinDir: string | undefined;
function getLLVMBinDirectory(): string {
if (!llvmBinDir) {
llvmBinDir = child_process.execFileSync('llvm-config', ["--bindir"]).toString().trim();
}
return llvmBinDir;
}
export function executeLLCSync(options: Array<any>): Buffer|string {
return child_process.execFileSync(
path.join(getLLVMBinDirectory(), 'llc'),
options
)
}
export function executeOptSync(options: Array<any>): Buffer|string {
return child_process.execFileSync(
path.join(getLLVMBinDirectory(), 'opt'),
options
)
}