Skip to content

Commit 306ad5f

Browse files
Guarded imports with a NO_SWIFTPM macro (#41)
* Guarded imports with a NO_SWIFTPM macro * Added non-swiftpm installation isntructions * fixed code voice
1 parent 2f9e98a commit 306ad5f

35 files changed

+84
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,22 @@ build.
5858
Once you do that, you can add LLVMSwift as a dependency for your own Swift
5959
compiler projects!
6060

61+
### Installation without Swift Package Manager
62+
63+
We really recommend using SwiftPM with LLVMSwift, but if your project is
64+
structured in such a way that makes using SwiftPM impractical or impossible,
65+
you can still use LLVMSwift by passing the `-DNO_SWIFTPM` to swift when
66+
compiling.
67+
68+
- Xcode:
69+
- Add this repository as a git submodule
70+
- Add the files in `Sources/` to your Xcode project.
71+
- Under `Other Swift Flags`, add `-DNO_SWIFTPM`.
72+
- Under `Library Search Paths` add the output of `llvm-config --libdir`
73+
- Under `Header Search Paths` add the output of `llvm-config --includedir`
74+
- Under `Link Target with Libraries` drag in
75+
`/path/to/your/llvm/lib/libLLVM.dylib`
76+
6177
This project is used by [Trill](https://github.com/harlanhaskins/trill) for
6278
all its code generation.
6379

Sources/LLVM/Alias.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#if !NO_SWIFTPM
12
import cllvm
3+
#endif
24

35
/// An `Alias` represents a global alias in an LLVM module - a new symbol and
46
/// corresponding metadata for an existing position

Sources/LLVM/ArrayType.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#if !NO_SWIFTPM
12
import cllvm
3+
#endif
24

35
/// `ArrayType` is a very simple derived type that arranges elements
46
/// sequentially in memory. `ArrayType` requires a size (number of elements) and

Sources/LLVM/BasicBlock.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#if !NO_SWIFTPM
12
import cllvm
3+
#endif
24

35
/// A `BasicBlock` represents a basic block in an LLVM IR program. A basic
46
/// block contains a sequence of instructions, a pointer to its parent block and

Sources/LLVM/FloatType.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#if !NO_SWIFTPM
12
import cllvm
3+
#endif
24

35
/// `FloatType` enumerates representations of a floating value of a particular
46
/// bit width and semantics.

Sources/LLVM/Function.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#if !NO_SWIFTPM
12
import cllvm
3+
#endif
24

35
/// Enumerates the calling conventions supported by LLVM.
46
///

Sources/LLVM/FunctionType.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#if !NO_SWIFTPM
12
import cllvm
3+
#endif
24

35
/// `FunctionType` represents a function's type signature. It consists of a
46
/// return type and a list of formal parameter types. The return type of a

Sources/LLVM/Global.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#if !NO_SWIFTPM
12
import cllvm
3+
#endif
24

35
/// A `Global` represents a region of memory allocated at compile time instead
46
/// of at runtime. A global variable must either have an initializer, or make

Sources/LLVM/IRBuilder.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#if !NO_SWIFTPM
12
import cllvm
3+
#endif
24

35
/// Species the behavior that should occur on overflow during mathematical
46
/// operations.

Sources/LLVM/IRGlobal.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#if !NO_SWIFTPM
12
import cllvm
3+
#endif
24

35
/// An `IRGlobal` is a value, alias, or function that exists at the top level of
46
/// an LLVM module.

0 commit comments

Comments
 (0)