cpubench: init, add template rendering
This commit is contained in:
16
src/cpubench/index.ts
Normal file
16
src/cpubench/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import fs from 'fs';
|
||||
import { projectRoot } from 'lyc/environment';
|
||||
import path from 'path';
|
||||
|
||||
const cpubenchTemplate = fs.readFileSync(path.resolve(projectRoot, 'assets', 'CPUBenchTemplate.ini')).toString('utf-8');
|
||||
|
||||
export interface CPUBenchConfigOptions {
|
||||
llvmInstall: string;
|
||||
optimize: string[];
|
||||
}
|
||||
|
||||
export function renderConfig({ llvmInstall, optimize }: CPUBenchConfigOptions) {
|
||||
return `# Rendered from TypeScript ${new Date().toLocaleString()}, do not edit!\n` + cpubenchTemplate
|
||||
.replace('@@LLVM_INSTALL@@', llvmInstall)
|
||||
.replace('@@OPTIMIZE@@', optimize.join(' '));
|
||||
}
|
||||
Reference in New Issue
Block a user