use VRPN on GearVR, or porting VRPN from win64/win32 to Android

1、 VRPN include .lib static library On Win64/Win32 plateform,if u need it running On Android,U need to convert to Linux Plateform as a .so dynamic library or .a static library

You may need to install the enviroment of MinGW (Minimalist GNU on Windows) 可在windows下编译linux程序的仿真linux编译环境,它提供了linux下的C、C++头文件、系统库和一些linux下的编译工具集合如gcc、g++和make工具 mingw-w64-install.zip or mingw-get-setup.exe (version 0.6.2, win32)

Installer step:
1. "MinGW Installation Manager"  Select the package you wish to manage,include  " Basic Setup" and " All Packages", GCC need 3 tools: MinGW base toolsg++ compilerMinGW Make. open the Installation menu and select the " Apply Changes" operation.
2. Ensure that MSYS knows where MinGW is located,  located to path "E:\Program Files\MinGW\mingw-win32\msys\1.0\etc\fstab", and ensure "fstab" contains one line:
     "E:/Program Files/MinGW/mingw-win32    /mingw".
3. Environment Settings
  • Right-click on your "My Computer" icon and select "Properties". Click on the "Advanced" tab, then on the "Environment Variables" button.
  • You should be presented with a dialog box with two text boxes. The top box shows your user settings. The PATH entry in this box is the one you want to modify. Note that the bottom text box allows you to change the system PATH variable. You should not alter the system path variable in any manner, or you will cause all sorts of problems for you and your computer!
  • Click on the PATH entry in the TOP box, then click on the "Edit" button
  • Scroll to the end of the string and at the end add “
    ;<installation-directory>\bin
  • press OK -> OK -> OK and you are done.

 

转换工具 mingw-utils-0.3.tar ,get "\bin\reimp.exe" copyTo "mingw\bin\",或者将 reimp.exe 拷贝到将要转换的 .lib 目录。

use rimp.exe convert .lib to .a
C:\Users\admin>E:
E:\>
E:\>cd Plugins\RTSPlugin\Source\ThirdParty\Vrpn\Lib\VS2015
E:\Plugins\RTSPlugin\Source\ThirdParty\Vrpn\Lib\VS2015>
E:\Plugins\RTSPlugin\Source\ThirdParty\Vrpn\Lib\VS2015> reimp quat.lib
E:\Plugins\RTSPlugin\Source\ThirdParty\Vrpn\Lib\VS2015> reimp gpsnmea.lib
E:\Plugins\RTSPlugin\Source\ThirdParty\Vrpn\Lib\VS2015> reimp vrpn.lib
E:\Plugins\RTSPlugin\Source\ThirdParty\Vrpn\Lib\VS2015> reimp vrpn_HID_device_watcher.lib
E:\Plugins\RTSPlugin\Source\ThirdParty\Vrpn\Lib\VS2015> reimp vrpn_server.lib
E:\Plugins\RTSPlugin\Source\ThirdParty\Vrpn\Lib\VS2015> reimp vrpn_timecode_generator.lib
E:\Plugins\RTSPlugin\Source\ThirdParty\Vrpn\Lib\VS2015> reimp vrpnserver.lib

reimp consle help ( if u genarated .obj file ,you can use "dlltool quat.obj -l quat.a" to genarated .a file ):
Usage: reimp [options] IMPLIB
  -s, --dump-symbols      dump symbols to stdout
  -d, --only-def          only create .def files
  -c, --keep-case         keep case in lib*.a file names
  --dlltool <name>        use <name> for dlltool
  --as <name>             use <name> for assembler
Readme for reimp

* Overview
`reimp' is a tool to convert Microsoft's new-style (short) import libraries to import libraries for win32 ports of GNU tools (mingw32,cygwin).
`reimp' reads an MS import library and writes all imports to the corresponding .DEF file(s) that it feeds to `dlltool' that creates the import library.

* Invocation
Usage: reimp [options] IMPLIB

Options:
-s, --dump-symbols dump symbols to stdout
-d, --only-def only create .def files
-c, --keep-case keep case in lib*.a file names
--dlltool use for dlltool
--as use for assembler

