File: README.md

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (67 lines) | stat: -rw-r--r-- 2,322 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# 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](https://github.com/llvm/llvm-project)
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 toolchain](https://www.swift.org/download/) is required to build the
project. The minimum supported Swift version is 5.9.

Since the bindings rely on LLVM headers, you will need a fresh checkout of LLVM
locally. Both upstream LLVM
([llvm/llvm-project](https://github.com/llvm/llvm-project)) and Apple's
LLVM fork ([swiftlang/llvm-project](https://github.com/swiftlang/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-xyz.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](https://github.com/llvm/llvm-project)).

`stable/YYYYMMDD` branch tracks the corresponding `stable/YYYYMMDD` branch
of ([swiftlang/llvm-project](https://github.com/swiftlang/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.