diff --git a/Interop/Indexer/build.gradle b/Interop/Indexer/build.gradle index e5f942750fd..7478f6dafdb 100644 --- a/Interop/Indexer/build.gradle +++ b/Interop/Indexer/build.gradle @@ -24,11 +24,11 @@ model { binaries.all { cCompiler.args compilerArgsForJniIncludes - cCompiler.args "-I$llvmInstallPath/include" + cCompiler.args "-I$llvmDir/include" } binaries.withType(SharedLibraryBinarySpec) { - linker.args "-L$llvmInstallPath/lib", "-lclang" + linker.args "-L$llvmDir/lib", "-lclang" } } } diff --git a/Interop/Runtime/build.gradle b/Interop/Runtime/build.gradle index 06fd98a191d..0c25acce013 100644 --- a/Interop/Runtime/build.gradle +++ b/Interop/Runtime/build.gradle @@ -23,10 +23,9 @@ model { } binaries.all { cCompiler.args compilerArgsForJniIncludes - cCompiler.args "-I$ffiIncludePath" + cCompiler.args "-I$libffiDir/include" - String libffiPicPath = "$ffiLibPath/libffi_pic.a" - linker.args file(libffiPicPath).exists() ? libffiPicPath : "$ffiLibPath/libffi.a" + linker.args "$libffiDir/lib/libffi.a" } } } diff --git a/InteropExample/build.gradle b/InteropExample/build.gradle index 74a6f498b63..c0cc24f0e8c 100644 --- a/InteropExample/build.gradle +++ b/InteropExample/build.gradle @@ -19,8 +19,8 @@ repositories { kotlinNativeInterop { llvm { defFile '../backend.native/llvm.def' - compilerOpts "-I$llvmInstallPath/include" - linkerOpts "-L$llvmInstallPath/lib" + compilerOpts "-I$llvmDir/include" + linkerOpts "-L$llvmDir/lib" } } diff --git a/backend.native/build.gradle b/backend.native/build.gradle index 85fd514dfb9..7637a90e8ec 100644 --- a/backend.native/build.gradle +++ b/backend.native/build.gradle @@ -36,8 +36,8 @@ sourceSets { kotlinNativeInterop { llvm { defFile 'llvm.def' - compilerOpts "-I$llvmInstallPath/include" - linkerOpts "-L$llvmInstallPath/lib" + compilerOpts "-I$llvmDir/include" + linkerOpts "-L$llvmDir/lib" } hash { // TODO: copy-pasted from ':common:compileHash' diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy index 2cc4f2ab0c7..d74bdeeb5ef 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy @@ -70,7 +70,7 @@ class CompileCppToBitcode extends DefaultTask { project.exec { workingDir objDir - executable "$project.llvmInstallPath/bin/clang++" + executable "$project.llvmDir/bin/clang++" args '-std=c++11' args compilerArgs @@ -82,7 +82,7 @@ class CompileCppToBitcode extends DefaultTask { } project.exec { - executable "$project.llvmInstallPath/bin/llvm-link" + executable "$project.llvmDir/bin/llvm-link" args project.fileTree(objDir).include('**/*.bc') args linkerArgs diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy index 07fc7507828..4d9a0b70307 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy @@ -141,10 +141,10 @@ class NamedNativeInteropConfig extends AbstractFileCollection implements Named { new File(project.findProject(":Interop:Indexer").buildDir, "nativelibs"), new File(project.findProject(":Interop:Runtime").buildDir, "nativelibs") ).asPath - systemProperties "llvmInstallPath" : project.llvmInstallPath + systemProperties "llvmInstallPath" : project.llvmDir environment "LIBCLANG_DISABLE_CRASH_RECOVERY": "1" - environment "DYLD_LIBRARY_PATH": "${project.llvmInstallPath}/lib" - environment "LD_LIBRARY_PATH": "${project.llvmInstallPath}/lib" + environment "DYLD_LIBRARY_PATH": "${project.llvmDir}/lib" + environment "LD_LIBRARY_PATH": "${project.llvmDir}/lib" outputs.dir generatedSrcDir outputs.dir nativeLibsDir diff --git a/dependencies/build.gradle b/dependencies/build.gradle index ccbba79c389..13d12f5a4bb 100644 --- a/dependencies/build.gradle +++ b/dependencies/build.gradle @@ -75,6 +75,15 @@ class TgzNativeDep extends NativeDep { } +task libffi(type: TgzNativeDep) { + baseName = "libffi-3.2.1-${target}" +} + +task llvm(type: TgzNativeDep) { + baseName = "clang+llvm-3.8.0-${target}" +} + + task update { dependsOn tasks.withType(NativeDep) } diff --git a/gradle.properties b/gradle.properties index 2534c8a0d7c..d09f037bee0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1 @@ kotlin_version=1.0.4 -llvmInstallPath=/opt/local/libexec/llvm-3.8 -ffiIncludePath=/opt/local/lib/libffi-3.2.1/include -ffiLibPath=/opt/local/lib diff --git a/runtime/build.gradle b/runtime/build.gradle index 1cb729defdc..6e5fbc88726 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -17,15 +17,15 @@ task test { doLast { exec { - commandLine "$llvmInstallPath/bin/clang", 'src/test/c/main.c', '-c', '-emit-llvm', '-o', "$buildDir/main.bc" - } + commandLine "$llvmDir/bin/clang", 'src/test/c/main.c', '-c', '-emit-llvm', '-o', "$buildDir/main.bc" + } exec { - commandLine "$llvmInstallPath/bin/clang++", build.outFile, "$buildDir/main.bc", '-o', "$buildDir/main" - } - exec { - workingDir buildDir - commandLine './main' - } + commandLine "$llvmDir/bin/clang++", build.outFile, "$buildDir/main.bc", '-o', "$buildDir/main" + } + exec { + workingDir buildDir + commandLine './main' + } } }