The `--dump-symbols' option makes `reimp' use a quick method for
finding imported symbols and sending the names of found symbols to
stdout. If the input library contain non-imported symbols they will be
listed as well. The output symbols will have all decoration preserved
(i.e '_' will prefix most symbols), so if you feed it to dlltool you
should strip leading underscores. For example
echo EXPORTS > imp.def
reimp imp.lib | sed 's/_//' >> imp.def
dlltool -k --def imp.def --output-lib libimp.a --dllname imp.dll
The `--only-def' option makes `reimp' stop after generating the .DEF
file(s).
By default `reimp' converts all output library names to lower-case. By
using the `keep-case' option `reimp' will use exactly the case of the
DLL imported from when creating an import library. KERNEL32.dll will
generate libKERNEL32.a and not libkernel32.a as it would be default.

* Notes on mixed libraries
If an input library contain regular objects (non-imports, i.e code and
data) `reimp' will write out those objects unless you specify one of
the `--only-def' and `--dump-symbols' options. You probably want to
include those objects as well in the generated library. `reimp'
doesn't do that automatically so you have to do it manually using `ar', like this
# this generates several .o or .obj files.
reimp imp.lib
# add them to library
ar rcs libimp.a *.obj

OR

use "lib2a" (LIB to A converter) Free Open Source program - GNU GPL Licence.

This tool automatically converts a .LIB file (MS Visual C linker library) into .A file (MinGW linker library).
It is useful to make a C/C++ program a reusable component.

I have written it because I did not have found a such tool over the Net.

The main program is LIB2A.bat that performs successive stages for converting .LIB file to .A file into in the "convert" folder.

How it works

The conversion process is accomplished in several steps:
1. Copy your .LIB file and .DLL file into the "convert" folder.
1. Edit and replace the files names in the four first lines at the LIB2A.bat.
1. Run LIB2A.bat.

You can find your .A linker library into the "convert" folder.

 2、UE4 Create a Blank C++ Project, Open the Item "Edit" > "Plugin" > "New Plugin", choose a template and then specify a name to create a new plugin.

Blank: 创建一个空白的 最少量代码的 Plugin, 合并或者建立一个非可视化的 Plugin。在 Plugin list 可以看到该插件。

Content Only: 创建一个只包含内容的 Plugin。

Blueprint library: 创建一个包含 BlueprintFunctionLibrary 的 Plugin。用于创建一个静态的蓝图节点。

Editor Toolbar Button: 创建一个可以在 LevelEditor 的工具栏 添加 button 的 Plugin,然后创建并实现该 button 的 "OnButtonClick" event.

Editor Standalone Window: 创建一个可在 LevelEditor 工具栏添加 button 的Plugin,点击 button 将唤醒一个空的 独立选项卡窗口。

Editor Mode: 创建一个编辑器模式的 Plugin,将包含一个工具包示例,指定显示在 “Modes” 标签的 UI。还将包含基本的 UI 说明 editor 交互 和 undo/redo 功能的使用。

Thridparty Library:创建一个包含第三方库的 Plugin,包含了一个howTo include、load、use 第三方库的示例。

 this is my RTS Plugin folder:
 
 Plugins\RTS\Source\ThirdParty\RTSLibrary

 

打包 Android / Linux 平台 UE4 Plugin link 第三方库:将转换成 .a /.so (此处为 vrpn.a)放入 “Plugins\RTS\Source\ThirdParty\RTSLibrary\Android” 目录;

打包 Mac 平台 UE4 Plugin link 第三方库 : 将转换成 .dylib (此处为 libExampleLibrary.dylib)放入 “Plugins\RTS\Source\ThirdParty\RTSLibrary\Mac\Release” 目录;

打包 Win64/Win32 平台 UE4 Plugin link 第三方库:将转换成 .lib/.dll(此处为 vrpn.lib)放入 “Plugins\RTS\Source\ThirdParty\RTSLibrary\x64” 目录;

 在 RTS plugin

未完待续....

猜你喜欢

转载自avi.iteye.com/blog/2392410