From 2ca6676674258744315b51283600ac51ad805ae4 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 29 Sep 2016 12:02:22 +0700 Subject: [PATCH] backend.native: apply Interop and add LLVM bindings --- backend.native/build.gradle | 9 ++++++ .../ir/backend.native/src/llvm/LLVM.def | 29 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 backend.native/compiler/ir/backend.native/src/llvm/LLVM.def diff --git a/backend.native/build.gradle b/backend.native/build.gradle index 8a8d2738ada..a3d8ae6c384 100644 --- a/backend.native/build.gradle +++ b/backend.native/build.gradle @@ -12,6 +12,7 @@ buildscript { apply plugin: 'java' apply plugin: 'kotlin' +apply plugin: org.jetbrains.kotlin.NativeInteropPlugin dependencies { @@ -74,3 +75,11 @@ task jars { } } +repositories { + mavenCentral() +} + +genInteropStubs { + environment 'CPATH' : "$llvmInstallPath/include" + environment 'LIBRARY_PATH' : "$llvmInstallPath/lib" +} diff --git a/backend.native/compiler/ir/backend.native/src/llvm/LLVM.def b/backend.native/compiler/ir/backend.native/src/llvm/LLVM.def new file mode 100644 index 00000000000..e917f405f7f --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/llvm/LLVM.def @@ -0,0 +1,29 @@ +libName = llvmbridge + +headers = llvm-c/Core.h llvm-c/ExecutionEngine.h llvm-c/Target.h llvm-c/Analysis.h llvm-c/BitWriter.h llvm-c/BitReader.h + + +compiler = clang + +compilerOpts = -std=c99 -fPIC \ + -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers \ + -pedantic -Wno-long-long -Wcovered-switch-default -Wdelete-non-virtual-dtor \ + -DNDEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS + + +linker = clang++ + +linkerOpts = -stdlib=libc++ -fPIC -fvisibility-inlines-hidden \ + -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers \ + -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor \ + -std=c++11 \ + -DNDEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS \ + -Wl,-search_paths_first -Wl,-headerpad_max_install_names \ + -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter \ + -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMInterpreter \ + -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMInstrumentation -lLLVMProfileData -lLLVMTransformUtils \ + -lLLVMBitWriter -lLLVMExecutionEngine -lLLVMTarget -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser \ + -lLLVMBitReader -lLLVMMC -lLLVMCore -lLLVMSupport -lcurses -lpthread -lz -lm \ + -lffi + +excludedFunctions =