JSBinding / Plugins & Build Mozjswrap Library

There are 2 libraries in Plugins:
  • mozjswrap. This is JSBinding library, it links C# and SpiderMonkey together and adds some supports specially for Unity.
 
For mozjs-31, if you need to rebuild it, go to url above to get more information, or go to Mozilla website, or just email me: answerwinner@gmail.com.
 
For mozjswrap, JSBinding already contains libraries for all supported platforms, so normally you don't need to rebuild this library. 
Steps are written here in case you need them.
 
Download source code
 
for Android (use NDK)
  • 1. rename the folder to jni, after rename, 
jni/
    mozjswrap.cpp
    mozjswrap.h
    Android.mk
  • 2. inside the folder jni/, execute command
        sh gen-android.sh
  • 3. output: ../libs/armeabi-v7a/libmozjswrap.so
 
for Windows, Mac, iOS (use gyp, python, VisualStudio, XCode)
  • 1. Download google gyp. Put the gyp folder here. Like this:
mozjswrap.h
mozjswrap.cpp
gyp/
   gyp_main.py
   LICENSE
 
  • 2. install python 2.7.x. (Mine is 2.7.6)
  • 3. For iOS: open moz.gyp, change js_debug to false. (line 9)
  • 4. build!
Windows: double click gen-msvs2012.bat      output: ./build/Release/bin/mozjswrap.dll
iOS:     bash gen-ios.sh                               output: ./build/Release-iphoneos/libmozjswrap.a
Mac:     bash gen-mac.sh                             output: ./build/Default/mozjswrap.bundle
 
 

posted on 2016-07-06 21:47  AnswerWinner  阅读(476)  评论(0编辑  收藏

导航