|
Revision 349, 1.3 kB
(checked in by manuel, 2 years ago)
|
added usage information for llvm-2.7 and llvm 2.8
|
| Line | |
|---|
| 1 |
This file describes the installation and usage of the llvm bindings. |
|---|
| 2 |
|
|---|
| 3 |
Initial setup: |
|---|
| 4 |
============== |
|---|
| 5 |
|
|---|
| 6 |
svn co http://svn.dsource.org/projects/bindings/trunk/llvm-2.7 |
|---|
| 7 |
cd llvm-2.7 |
|---|
| 8 |
./prebuild.sh |
|---|
| 9 |
|
|---|
| 10 |
prebuild.sh builds Target.o and Ext.o which have to be passed |
|---|
| 11 |
to the linker. For convenience, these *.o files are also merged |
|---|
| 12 |
into a single library libllvm-c-ext.a. |
|---|
| 13 |
|
|---|
| 14 |
Target.o and Ext.o are usually not needed for the regular |
|---|
| 15 |
llvm c interface. But the D bindings add some extra bindings, |
|---|
| 16 |
because the official c interface just doesn't expose all |
|---|
| 17 |
functionality from the c++ interface. These are implemented as a |
|---|
| 18 |
"c++ to c to d" bridge (c++ to c is Target.cpp and Ext.cpp, c to |
|---|
| 19 |
d is Target.d and Ext.d). |
|---|
| 20 |
|
|---|
| 21 |
Building your application: |
|---|
| 22 |
========================== |
|---|
| 23 |
|
|---|
| 24 |
To compile and link a file main.d, run |
|---|
| 25 |
|
|---|
| 26 |
LLVMD=/path/to/llvm-dbindings |
|---|
| 27 |
LLVM_LIBS=`llvm-config --libs | sed 's/-l/-L-l/g'` |
|---|
| 28 |
ldc -I=$LLVMD \ |
|---|
| 29 |
$LLVM_LIBS \ |
|---|
| 30 |
-L=$LLVMD/libllvm-c-ext.a \ |
|---|
| 31 |
-L-ldl -L-lstdc++ -relocation-model=pic \ |
|---|
| 32 |
main.d |
|---|
| 33 |
|
|---|
| 34 |
Parameters: |
|---|
| 35 |
LLVM_LIBS a list of all llvm libraries, formatted for ldc |
|---|
| 36 |
-L=$LLVMD/libllvm-c-ext.a only needed when you use Target.d or Ext.d |
|---|
| 37 |
-L-lstdc++ links in the c++ standard library (llvm at it's core is c++) |
|---|
| 38 |
-relocation-model=pic necessary for calling code in your app from inside of the llvm vm |
|---|