From 85490f920118fee8fa7db1b4fd4b500a00f63095 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Sat, 9 Dec 2023 22:10:54 +0200 Subject: [PATCH] [Native][Tests]Update executable location in AbstractNativeCExportTest Changed the code in AbstractNativeCExportTest to create the executable in the same directory as the dynamic library. This update is to accommodate the lack of rpath on Windows systems. --- .../kotlin/konan/test/blackbox/AbstractNativeCExportTest.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativeCExportTest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativeCExportTest.kt index d575db2d475..6f5e1dc7eee 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativeCExportTest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativeCExportTest.kt @@ -67,7 +67,10 @@ abstract class AbstractNativeCExportTest( ).result.assertSuccess().resultingArtifact val clangExecutableName = "clangMain" - val executableFile = File(buildDir, clangExecutableName) + // We create executable in the same directory as dynamic library because there is no rpath on Windows. + // Possible alternative: generate executable in buildDir and move or copy DLL there. + // It might make sense in case of multiple dynamic libraries, but let's keep things simple for now. + val executableFile = File(binaryLibrary.libraryFile.parentFile, clangExecutableName) val includeDirectories = binaryLibrary.headerFile?.let { listOf(it.parentFile) } ?: emptyList() val libraryName = binaryLibrary.libraryFile.nameWithoutExtension.substringAfter("lib") val clangResult = compileWithClang(