Skip to content

Commit 7cc01a6

Browse files
committed
fix: Windows build
1 parent 08fab6b commit 7cc01a6

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/bindings/utils/compileLLamaCpp.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {logDistroInstallInstruction} from "./logDistroInstallInstruction.js";
2424
import {testCmakeBinary} from "./testCmakeBinary.js";
2525
import {getCudaNvccPaths} from "./detectAvailableComputeLayers.js";
2626
import {detectWindowsBuildTools} from "./detectBuildTools.js";
27+
import {asyncSome} from "./asyncSome.js";
2728

2829
const __dirname = path.dirname(fileURLToPath(import.meta.url));
2930
const buildConfigType: "Release" | "RelWithDebInfo" | "Debug" = "Release";
@@ -451,11 +452,15 @@ async function moveBuildFilesToResultDir(outDirectory: string, canCreateReleaseD
451452
];
452453
const compiledResultDirPath = path.join(outDirectory, buildConfigType);
453454

454-
if (canCreateReleaseDir)
455-
await fs.ensureDir(compiledResultDirPath);
456-
457-
if (!await fs.pathExists(compiledResultDirPath))
458-
throw new Error(`Could not find ${buildConfigType} directory`);
455+
if (!await fs.pathExists(compiledResultDirPath)) {
456+
if (canCreateReleaseDir) {
457+
if (await asyncSome(binFilesDirPaths.map((dirPath) => fs.pathExists(dirPath))))
458+
await fs.ensureDir(compiledResultDirPath);
459+
else
460+
throw new Error(`Could not find ${buildConfigType} directory or any other output directory`);
461+
} else
462+
throw new Error(`Could not find ${buildConfigType} directory`);
463+
}
459464

460465
for (const binFilesDirPath of binFilesDirPaths) {
461466
if (await fs.pathExists(binFilesDirPath)) {

0 commit comments

Comments
 (0)