@ -13,17 +13,24 @@ SVN repository urls found here: [http://clang.llvm.org/get_started.html](http://
Git repository urls found here: [http://llvm.org/docs/GettingStarted.html#git-mirror ](http://llvm.org/docs/GettingStarted.html#git-mirror )
Git repository urls found here: [http://llvm.org/docs/GettingStarted.html#git-mirror ](http://llvm.org/docs/GettingStarted.html#git-mirror )
## Compiling on Windows/Visual Studio
## Common setup
1. Clone CppSharp to `<CppSharp>`
1. Clone CppSharp to `<CppSharp>`
2. Clone LLVM to `<CppSharp>\deps\llvm`
2. Clone LLVM to `<CppSharp>\deps\llvm`
3. Clone Clang to `<CppSharp>\deps\llvm\tools\clang`
3. Clone Clang to `<CppSharp>\deps\llvm\tools\clang`
4. Run CMake in `<CppSharp>\deps\llvm\build` and compile solution in *RelWithDebInfo* mode
4. Create directory `<CppSharp>\deps\llvm\build`
5. Run `GenerateProjects.bat` in < CppSharp > \build
6. Build generated solution in *Release* .
Building in *Release* is recommended because else the Clang parser will be
## Compiling on Windows/Visual Studio
excruciatingly slow.
### Compiling LLVM on Windows/Visual Studio
```shell
cd < CppSharp > \deps\llvm\build
cmake -G "Visual Studio 12" -DCLANG_BUILD_EXAMPLES=false -DCLANG_INCLUDE_DOCS=false -DCLANG_INCLUDE_TESTS=false -DCLANG_INCLUDE_DOCS=false -DCLANG_BUILD_EXAMPLES=false -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_INCLUDE_EXAMPLES=false -DLLVM_INCLUDE_DOCS=false -DLLVM_INCLUDE_TESTS=false ..
msbuild LLVM.sln /p:Configuration=RelWithDebInfo;Platform=Win32 /m
```
Last revisions known to work:
Last revisions known to work:
@ -31,6 +38,19 @@ LLVM `r212459` / Git mirror revision `a15d70370edd030198cb42960b62e660b9288f25`.
Clang `r212458` / Git mirror revision `c785591d768074e1666bc306086588b1242d156c` .
Clang `r212458` / Git mirror revision `c785591d768074e1666bc306086588b1242d156c` .
### Compiling CppSharp on Windows/Visual Studio
```shell
cd < CppSharp > \build
generateprojects.bat
msbuild vs2013\CppSharp.sln /p:Configuration=Release;Platform=x86
```
Building in *Release* is recommended because else the Clang parser will be
excruciatingly slow.
It has been reported that running the solution upgrade process under VS 2013 breaks the build due
It has been reported that running the solution upgrade process under VS 2013 breaks the build due
to an incompatibility of .NET versions between projects (4.5 and 4.0). If you experience this
to an incompatibility of .NET versions between projects (4.5 and 4.0). If you experience this
problem you can change the targetted .NET version of the projects to be the same or just do not
problem you can change the targetted .NET version of the projects to be the same or just do not
@ -38,91 +58,82 @@ run the upgrade process after generation.
## Compiling on Mac OS X (experimental)
## Compiling on Mac OS X (experimental)
1. Clone CppSharp to `<CppSharp>`
### Compiling LLVM on Mac OS X
2. Clone LLVM to `<CppSharp>\deps\llvm`
3. Clone Clang to `<CppSharp>\deps\llvm\tools\clang`
1. Compile LLVM solution in *RelWithDebInfo* mode
4. Run CMake in `<CppSharp>\deps\llvm\build` and compile solution in *RelWithDebInfo* mode
The following CMake variables should be enabled:
The following CMake variables should be enabled:
- LLVM_ENABLE_CXX11 (enables C++11 support)
- LLVM_ENABLE_CXX11 (enables C++11 support)
- LLVM_ENABLE_LIBCXX (enables libc++ standard library support)
- LLVM_ENABLE_LIBCXX (enables libc++ standard library support)
- LLVM_BUILD_32_BITS for 32-bit builds (defaults to 64-bit)
- LLVM_BUILD_32_BITS for 32-bit builds (defaults to 64-bit)
5. Run `premake5 gmake` in < CppSharp > \build
6. Build generated makefiles:
### Compiling CppSharp on Mac OS X
1. Run `premake5-osx gmake` in < CppSharp > \build
2. Build generated makefiles:
- 32-bit builds: `config=release_x32 make`
- 32-bit builds: `config=release_x32 make`
- 64-bit builds: `config=release_x64 make`
- 64-bit builds: `config=release_x64 make`
## Compiling on Linux (experimental)
## Compiling on Linux (experimental)
### Build dependencies:
The Linux support is not complete, and these directions are included for developing CppSharp developers.
Only 64bit build works at the moment. The build has been verified on Ubuntu 14.04.
### Compiling LLVM on Linux
If you do not have native build tools you can install them first with:
If you do not have native build tools you can install them first with:
```shell
```shell
sudo apt-get install build-essential gcc-multilib g++-multilib
sudo apt-get install cmake ninja-build build-essential
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
```shell
sudo add-apt-repository ppa:directhex/monoxide
cd deps/llvm/build
sudo apt-get update
sudo apt-get install mono-devel
```
### Getting Premake:
cmake -G Ninja -DCLANG_BUILD_EXAMPLES=false -DCLANG_INCLUDE_DOCS=false -DCLANG_INCLUDE_TESTS=false -DCLANG_INCLUDE_DOCS=false -DCLANG_BUILD_EXAMPLES=false -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_INCLUDE_EXAMPLES=false -DLLVM_INCLUDE_DOCS=false -DLLVM_INCLUDE_TESTS=false ..
Download a recent Premake version from: http://sourceforge.net/projects/premake/files/Premake/nightlies/premake-dev-linux.zip/download
ninja
```
Extract the binary inside `premake5` to `<CppSharp>/build` .
### Compiling CppSharp on Linux
### Cloning CppSharp:
We depend on a somewhat recent version of Mono (.NET 4.5). Ubuntu 14.04 contains recent enough Mono by default.
```shell
```shell
git clone https://github.com/mono/CppSharp.git
sudo apt-get install mono-devel
```
```
### Cloning and building LLVM/Clang:
If you're using a pre-14.04 Ubuntu-based distribution you can install an up-to-date version from: https://launchpad.net/~directhex/+archive/monoxide.
```shell
```shell
pushd & & cd CppSharp/deps
sudo add-apt-repository ppa:directhex/monoxide
sudo apt-get update
git clone https://github.com/llvm-mirror/llvm.git
sudo apt-get install mono-devel
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:
Generate the makefiles, and build CppSharp:
```shell
```shell
cd CppSharp/build
cd < CppSharp > /build
./premake5 gmake
./premake5-linux gmake
cd gmake
make -C gmake config=release_x64
make
```
```
This will compile the default target for the architecture, for instance, the `debug_x32` target for 32-bits X86.
If you need more verbosity from the builds invoke `make` as:
You can change the target by invoking `make` as:
```shell
```shell
config=release_x32 make
verbose=true make -C gmake config=release_x64
```
```
Additionaly if you need more verbosity from the builds invoke `make` as:
Note that at the moment the build fails, as the CppSharp tests fail. However, the library itself has been built fine.
Additionally, you may want to run a very simple test to see that it works. The test needs to find CppSharp library, so cppsharp-test needs to be clone in to the same directory where you cloned CppSharp. Also, the CppSharp directory needs to be named "cppsharp".
```shell
```shell
verbose=true make
git clone git://github.com/tomba/cppsharp-test.git
cd cppsharp-test
make runtest
```
```
## Generating bindings
## Generating bindings