Skip to content

Commit

Permalink
Added documentation for building under Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
tritao committed Apr 7, 2014
1 parent 2daffce commit 6ba441e
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,80 @@ Last updated to LLVM/Clang revision: `r202563`
- 32-bit builds: `config=release_x32 make`
- 64-bit builds: `config=release_x64 make`

## Compiling on Linux (experimental)

### Build dependencies:

If you do not have native build tools you can install them first with:

```shell
sudo apt-get install build-essential gcc-multilib g++-multilib
sudo apt-get install ninja-build cmake
```

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

```shell
sudo add-apt-repository ppa:directhex/monoxide
sudo apt-get update
sudo apt-get install mono-devel
```

### Getting Premake:

Download a recent Premake version from: http://sourceforge.net/projects/premake/files/Premake/nightlies/premake-dev-linux.zip/download

Extract the binary inside `premake5` to `<CppSharp>/build`.

### Cloning CppSharp:

```shell
git clone https://github.com/mono/CppSharp.git
```

### Cloning and building LLVM/Clang:

```shell
pushd && cd CppSharp/deps

git clone https://github.com/llvm-mirror/llvm.git
git clone https://github.com/llvm-mirror/clang.git llvm/tools

cd llvm && mkdir build && cd build

cmake -G Ninja -DCLANG_BUILD_EXAMPLES=false -DCLANG_ENABLE_ARCMT=false \
-DCLANG_ENABLE_REWRITER=false -DCLANG_ENABLE_STATIC_ANALYZER=false \
-DCLANG_INCLUDE_DOCS=false -DCLANG_INCLUDE_TESTS=false \
-DLLVM_BUILD_32_BITS=false -DCLANG_BUILD_DOCS=false \
-DCLANG_BUILD_EXAMPLES=false -DLLVM_TARGETS_TO_BUILD="X86" ..

ninja
popd
```

### Building CppSharp:

```shell
cd CppSharp/build
./premake5 gmake
cd gmake
make
```

This will compile the default target for the architecture, for instance, the `debug_x32` target for 32-bits X86.

You can change the target by invoking `make` as:

```shell
config=release_x32 make
```

Additionaly if you need more verbosity from the builds invoke `make` as:

```shell
verbose=true make
```

## Generating bindings

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

4 comments on commit 6ba441e

@tritao
Copy link
Collaborator Author

@tritao tritao commented on 6ba441e Apr 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity CppSharp :: VS2012 Build 978 is now running

@tritao
Copy link
Collaborator Author

@tritao tritao commented on 6ba441e Apr 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity CppSharp :: VS2012 Build 978 outcome was SUCCESS
Summary: Tests passed: 63, ignored: 2 Build time: 0:0:0

@tritao
Copy link
Collaborator Author

@tritao tritao commented on 6ba441e Apr 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity CppSharp :: VS2012_NewParser Build 328 is now running

@tritao
Copy link
Collaborator Author

@tritao tritao commented on 6ba441e Apr 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity CppSharp :: VS2012_NewParser Build 328 outcome was FAILURE
Summary: Compilation error: build\vs2012\projects\Basic.CLI.vcxproj (new); compilation error: build\vs2012\CppSharp.sln (new) Build time: 0:0:0

Please sign in to comment.