Fix Windows DXGI capture helper flow

This commit is contained in:
webadderall
2026-03-19 00:05:58 +11:00
parent ae521ed9d9
commit f5ccd5b7e0
19 changed files with 48 additions and 122 deletions
@@ -3,16 +3,16 @@ import { mkdirSync, existsSync } from 'node:fs';
import path from 'node:path';
const projectRoot = process.cwd();
const sourceDir = path.join(projectRoot, 'electron', 'native', 'wgc-capture');
const sourceDir = path.join(projectRoot, 'electron', 'native', 'windows-capture');
const buildDir = path.join(sourceDir, 'build');
if (process.platform !== 'win32') {
console.log('[build-wgc-capture] Skipping native Windows capture build: host platform is not Windows.');
console.log('[build-windows-capture] Skipping native Windows capture build: host platform is not Windows.');
process.exit(0);
}
if (!existsSync(path.join(sourceDir, 'CMakeLists.txt'))) {
console.error('[build-wgc-capture] CMakeLists.txt not found at', sourceDir);
console.error('[build-windows-capture] CMakeLists.txt not found at', sourceDir);
process.exit(1);
}
@@ -42,13 +42,13 @@ function findCmake() {
const cmake = findCmake();
if (!cmake) {
console.error('[build-wgc-capture] CMake not found. Install Visual Studio with C++ CMake tools or standalone CMake.');
console.error('[build-windows-capture] CMake not found. Install Visual Studio with C++ CMake tools or standalone CMake.');
process.exit(1);
}
mkdirSync(buildDir, { recursive: true });
console.log('[build-wgc-capture] Configuring CMake...');
console.log('[build-windows-capture] Configuring CMake...');
try {
execSync(`${cmake} .. -G "Visual Studio 17 2022" -A x64`, {
cwd: buildDir,
@@ -56,7 +56,7 @@ try {
timeout: 120000,
});
} catch {
console.log('[build-wgc-capture] VS 2022 generator not found, trying VS 2019...');
console.log('[build-windows-capture] VS 2022 generator not found, trying VS 2019...');
try {
execSync(`${cmake} .. -G "Visual Studio 16 2019" -A x64`, {
cwd: buildDir,
@@ -64,12 +64,12 @@ try {
timeout: 120000,
});
} catch (innerError) {
console.error('[build-wgc-capture] CMake configure failed:', innerError.message);
console.error('[build-windows-capture] CMake configure failed:', innerError.message);
process.exit(1);
}
}
console.log('[build-wgc-capture] Building native Windows capture helper...');
console.log('[build-windows-capture] Building native Windows capture helper...');
try {
execSync(`${cmake} --build . --config Release`, {
cwd: buildDir,
@@ -77,14 +77,14 @@ try {
timeout: 300000,
});
} catch (error) {
console.error('[build-wgc-capture] Build failed:', error.message);
console.error('[build-windows-capture] Build failed:', error.message);
process.exit(1);
}
const exePath = path.join(buildDir, 'Release', 'wgc-capture.exe');
const exePath = path.join(buildDir, 'Release', 'windows-capture.exe');
if (existsSync(exePath)) {
console.log(`[build-wgc-capture] Built successfully: ${exePath}`);
console.log(`[build-windows-capture] Built successfully: ${exePath}`);
} else {
console.error('[build-wgc-capture] Expected exe not found at', exePath);
console.error('[build-windows-capture] Expected exe not found at', exePath);
process.exit(1);
}