Do not move libclang out from the clang distribution
Also load libclang using the absolute path to simplify cinterop
This commit is contained in:
committed by
SvyatoslavScherbina
parent
ab392bf9ed
commit
8ebc0bd1ea
+3
@@ -186,6 +186,9 @@ private fun Properties.defaultCompilerOpts(target: String, dependencies: String)
|
|||||||
val sysRoot = targetSysRoot
|
val sysRoot = targetSysRoot
|
||||||
val llvmHomeDir = this.getOsSpecific("llvmHome")!!
|
val llvmHomeDir = this.getOsSpecific("llvmHome")!!
|
||||||
val llvmHome = "$dependencies/$llvmHomeDir"
|
val llvmHome = "$dependencies/$llvmHomeDir"
|
||||||
|
|
||||||
|
System.load("$llvmHome/lib/${System.mapLibraryName("clang")}")
|
||||||
|
|
||||||
val llvmVersion = this.getProperty("llvmVersion")!!
|
val llvmVersion = this.getProperty("llvmVersion")!!
|
||||||
|
|
||||||
val dependencyList = getOsSpecific("dependencies", target)?.split(' ') ?: listOf<String>()
|
val dependencyList = getOsSpecific("dependencies", target)?.split(' ') ?: listOf<String>()
|
||||||
|
|||||||
@@ -215,32 +215,10 @@ task dist_compiler(type: Copy) {
|
|||||||
into('konan')
|
into('konan')
|
||||||
}
|
}
|
||||||
|
|
||||||
from("$llvmDir/lib") {
|
|
||||||
into('konan/nativelib')
|
|
||||||
include '**/libclang.*'
|
|
||||||
includeEmptyDirs = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: check if we use native libraries copied to dist (see above) or not.
|
// TODO: check if we use native libraries copied to dist (see above) or not.
|
||||||
from(project(':tools:helpers').file('build/libs')) {
|
from(project(':tools:helpers').file('build/libs')) {
|
||||||
into('konan/lib')
|
into('konan/lib')
|
||||||
}
|
}
|
||||||
|
|
||||||
doLast {
|
|
||||||
// MacOS System Integrity Protection strips DYLD_LIBRARY_PATH from
|
|
||||||
// environment of all the binaries residing in /bin /usr/bin etc.
|
|
||||||
// That means /usr/bin/java can't use DYLD_LIBRARY_PATH to pick up
|
|
||||||
// rpath'ed libraries.
|
|
||||||
// See dyld(1), install_name_tool(1) for rpath details.
|
|
||||||
|
|
||||||
if (isMac()) {
|
|
||||||
exec {
|
|
||||||
commandLine "install_name_tool"
|
|
||||||
args '-add_rpath', '@loader_path/',
|
|
||||||
'dist/konan/nativelib/libclangstubs.dylib'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task list_dist(type: Exec) {
|
task list_dist(type: Exec) {
|
||||||
|
|||||||
@@ -190,8 +190,6 @@ class NamedNativeInteropConfig implements Named {
|
|||||||
).asPath
|
).asPath
|
||||||
systemProperties "konan.home": project.rootProject.file("dist")
|
systemProperties "konan.home": project.rootProject.file("dist")
|
||||||
environment "LIBCLANG_DISABLE_CRASH_RECOVERY": "1"
|
environment "LIBCLANG_DISABLE_CRASH_RECOVERY": "1"
|
||||||
environment "DYLD_LIBRARY_PATH": "${project.llvmDir}/lib"
|
|
||||||
environment "LD_LIBRARY_PATH": "${project.llvmDir}/lib"
|
|
||||||
|
|
||||||
outputs.dir generatedSrcDir
|
outputs.dir generatedSrcDir
|
||||||
outputs.dir nativeLibsDir
|
outputs.dir nativeLibsDir
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ CSTUBSNAME=cstubs
|
|||||||
CSTUBSNAME_ARG="-cstubsname $CSTUBSNAME"
|
CSTUBSNAME_ARG="-cstubsname $CSTUBSNAME"
|
||||||
|
|
||||||
LIBCLANG_DISABLE_CRASH_RECOVERY=1 \
|
LIBCLANG_DISABLE_CRASH_RECOVERY=1 \
|
||||||
LD_LIBRARY_PATH=${NATIVE_LIB} \
|
|
||||||
$JAVACMD $JAVA_OPTS ${java_args[@]} \
|
$JAVACMD $JAVA_OPTS ${java_args[@]} \
|
||||||
-cp $INTEROP_CLASSPATH \
|
-cp $INTEROP_CLASSPATH \
|
||||||
$INTEROP_TOOL \
|
$INTEROP_TOOL \
|
||||||
|
|||||||
Reference in New Issue
Block a user