Giter Site home page Giter Site logo

swift-llvm-bindings's Introduction

Swift Bindings for LLVM

Swift Bindings for LLVM is a part of the Swift project, and aims to make it easier and more convenient to use LLVM APIs from Swift code. It relies on the experimental Swift/C++ Interoperability, which allows calling C++ APIs directly from Swift, removing the need for a C bridging layer.

This is a work-in-progress. The design of the bindings will be changing as Swift/C++ Interoperability evolves.

Trying it out

Within the Swift compiler project

(This will be updated once the Swift compiler starts using Swift LLVM Bindings.)

As a standalone project

A Swift Development Snapshot toolchain is required to build the project. Using the latest available trunk snapshot is recommended.

Since the bindings rely on LLVM headers, you will need a fresh checkout of LLVM locally. Both upstream LLVM (llvm/llvm-project) and Apple's LLVM fork (apple/llvm-project) are supported.

Similarly to LLVM, CMake is used to build the bindings. To configure the build process, run the following command:

cmake -G Ninja \
      -D CMAKE_BUILD_TYPE=Debug \
      -D CMAKE_Swift_COMPILER=/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-{YYYY-MM-DD}.xctoolchain/usr/bin/swiftc \
      -D LLVM_DIR={PATH_TO_LLVM_BUILD_ROOT}/lib/cmake/llvm \
      -B {PATH_TO_BUILD_ROOT}

To build all of the bindings, run:

cmake --build {PATH_TO_BUILD_ROOT} --target all

To build the bindings for a specific LLVM module (e.g. LLVM_Utils), run:

cmake --build {PATH_TO_BUILD_ROOT} --target LLVM_Utils

Branching scheme

llvm.org/main branch tracks the main branch of (llvm/llvm-project).

stable/YYYYMMDD branch tracks the corresponding stable/YYYYMMDD branch of (apple/llvm-project).

Contributing

If you are working on a feature that you intend to use in SwiftCompilerSources, you should create pull requests against two branches: llvm.org/main and stable/YYYYMMDD. If you are merging the pull requests yourself, please make sure you merge the pull request to llvm.org/main branch first.

Otherwise, you should create pull requests against llvm.org/main branch only.

swift-llvm-bindings's People

Contributors

egorzhdan avatar flickersoul avatar maxdesiatov avatar tkremenek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swift-llvm-bindings's Issues

Regarding the building resource in `Package.swift`

It looks like the module map file is usually referenced as <llvm_root>/llvm/include/module.modulemap and the line 17 in the Package.swift doesn't seem to locate the module map correctly. That is, the llvmModuleMapPath is resolved as <llvm_root>/llvm/include/llvm/module.modulemap and doesn't match where the module map usually is.

    guard let llvmHeaderPath = env["SWIFT_LLVM_BINDINGS_PATH_TO_LLVM_HEADERS"] else {
        print("please pass an environment variable to swift-package: " +
              "SWIFT_LLVM_BINDINGS_PATH_TO_LLVM_HEADERS " +
              "(e.g. swift/llvm-project/llvm/include)")
        return nil
    }
    let llvmModuleMapPath = "\(llvmHeaderPath)/llvm/module.modulemap". // line 17

I am quite new to LLVM and am very likely to be wrong. If without llvm is intended, I can open a pr to fix it. :)

Is this still actively maintained?

Hi,

Just want to know if this project is still being maintained? I came from the LLVM Dev Mtg and this is really interesting.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.