swigtutorialadditional.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html><head><title>Swig Extras Tutorial</title>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  4. <link href="RaknetManual.css" rel="stylesheet" type="text/css">
  5. <meta name="title" content="RakNet - Advanced multiplayer game networking API">
  6. <meta http-equiv="content-type" content="text/html; charset=utf-8"></head>
  7. <body leftmargin="0" topmargin="0" style="background-color: rgb(255, 255, 255);" alink="#003399" link="#003399" marginheight="0" marginwidth="0" vlink="#003399">
  8. <img src="RakNet_Icon_Final-copy.jpg" alt="Oculus VR, Inc." height="150" width="150"><br>
  9. <br>
  10. <br>
  11. <table border="0" width="100%">
  12. <tbody>
  13. <tr>
  14. <td class="RakNetWhiteHeader" bgcolor="#2c5d92"><img src="spacer.gif" height="1" width="8">Overview</td>
  15. </tr>
  16. </tbody>
  17. </table>
  18. <table border="0" cellpadding="10" cellspacing="0" width="100%">
  19. <tbody>
  20. <tr>
  21. <td> <span class="RakNetBlueHeader"></span>This
  22. file contains additional instructions for using Swig with the optional
  23. dependent extension options.<br>
  24. <br>
  25. The base instructions are available in the <a href="swigtutorial.html">Swig Tutorial</a><br>
  26. <span class="RakNetBlueHeader"></span><span class="RakNetBlueHeader"></span><span class="RakNetBlueHeader"></span><span style="font-weight: bold;"></span><span style="font-weight: bold;"></span><span style="font-weight: bold;"></span><span style="font-weight: bold;"></span><span style="font-weight: bold;"></span><span class="RakNetBlueHeader"></span></td>
  27. </tr>
  28. </tbody>
  29. </table>
  30. <table border="0" width="100%">
  31. <tbody>
  32. <tr>
  33. <td class="RakNetWhiteHeader" bgcolor="#2c5d92"><img src="spacer.gif" height="1" width="8">Autopatcher
  34. MySql Version</td>
  35. </tr>
  36. </tbody>
  37. </table>
  38. <table border="0" cellpadding="10" cellspacing="0" width="100%">
  39. <tbody>
  40. <tr>
  41. <td> <span class="RakNetBlueHeader"><font size="+2">Windows</font><br>
  42. <br>
  43. <span class="RakNetManualTextBody">The below
  44. instructions detail the extra configuration needed on the Visual Studio
  45. Project.</span><br>
  46. <br>
  47. Extra Project Options<br>
  48. <br>
  49. </span><span class="RakNetManualTextBody">Under
  50. General-&gt;Common Language Runtime support the option needs to be
  51. set to No Common Language Runtime support</span><span class="RakNetBlueHeader"><br class="RakNetManualTextBody">
  52. <br>
  53. Additional Include Directories<br>
  54. <br>
  55. </span><span class="RakNetManualTextBody">Under
  56. Dependent Extensions the following additional directories need to be in
  57. the include configuration.<br>
  58. <br>
  59. -Autopatcher/AutopatcherMySQLRepository<br>
  60. -Autopatcher<br>
  61. -bzip2-1.0.3<br>
  62. -MySQLInterface<br>
  63. <br>
  64. MySql header directory needs to be included.<br>
  65. <br>
  66. For 5.1 on Vista the directory looks like: C:\Program Files
  67. (x86)\MySQL\MySQL Server 5.1\include</span><span class="RakNetBlueHeader"><br class="RakNetManualTextBody">
  68. <br>
  69. Additional sources<br>
  70. <br>
  71. </span><span class="RakNetManualTextBody">Under
  72. Dependent Extensions the following additional source files need to be
  73. included in the project.<br>
  74. <br>
  75. </span><span class="RakNetManualTextBody">-bzip2-1.0.3/blocksort.c<br>
  76. -</span><span class="RakNetManualTextBody">bzip2-1.0.3/</span><span class="RakNetManualTextBody">bzip2.c<br>
  77. -</span><span class="RakNetManualTextBody">bzip2-1.0.3/</span><span class="RakNetManualTextBody">bzlib.c<br>
  78. -</span><span class="RakNetManualTextBody">bzip2-1.0.3/</span><span class="RakNetManualTextBody">compress.c<br>
  79. -</span><span class="RakNetManualTextBody">bzip2-1.0.3/</span><span class="RakNetManualTextBody">crctable.c<br>
  80. -</span><span class="RakNetManualTextBody">bzip2-1.0.3/</span><span class="RakNetManualTextBody">decompress.c<br>
  81. -</span><span class="RakNetManualTextBody">bzip2-1.0.3/</span><span class="RakNetManualTextBody">dlltest.c<br>
  82. -</span><span class="RakNetManualTextBody">bzip2-1.0.3/</span><span class="RakNetManualTextBody">huffman.c<br>
  83. -</span><span class="RakNetManualTextBody">bzip2-1.0.3/</span><span class="RakNetManualTextBody">randtable.c<br>
  84. <br>
  85. -Autopatcher/ApplyPatch.cpp<br>
  86. -</span><span class="RakNetManualTextBody">Autopatcher/</span><span class="RakNetManualTextBody">AutopatcherClient.cpp<br>
  87. -</span><span class="RakNetManualTextBody">Autopatcher/</span><span class="RakNetManualTextBody">AutopatcherMySQLRepository/</span><span class="RakNetManualTextBody">AutopatcherMySQLRepository.cpp<br>
  88. -</span><span class="RakNetManualTextBody">Autopatcher/</span><span class="RakNetManualTextBody">AutopatcherServer.cpp<br>
  89. -</span><span class="RakNetManualTextBody">Autopatcher/</span><span class="RakNetManualTextBody">CreatePatch.cpp<br>
  90. -</span><span class="RakNetManualTextBody">Autopatcher/</span><span class="RakNetManualTextBody">MemoryCompressor.cpp<br>
  91. -</span><span class="RakNetManualTextBody">MySQLInterface/</span><span class="RakNetManualTextBody">MySQLInterface.cpp<br>
  92. <br>
  93. Additional Libraries<br>
  94. <br>
  95. </span><span class="RakNetManualTextBody">The
  96. MySql library needs to be included.</span><br>
  97. <span class="RakNetManualTextBody"><br>
  98. </span><span class="RakNetManualTextBody">For
  99. 5.1 on Vista the location looks like:<br>
  100. <br>
  101. </span><span class="RakNetManualTextBody">For
  102. debug:<br>
  103. C:\Program Files (x86)\MySQL\MySQL Server 5.1\lib\debug\libmysql.lib<br>
  104. <br>
  105. </span><span class="RakNetManualTextBody">For
  106. release:<br>
  107. C:\Program Files (x86)\MySQL\MySQL Server 5.1\lib\opt\libmysql.lib</span><br>
  108. <ol>
  109. </ol>
  110. <span class="RakNetBlueHeader">Replacement Swig File Generation Tool Steps<br>
  111. <br>
  112. <span class="RakNetManualTextBody">These are
  113. replacement steps. If the dll project is used the PreBuild.bat needs to
  114. be modified, the last steps are instructions on how to do that.</span><br>
  115. </span>
  116. <ol>
  117. <li>Click the start menu and click on run. In Vista click
  118. start-&gt;search&nbsp;type "run" hit enter.</li>
  119. <li>Type cmd and hit enter.</li>
  120. <li>In the next command PATH_TO_RAKNET_SWIG_FILES is the
  121. path to
  122. the swig directory. For example C:\RakNet\DependentExtensions\Swig</li>
  123. <li>Type cd&nbsp;PATH_TO_RAKNET_SWIG_FILES hit enter</li>
  124. <li>In the next command PATH_TO_RAKNETSOURCE is the path
  125. to the swig source directory. For example: C:\RakNet\Source.
  126. PATH_TO_SWIG is an unquoted path with a trailing slash to
  127. the&nbsp;Swig directory Example: C:\Swig\. If you added swig to
  128. your path variable then&nbsp;PATH_TO_SWIG is not needed and can be
  129. ignored or set to "".&nbsp;PATH_TO_DEPENDENTEXTENSIONS is the path
  130. to the Dependent Extensions directory Example:
  131. C:\RakNet\DependentExtensions. OPTION1 in this case will be
  132. MYSQL_AUTOPATCHER.</li>
  133. <li>Type MakeSwigWithExtras.bat
  134. PATH_TO_RAKNETSOURCE&nbsp;PATH_TO_SWIG PATH_TO_DEPENDENTEXTENSIONS
  135. OPTION1
  136. hit enter<br>
  137. </li>
  138. <div id="ExtraInstructions1" name="ExtraInstructions1" style="display: none;"><li>If you want to use
  139. SQLiteClientLoggerPlugin skip #6, the next steps will be used instead.</li>
  140. <li>If you have added swig to your path variable, just
  141. use "" for PATH_TO_SWIG</li>
  142. <li>PATH_TO_SQLITEPLUGIN is the path to the SQLite plugin
  143. directory. EX: C:\RakNet\DependentExtensions\SQLite3Plugin</li>
  144. <li>Type MakeSwig.bat
  145. PATH_TO_RAKNETSOURCE&nbsp;PATH_TO_SWIG
  146. &nbsp;PATH_TO_SQLITEPLUGIN hit enter</li>
  147. </div>
  148. <li>If you are not using the DLL_Swig project goto
  149. "Creating the Swig Wrapped DLL Project"&nbsp;in the <a href="swigtutorial.html">Swig Tutorial</a></li>
  150. <li>If you are using the DLL_Swig project, in the project
  151. directory there is a file called Prebuild.bat, open it for editing.</li>
  152. <li>Replace the line "MakeSwig.bat "../../Source"" with
  153. the command created in these steps.</li>
  154. <li>Now goto "Creating the Swig Wrapped DLL
  155. Project"&nbsp;in the <a href="swigtutorial.html">Swig
  156. Tutorial</a>. Make sure the extra configuration in this help file is followed.</li>
  157. </ol>
  158. <span class="RakNetBlueHeader"></span><span class="RakNetBlueHeader">
  159. <br>
  160. Replacement Swig File Generation Manual Steps<br>
  161. </span>
  162. <ol>
  163. <li>Click the start menu and click on run. In Vista click
  164. start-&gt;search&nbsp;type "run" hit enter.</li>
  165. <li>Type cmd and hit enter.</li>
  166. <li>In the next command PATH_TO_RAKNET_SWIG_FILES is the
  167. path to
  168. the swig directory. For example C:\RakNet\DependentExtensions\Swig</li>
  169. <li>Type cd&nbsp;PATH_TO_RAKNET_SWIG_FILES hit enter</li>
  170. <li>In the next command PATH_TO_RAKNETSOURCE is the path
  171. to the swig source directory. For example:
  172. C:\RakNet\Source.&nbsp;PATH_TO_DEPENDENTEXTENSIONS
  173. is the path to the Dependent Extensions directory Example:
  174. C:\RakNet\DependentExtensions. </li>
  175. <li>Type&nbsp;C:\Swig\swig -c++ -csharp -namespace
  176. RakNet -I"PATH_TO_RAKNETSOURCE" -I"SwigInterfaceFiles"
  177. -I"PATH_TO_DEPENDENTEXTENSIONS"
  178. -DSWIG_ADDITIONAL_AUTOPATCHER_MYSQL -outdir SwigOutput\SwigCSharpOutput
  179. -o SwigOutput\CplusDLLIncludes\RakNet_wrap.cxx
  180. SwigInterfaceFiles\RakNet.i
  181. hit enter</li><li>Goto "Creating the Swig DLL" in&nbsp;the <a href="swigtutorial.html">Swig Tutorial</a>. Make sure the extra configuration in this help file is followed.<a href="swigtutorial.html"></a></li>
  182. </ol>
  183. <span class="RakNetBlueHeader"></span><span class="RakNetBlueHeader"><font size="+2">Linux</font></span><br><br><span class="RakNetBlueHeader">Replacement Swig File Tool Steps<br><br></span><span class="RakNetBlueHeader">
  184. <span class="RakNetManualTextBody">Note: The Linux
  185. batch <span class="RakNetBlueHeader"></span><span class="RakNetBlueHeader"></span>requires Wget,Tar,Make
  186. and GCC&nbsp; to be installed, unless swig is already installed.
  187. Most of the time </span></span><span class="RakNetBlueHeader"><span class="RakNetManualTextBody">Wget,Tar,Make and GCC are</span></span><span class="RakNetBlueHeader"><span class="RakNetManualTextBody"> already installed.</span><br>
  188. </span>
  189. <ol><li>Open a terminal if you are not already at one.<br>
  190. </li><li>In the next command PATH_TO_RAKNET_SWIG_FILES is the
  191. path to
  192. the swig directory. For example
  193. /home/usr/RakNet/DependentExtensions/Swig</li><li>Type cd&nbsp;PATH_TO_RAKNET_SWIG_FILES hit enter</li><li>Type chmod u+x MakeSwig.sh<br>
  194. </li><li>In the next command PATH_TO_RAKNETSOURCE is the path
  195. to the swig source directory. For
  196. example:&nbsp;/home/usr/RakNet/Source.&nbsp;PATH_TO_DEPENDENTEXTENSIONS is the path
  197. to the Dependent Extensions directory Example:&nbsp;/home/usr/RakNet/DependentExtensions. OPTION1 in this case will be
  198. MYSQL_AUTOPATCHER.</li><li>Type MakeSwigWithExtras.sh
  199. PATH_TO_RAKNETSOURCE &nbsp;PATH_TO_DEPENDENTEXTENSIONS
  200. OPTION1
  201. hit enter</li><div id="ExtraInstructions2" name="ExtraInstructions2" style="display: none;"><li>If you want to use
  202. SQLiteClientLoggerPlugin skip #6, the next steps will be used instead.<br>
  203. </li>
  204. <li>PATH_TO_SQLITEPLUGIN is the path to the SQLite plugin
  205. directory.
  206. EX:&nbsp;/home/usr/RakNet/DependentExtensions/SQLite3Plugin<br>
  207. </li>
  208. <li>Type MakeSwig.sh
  209. PATH_TO_RAKNETSOURCE&nbsp;PATH_TO_SQLITEPLUGIN hit enter<br>
  210. </li>
  211. </div><li>Skip to "Creating the C# project" in the <a href="swigtutorial.html">Swig Tutorial</a>.&nbsp;
  212. &nbsp;</li></ol><br><span class="RakNetBlueHeader">Replacement Manual Swig File Generation Steps</span><br><br>
  213. <ol><li>Open a terminal<br>
  214. </li><li>In the next command PATH_TO_RAKNET_SWIG_FILES is the
  215. path to
  216. the swig directory. For example
  217. /home/usr/RakNet/DependentExtensions/Swig</li><li>Type cd&nbsp;PATH_TO_RAKNET_SWIG_FILES hit enter</li><li>In the next command PATH_TO_RAKNETSOURCE is the path
  218. to the swig source directory. For example: /home/usr/RakNet/Source</li><li>Type swig -c++ -csharp -namespace RakNet
  219. -I"PATH_TO_RAKNETSOURCE"
  220. -I"SwigInterfaceFiles" -outdir SwigOutput/SwigCSharpOutput -o
  221. SwigOutput/CplusDLLIncludes/RakNet_wrap.cxx SwigInterfaceFiles/RakNet.i
  222. and hit enter</li><li>Goto the next section below.</li></ol><p class="RakNetBlueHeader">Replacement Creating the
  223. Swig&nbsp; Dynamic Link Steps</p>
  224. <p class="RakNetBlueHeader"><span class="RakNetManualTextBody">Note:
  225. If you ran the linux batch tool it will have made the dynamic link and
  226. attempted to install it, so you may skip these steps if it ran
  227. successfully.</span><br>
  228. </p>
  229. <ol><li>In the next command PATH_TO_RAKNET_SWIG_FILES is the
  230. path to
  231. the swig directory.&nbsp;<span style="font-size: 12pt; font-family: &quot;Times New Roman&quot;;">
  232. EX:: </span>../DependentExtensions/Swig<span style="font-size: 12pt; font-family: &quot;Times New Roman&quot;;"></span></li><li>In
  233. the next command PATH_TO_DEPENDENTEXTENSIONS is the path to the
  234. Dependent Extensions directory. EX: /home/usr/RakNet/DependentExtensions</li><li>First
  235. we need to compile the C files seperatly with GCC in C mode type the
  236. following command and hit enter: gcc
  237. -c&nbsp;PATH_TO_DEPENDENTEXTENSIONS/bzip2-1.0.3/blocksort.c&nbsp;PATH_TO_DEPENDENTEXTENSIONS/bzip2-1.0.3/bzip2.c&nbsp;PATH_TO_DEPENDENTEXTENSIONS/bzip2-1.0.3/bzlib.c&nbsp;PATH_TO_DEPENDENTEXTENSIONS/bzip2-1.0.3/compress.c&nbsp;PATH_TO_DEPENDENTEXTENSIONS/bzip2-1.0.3/crctable.c&nbsp;PATH_TO_DEPENDENTEXTENSIONS/bzip2-1.0.3/decompress.c&nbsp;PATH_TO_DEPENDENTEXTENSIONS/bzip2-1.0.3/dlltest.c&nbsp;PATH_TO_DEPENDENTEXTENSIONS/bzip2-1.0.3/huffman.c
  238. $2/bzip2-1.0.3/randtable.c<br></li><li>Now we use those object files
  239. and compile the C++ files with C++ mode type the following command and
  240. hit enter: g++
  241. *.cpp&nbsp;PATH_TO_RAKNET_SWIG_FILE/SwigOutput/CplusDLLIncludes/RakNet_wrap.cxx
  242. blocksort.o bzip2.o bzlib.o compress.o crctable.o decompress.o
  243. dlltest.o huffman.o
  244. randtable.o&nbsp;PATH_TO_DEPENDENTEXTENSIONS/Autopatcher/ApplyPatch.cpp&nbsp;PATH_TO_DEPENDENTEXTENSIONS/Autopatcher/AutopatcherClient.cpp&nbsp;PATH_TO_DEPENDENTEXTENSIONS/Autopatcher/AutopatcherMySQLRepository/AutopatcherMySQLRepository.cpp&nbsp;PATH_TO_DEPENDENTEXTENSIONS/Autopatcher/AutopatcherServer.cpp&nbsp;PATH_TO_DEPENDENTEXTENSIONS/Autopatcher/CreatePatch.cpp&nbsp;PATH_TO_DEPENDENTEXTENSIONS/Autopatcher/MemoryCompressor.cpp&nbsp;PATH_TO_DEPENDENTEXTENSIONS/MySQLInterface/MySQLInterface.cpp&nbsp;
  245. -l pthread -lmysqlclient -I/usr/include/mysql/ -I./
  246. -IPATH_TO_DEPENDENTEXTENSIONS/Autopatcher/AutopatcherMySQLRepository
  247. -IPATH_TO_DEPENDENTEXTENSIONS/Autopatcher
  248. -IPATH_TO_DEPENDENTEXTENSIONS/bzip2-1.0.3
  249. -IPATH_TO_DEPENDENTEXTENSIONS/MySQLInterface -shared -o RakNet&nbsp;
  250. &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</li><li>Note: In the previous command -l pthread is lower
  251. case L while -I./ is uppercase i.</li><div id="ExtraInstructions6" name="ExtraInstructions6" style="display: none;"><li>If you wish to use
  252. SQLiteClientLoggerPlugin in the place of #2 use the below instructions</li>
  253. <li>&nbsp;PATH_TO_SQLITEPLUGIN is the path to the
  254. SQLite plugin directory. EX:
  255. /home/usr/RakNet/DependentExtensions/SQLite3Plugin</li>
  256. <li>g++
  257. *.cpp&nbsp;PATH_TO_RAKNET_SWIG_FILES/SwigOutput/CplusDLLIncludes/RakNet_wrap.cxx
  258. PATH_TO_SQLITEPLUGIN\SQLite3ClientPlugin.cpp&nbsp;
  259. PATH_TO_SQLITEPLUGIN \SQLite3PLuginCommon.cpp&nbsp;
  260. PATH_TO_SQLITEPLUGIN
  261. \Logger\ClientOnly\SQLiteClientLoggerPlugin.cpp&nbsp;
  262. PATH_TO_SQLITEPLUGIN \Logger\SQLliteLoggerCommon.cpp&nbsp; -l
  263. pthread
  264. -I./&nbsp;-IPATH_TO_SQLITEPLUGIN\Logger\ClientOnly&nbsp;-IPATH_TO_SQLITEPLUGIN\Logger&nbsp;-IPATH_TO_SQLITEPLUGIN
  265. -shared -o RakNet</li>
  266. </div><li>A file called RakNet should be created that will be
  267. copied in the next section</li><li>Go to "Creating the C# project" in the <a href="swigtutorial.html">Swig Tutorial</a>.<a href="swigtutorial.html"></a></li></ol><br><span class="RakNetBlueHeader">
  268. <br>
  269. </span></td>
  270. </tr>
  271. </tbody>
  272. </table>
  273. <br>
  274. <table border="0" width="100%">
  275. <tbody>
  276. <tr>
  277. <td class="RakNetWhiteHeader" bgcolor="#2c5d92"><img src="spacer.gif" height="1" width="8">See Also</td>
  278. </tr>
  279. </tbody>
  280. </table>
  281. <table border="0" cellpadding="10" cellspacing="0" width="100%">
  282. <tbody>
  283. <tr>
  284. <td>
  285. <p><a href="index.html">Swig Tutorial<br>
  286. Index</a></p>
  287. </td>
  288. </tr>
  289. </tbody>
  290. </table>
  291. <script type="text/javascript">
  292. function toggleDisplay(divId) {
  293. var div = document.getElementById(divId);
  294. div.style.display = (div.style.display=="block" ? "none" : "block");
  295. }
  296. </script>
  297. </body></html>
粤ICP备19079148号