Skip to content
This repository has been archived by the owner on Nov 9, 2019. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisber committed Apr 11, 2015
1 parent e5eb327 commit 333aa84
Showing 1 changed file with 4 additions and 73 deletions.
77 changes: 4 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,11 @@ Install Xcode IDE 6.x
V8dotnet is based on the Mono Runtime <= 3.10.0. To install the Runtime 3.10.0 together with [Monodevelop](http://www.monodevelop.com/download/) on Ubuntu


##Building with the V8.Net Buildscript
Add gyp and c/c++/linking configuration to your environment.
##Building with the V8.Net build script
.

For debian systems export:
```
export GYP_DEFINES="clang=1"
export CXX="`which clang++` -v -std=c++11 -stdlib=libstdc++"
export CC="`which clang` -v "
export CPP="`which clang` -E -v "
export LINK="`which clang++` -v -std=c++11 -stdlib=libstdc++"
export CXX_host="`which clang++` -v "
export CC_host="`which clang` -v "
export CPP_host="`which clang` -E -v "
export LINK_host="`which clang++` -v "
```

For mac osx:

To build on OSX you need to export:
```
export CXX=/usr/local/bin/g++-4.9
export LINK=/usr/local/bin/g++-4.9
Expand All @@ -191,72 +179,15 @@ Form more build option use: `./build_V8_Net.sh --help`



##Building V8.Net manually

This project contains Csharp and cpp projects. We are using MonoDevelop to build the Csharp projects and gyp to build the cpp project.

1. Clone the project
- `git clone [email protected]:chrisber/v8dotnet.git`
- `cd v8dotnet`
- `git submodule update --init --recursive`

2. Building Google V8
- `cd Source/V8.NET-Proxy/V8/`
- `make builddeps -j 2` (2 equals the number of cpu cores available)
- `make library=shared -j 2`

5. Build V8.NET-Proxy this step build the native library. On Windows OS the library is called `V8_Net_Proxy_x64.dll` on Linux it is called `libV8_Net_Proxy.so`.
The g++ option to compile `libV8_Net_Proxy.so` are:
`'cflags':[ '-Werror -Wall -std=c++11 -w -fpermissive -fPIC -c',],`
The linke options are:
`'ldflags':[ '-Wall -std=c++11 -shared -fPIC',],`
`'libraries:['-Wl,-rpath,. -L. -L../ -lpthread -lstdc++ -lv8 -licui18n -licuuc -lglib-2.0 -lrt libgmock.a ...*a']`
Compiling:
```
ls | grep cpp | awk -F. '{ system("g++ -std=c++11 -w -fpermissive -fPIC -Wl,--gc-sections-c -IV8/ "$1".cpp -o out/"$1".o ") }
```
Linking:
```g++ -Wall -std=c++11 -shared -fPIC -I../ -I../V8/ -Wl,-soname,libV8_Net_Proxy.so -o libV8_Net_Proxy.so *.o ../V8/out/native/obj.host/testing/libgtest.a ../V8/out/native/obj.target/testing/libgmock.a ../V8/out/native/obj.target/testing/libgtest.a ../V8/out/native/obj.target/third_party/icu/libicudata.a ../V8/out/native/obj.target/tools/gyp/libv8_base.a ../V8/out/native/obj.target/tools/gyp/libv8_libbase.a ../V8/out/native/obj.target/tools/gyp/libv8_libplatform.a ../V8/out/native/obj.target/tools/gyp/libv8_nosnapshot.a ../V8/out/native/obj.target/tools/gyp/libv8_snapshot.a -Wl,-rpath,. -L. -L../ -lpthread -lstdc++ -licui18n -licuuc -lv8 -lglib-2.0 -lrt -Wl,--verbose```

Or use the provided v8dotnet.gyp file for compiling and linking the shared library.
```
./gyp/gyp -Dbase_dir=`pwd` -Dtarget_arch="x64" -Dbuild_option="release" -f make --depth=. v8dotnet.gyp --generator-output=./Build/x64.release/makefiles
V=1 make -C ./Build/x64.release/makefiles
```

6. Now we can build the C# projects. Build the `V8.Net.MonoDevelop.sln` via MonoDevelop or with the command:

7. `xbuild /p:Configuration=Release Source/V8.Net.MonoDevelop.sln"`

8. The last step is to copy all files into one directory

9. Release Directory
- libicui18n.so
- libicuuc.so
- libv8.so
- libV8_Net_Proxy.so
- V8.Net.dll
- V8.Net.Proxy.Interface.dll
- V8.Net.SharedTypes.dll
- V8.Net-Console.exe
10. Start it with `mono V8.Net-Console.exe`.
11. For debugging errors these commands can be helpful.
- `LD_LIBRARY_PATH="pwd" MONO_LOG_LEVEL=debug MONO_LOG_MASK=all mono V8.Net-Console.exe` for checking if the library gets loaded.
- `nm -u -C libV8_Net_Proxy.so` checking for undefined symboles.

#Using V8.Net with Mono
###Loading the libV8_Net_Proxy.so library
There are three possibilities to load the library
- adding it in the same place where the executable is. For instance:
- V8.Net-Console.exe
- libicui18n.so
- libicuuc.so
- libv8.so
- libV8_Net_Proxy.so
- adding it in the /usr/lib directory
- libicui18n.so
- libicuuc.so
- libv8.so
- libV8_Net_Proxy.so
- or setting the `LD_LIBRARY_PATH="pwd" path.

Expand Down

0 comments on commit 333aa84

Please sign in to comment.