Skip to content

Commit 6ba441e

Browse files
committed
Added documentation for building under Linux.
1 parent 2daffce commit 6ba441e

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

docs/GettingStarted.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,80 @@ Last updated to LLVM/Clang revision: `r202563`
4242
- 32-bit builds: `config=release_x32 make`
4343
- 64-bit builds: `config=release_x64 make`
4444

45+
## Compiling on Linux (experimental)
46+
47+
### Build dependencies:
48+
49+
If you do not have native build tools you can install them first with:
50+
51+
```shell
52+
sudo apt-get install build-essential gcc-multilib g++-multilib
53+
sudo apt-get install ninja-build cmake
54+
```
55+
56+
Additionaly we depent on a somewhat recent version of Mono (.NET 4.5). If you're using an Ubuntu-based distribution you can install an up-to-date version from: https://launchpad.net/~directhex/+archive/monoxide
57+
58+
```shell
59+
sudo add-apt-repository ppa:directhex/monoxide
60+
sudo apt-get update
61+
sudo apt-get install mono-devel
62+
```
63+
64+
### Getting Premake:
65+
66+
Download a recent Premake version from: http://sourceforge.net/projects/premake/files/Premake/nightlies/premake-dev-linux.zip/download
67+
68+
Extract the binary inside `premake5` to `<CppSharp>/build`.
69+
70+
### Cloning CppSharp:
71+
72+
```shell
73+
git clone https://github.com/mono/CppSharp.git
74+
```
75+
76+
### Cloning and building LLVM/Clang:
77+
78+
```shell
79+
pushd && cd CppSharp/deps
80+
81+
git clone https://github.com/llvm-mirror/llvm.git
82+
git clone https://github.com/llvm-mirror/clang.git llvm/tools
83+
84+
cd llvm && mkdir build && cd build
85+
86+
cmake -G Ninja -DCLANG_BUILD_EXAMPLES=false -DCLANG_ENABLE_ARCMT=false \
87+
-DCLANG_ENABLE_REWRITER=false -DCLANG_ENABLE_STATIC_ANALYZER=false \
88+
-DCLANG_INCLUDE_DOCS=false -DCLANG_INCLUDE_TESTS=false \
89+
-DLLVM_BUILD_32_BITS=false -DCLANG_BUILD_DOCS=false \
90+
-DCLANG_BUILD_EXAMPLES=false -DLLVM_TARGETS_TO_BUILD="X86" ..
91+
92+
ninja
93+
popd
94+
```
95+
96+
### Building CppSharp:
97+
98+
```shell
99+
cd CppSharp/build
100+
./premake5 gmake
101+
cd gmake
102+
make
103+
```
104+
105+
This will compile the default target for the architecture, for instance, the `debug_x32` target for 32-bits X86.
106+
107+
You can change the target by invoking `make` as:
108+
109+
```shell
110+
config=release_x32 make
111+
```
112+
113+
Additionaly if you need more verbosity from the builds invoke `make` as:
114+
115+
```shell
116+
verbose=true make
117+
```
118+
45119
## Generating bindings
46120

47121
Suppose we have the following declarations in a file named `Sample.h` and we

0 commit comments

Comments
 (0)