[K/N] Separate ClangArgs for jni and native
Since LLVM for Windows is now native instead on MinGW, we have to compile code in a different environment in case of JNI. This commits just separates ClangArgs into two subclasses without actual behavior changes.
This commit is contained in:
@@ -45,7 +45,7 @@ val libclang =
|
||||
|
||||
val cflags = mutableListOf( "-I$llvmDir/include",
|
||||
"-I${project(":kotlin-native:libclangext").projectDir.absolutePath}/src/main/include",
|
||||
*platformManager.hostPlatform.clang.hostCompilerArgsForJni)
|
||||
*platformManager.hostPlatform.clangForJni.hostCompilerArgsForJni)
|
||||
|
||||
val ldflags = mutableListOf("$llvmDir/$libclang", "-L${libclangextDir.absolutePath}", "-lclangext")
|
||||
|
||||
@@ -99,17 +99,15 @@ val lib = if (HostManager.hostIsMingw) "lib" else "a"
|
||||
|
||||
native {
|
||||
val obj = if (HostManager.hostIsMingw) "obj" else "o"
|
||||
val host = rootProject.project(":kotlin-native").extra["hostName"]
|
||||
val hostLibffiDir = rootProject.project(":kotlin-native").extra["${host}LibffiDir"]
|
||||
val cxxflags = listOf("-std=c++11", *cflags.toTypedArray())
|
||||
suffixes {
|
||||
(".c" to ".$obj") {
|
||||
tool(*platformManager.hostPlatform.clang.clangC("").toTypedArray())
|
||||
tool(*platformManager.hostPlatform.clangForJni.clangC("").toTypedArray())
|
||||
flags(*cflags.toTypedArray(),
|
||||
"-c", "-o", ruleOut(), ruleInFirst())
|
||||
}
|
||||
(".cpp" to ".$obj") {
|
||||
tool(*platformManager.hostPlatform.clang.clangCXX("").toTypedArray())
|
||||
tool(*platformManager.hostPlatform.clangForJni.clangCXX("").toTypedArray())
|
||||
flags(*cxxflags.toTypedArray(), "-c", "-o", ruleOut(), ruleInFirst())
|
||||
}
|
||||
|
||||
@@ -126,7 +124,7 @@ native {
|
||||
sourceSets["main-cpp"]!!.transform(".cpp" to ".$obj"))
|
||||
|
||||
target(solib("clangstubs"), *objSet) {
|
||||
tool(*platformManager.hostPlatform.clang.clangCXX("").toTypedArray())
|
||||
tool(*platformManager.hostPlatform.clangForJni.clangCXX("").toTypedArray())
|
||||
flags(
|
||||
"-shared",
|
||||
"-o", ruleOut(), *ruleInAll(),
|
||||
|
||||
Reference in New Issue
Block a user