bin/cpubench: init

This commit is contained in:
2025-01-21 12:09:37 +08:00
parent 5e382b5cfe
commit 729a3d82d5
6 changed files with 101 additions and 10 deletions

View File

@@ -1,16 +1,15 @@
import fs from 'fs';
import path from 'path';
import { projectRoot } from '../environment/index.js';
import cpuBenchTemplate from '../../assets/CPUBenchTemplate.ini';
const cpubenchTemplate = fs.readFileSync(path.resolve(projectRoot, 'assets', 'CPUBenchTemplate.ini')).toString('utf-8');
export interface CPUBenchConfigOptions {
llvmInstall: string;
optimize: string[];
sysroot: string;
}
export function renderConfig({ llvmInstall, optimize }: CPUBenchConfigOptions) {
return `# Rendered from TypeScript ${new Date().toLocaleString()}, do not edit!\n` + cpubenchTemplate
export function renderConfig({ llvmInstall, optimize, sysroot }: CPUBenchConfigOptions) {
return `# Rendered from TypeScript ${new Date().toLocaleString()}, do not edit!\n` + cpuBenchTemplate
.replace('@@LLVM_INSTALL@@', llvmInstall)
.replace('@@OPTIMIZE@@', optimize.join(' '));
.replace('@@OPTIMIZE@@', optimize.join(' '))
.replace('@@SYSROOT@@', sysroot);
}