From 037580fbb754cd4751b6921d6fc96077be126bb8 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Tue, 6 Jun 2017 10:18:19 +0300 Subject: [PATCH] Remove outdated InteropExample project --- InteropExample/build.gradle | 49 --------------------- InteropExample/src/main/kotlin/main.kt | 60 -------------------------- settings.gradle | 1 - 3 files changed, 110 deletions(-) delete mode 100644 InteropExample/build.gradle delete mode 100644 InteropExample/src/main/kotlin/main.kt diff --git a/InteropExample/build.gradle b/InteropExample/build.gradle deleted file mode 100644 index 48ccf23e967..00000000000 --- a/InteropExample/build.gradle +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -apply plugin: 'kotlin' -apply plugin: org.jetbrains.kotlin.NativeInteropPlugin -apply plugin: 'application' - -kotlinNativeInterop { - llvm { - defFile '../backend.native/llvm.def' - compilerOpts "-I$llvmDir/include" - linkerOpts "-L$llvmDir/lib" - } - -} - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile kotlinNativeInterop['llvm'].configuration -} - -mainClassName = 'MainKt' - -run { - environment 'LD_LIBRARY_PATH' : "$llvmDir/lib" -} diff --git a/InteropExample/src/main/kotlin/main.kt b/InteropExample/src/main/kotlin/main.kt deleted file mode 100644 index 0d1262f6cce..00000000000 --- a/InteropExample/src/main/kotlin/main.kt +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import kotlinx.cinterop.* -import llvm.* - -fun main(args: Array) = memScoped { - val module = LLVMModuleCreateWithName("module") - println("module=" + module.rawValue) - - val paramTypes = allocArrayOf(LLVMInt32Type(), LLVMInt32Type()) - val retType = LLVMFunctionType(LLVMInt32Type(), paramTypes, 2, 0) - - val sum = LLVMAddFunction(module, "sum", retType) - val entry = LLVMAppendBasicBlock(sum, "entry") - val builder = LLVMCreateBuilder() - LLVMPositionBuilderAtEnd(builder, entry) - val tmp = LLVMBuildAdd(builder, LLVMGetParam(sum, 0), LLVMGetParam(sum, 1), "tmp") - LLVMBuildRet(builder, tmp) - val engineRef = alloc() - val errorRef = allocPointerTo() - LLVMInitializeNativeTarget() - errorRef.value = null - if (LLVMCreateExecutionEngineForModule(engineRef.ptr, module, errorRef.ptr) != 0) { - println("failed to create execution engine") - return - } - val error = errorRef.value - if (error != null) { - println(error.toKString()) - return - } - - println(LLVMGetTypeKind(LLVMInt32Type())) - val x = 5L - val y = 6L - val args = allocArrayOf( - LLVMCreateGenericValueOfInt(LLVMInt32Type(), x, 0), - LLVMCreateGenericValueOfInt(LLVMInt32Type(), y, 0)) - - val runRes = LLVMRunFunction(engineRef.value, sum, 2, args) - println(LLVMGenericValueToInt(runRes, 0)) - if (LLVMWriteBitcodeToFile(module, "/tmp/sum.bc") != 0) { - println("error writing bitcode to file, skipping") - } - LLVMDisposeBuilder(builder) - LLVMDisposeExecutionEngine(engineRef.value) -} diff --git a/settings.gradle b/settings.gradle index 83799699dd5..baa91a4ab70 100644 --- a/settings.gradle +++ b/settings.gradle @@ -18,7 +18,6 @@ include ':dependencies' include ':Interop:Indexer' include ':Interop:StubGenerator' include ':Interop:Runtime' -include ':InteropExample' include ':llvmDebugInfoC' include ':backend.native' include ':runtime'