import { spawn } from 'child_process'; import * as cmake from './commands/cmake.js'; import path from 'path'; export interface TestSuiteConfigOptions { buildDir: string; testSuiteDir: string; cmakeVariables: Object; optimizeProfile: 'O0' | 'O2' | 'O3' | string; } export function configureTestSuite({ buildDir, testSuiteDir, cmakeVariables, optimizeProfile, }: TestSuiteConfigOptions) { // Invoke cmake to configure test suite return spawn('cmake', [ ...cmake.command({ pathToSource: testSuiteDir, pathToBuild: buildDir, definitions: cmake.variable(cmakeVariables), preloadCache: path.resolve(testSuiteDir, 'cmake', 'caches', `${optimizeProfile}.cmake`) }), ]); }