Skip to content

Commit 1916a99

Browse files
committed
Another cmake windows fix
1 parent 5a59da0 commit 1916a99

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

build.gradle.kts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ val compileGrammarNative by tasks.registering {
180180
val cmakeEnv = mapOf("JAVA_HOME" to javaHome)
181181
val configure = ProcessBuilder(
182182
"cmake", srcDir.path,
183-
"-DCMAKE_BUILD_TYPE=Release",
184-
"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${cmakeBuildDir.path}"
183+
"-DCMAKE_BUILD_TYPE=Release"
185184
)
186185
.directory(cmakeBuildDir)
187186
.inheritIO()
@@ -200,10 +199,16 @@ val compileGrammarNative by tasks.registering {
200199

201200
val libFile = cmakeBuildDir.resolve(nativeGrammarLibName)
202201
if (!libFile.exists()) {
203-
throw GradleException(
204-
"Native grammar library was not produced at expected path: ${libFile}. " +
205-
"cmake exited successfully but the output file is missing."
206-
)
202+
val found = cmakeBuildDir.walkTopDown().maxDepth(3).find { it.name == nativeGrammarLibName }
203+
if (found != null) {
204+
found.copyTo(libFile, overwrite = true)
205+
logger.lifecycle("Copied native grammar library from {} to {}", found, libFile)
206+
} else {
207+
throw GradleException(
208+
"Native grammar library was not produced at expected path: ${libFile}. " +
209+
"Searched subdirectories up to 3 levels deep. cmake exited successfully but output is missing."
210+
)
211+
}
207212
}
208213
}
209214
}

0 commit comments

Comments
 (0)