BUILD.txt 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. # Building Polycode and dependencies #
  2. Polycode uses a CMake build generator for automatically downloading and
  3. building required 3rd party packages and Polycode itself. Polycode is
  4. setup for preferring custom static libraries over system ones, so
  5. please use the dependency build system even if you have all of the
  6. dependencies installed on your computer.
  7. The first dependency is CMake. It can be downloaded from
  8. http://cmake.org/cmake/resources/software.html or installed using apt
  9. or rpm on most Linux distributions. CMake 2.8.8 or greater is now required.
  10. When Polycode and its Dependencies are built, they will be available
  11. in the Release/YourArchitecture folder under the main source tree in
  12. a structure that should mimic the main binary release.
  13. If you wish to build a 32-bit version on a 64-bit machine in OS X, pass
  14. -DCMAKE_OSX_ARCHITECTURES=i386 as an argument to cmake
  15. ## Building dependencies ##
  16. Polycode depends on a number of third party packages that are not
  17. included in the Polycode source tree:
  18. * [Lua](http://www.lua.org/)
  19. * [Freetype](http://www.freetype.org/)
  20. * [zlib](http://www.zlib.net/)
  21. * [libpng](http://www.libpng.org/pub/png/libpng.html)
  22. * [PhysicsFS](http://icculus.org/physfs/)
  23. * [Ogg Vorbis](http://www.vorbis.com/)
  24. * [OpenAL](http://www.openal.org/)
  25. * [SDL](http://www.libsdl.org/)
  26. * [Box2D](http://www.box2d.org/)
  27. * [Bullet Physics](http://bulletphysics.org/)
  28. * [Assimp](http://assimp.sourceforge.net/)
  29. The CMake dependency build system will download and install static
  30. version of these libraries into the Polycode source tree. It will NOT
  31. attempt to install any of these packages into your system.
  32. All dependenices will be installed into the Polycode source tree under
  33. Release/<Platform>/Framework/
  34. Instructions describe using CMake on the command line, you
  35. may prefer to use the CMake GUI if unfamiliar with CMake.
  36. ### Mac OS X and Xcode ###
  37. NOTE: If you are using the new Xcode that is downloaded from the AppStore
  38. and cmake complains about not finding Xcode in /Developer, you have to run this
  39. command to update the Xcode path:
  40. sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
  41. To generate an Xcode project for building Polycode dependencies, perform
  42. the following steps in the Polycode directory from a terminal:
  43. cd Dependencies
  44. mkdir Build
  45. cd Build
  46. cmake -G Xcode ..
  47. This generates a PolycodeDependencies Xcode project in the Build
  48. directory. Building this project in Xcode will download, build and
  49. install the dependencies (make sure you build the ALL_BUILD target).
  50. Note that you need to build both Debug and
  51. Release in Xcode
  52. Note: Release is "Build for Archiving" in Xcode4.
  53. ### Windows and Visual Studio ###
  54. To generate a Microsoft Visual Studio (any version) project for building
  55. Polycode dependencies, perform the following steps in the Polycode
  56. directory from a command prompt (for VS2010):
  57. cd Dependencies
  58. mkdir Build
  59. cd Build
  60. cmake -G "Visual Studio 10" ..
  61. This generates a PolycodeDependencies.sln in the Build directory.
  62. Building the ALL_BUILD project in the solution in Visual Studio will download, build and
  63. install the dependencies. Note that you need to build both Debug and
  64. Release.
  65. You will also need to manually build the "glext" and "wglext" projects.
  66. ### Unix Makefiles ###
  67. To generate and build Debug and Release builds with Unix Makefiles
  68. perform the following steps in the Polycode directory from a terminal:
  69. cd Dependencies
  70. mkdir Build
  71. cd Build
  72. mkdir Debug
  73. cd Debug
  74. cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ../..
  75. make
  76. cd ..
  77. mkdir Release
  78. cd Release
  79. cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../..
  80. make
  81. ## Building Polycode ##
  82. ### Notes ###
  83. The Polycode CMake build will look for dependencies installed as
  84. static libraries in the Release folder by the above
  85. dependency build step. It will not use system level versions
  86. of these libraries, even if you have them installed. The only exception to
  87. this is SDL for the Linux build, which you must manually install on
  88. the system level.
  89. If you want to build documentation, you must have Doxygen installed
  90. and in your run path. You can get Doxygen from http://www.doxygen.org
  91. or install it using a package manager.
  92. ### Mac OS X and Xcode ###
  93. To generate an Xcode project for building Polycode, perform the
  94. following steps in the Polycode directory from a terminal:
  95. mkdir Build
  96. cd Build
  97. cmake -G Xcode ..
  98. This generates a Polycode Xcode project in the Build directory.
  99. Build the "ALL_BUILD" target in this project in both Debug and Release
  100. and then build the "install" target, also in Debug and Release. This
  101. will install Polycode into the Release/Darwin/Framework directory,
  102. which should mirror the binary download from the website and contain
  103. templates and examples that will build out of the box.
  104. ### Windows and Visual Studio ###
  105. To generate a Microsoft Visual Studio project for building Polycode,
  106. perform the following steps in the Polycode directory from a
  107. command prompt:
  108. mkdir Build
  109. cd Build
  110. cmake -G "Visual Studio 10" ..
  111. Build the "ALL_BUILD" target in this project in both Debug and Release
  112. and then build the "install" target, also in Debug and Release. This
  113. will install Polycode into the Release/Windows/Framework directory,
  114. which should mirror the binary download from the website and contain
  115. templates and examples that will build out of the box.
  116. ### Linux ###
  117. To generate and build Debug and Release builds with Unix Makefiles
  118. perform the following steps in the Polycode directory from a terminal:
  119. NOTE: You need to install SDL development libraries on your system
  120. before doing this as they are not automatically installed by the
  121. Dependencies project above. You can get SDL from http://www.libsdl.org
  122. or using the package manager of your distribution.
  123. mkdir Build
  124. cd Build
  125. mkdir Debug
  126. cd Debug
  127. cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ../..
  128. make
  129. make install
  130. cd ..
  131. mkdir Release
  132. cd Release
  133. cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../..
  134. make
  135. make install
  136. This will install Polycode into the Release/Linux/Framework directory,
  137. which should mirror the binary download from the website and contain
  138. templates and examples that will build out of the box.
  139. ## Building Polycode Lua ##
  140. Note: To build a complete distribution of the standalone Lua tools
  141. as it appears in the binary release, you will need to build it on all
  142. supported platforms and copy the module libraries and deployment
  143. templates from all three into the folder. If you do not have access
  144. to all the supported platforms, you will not be able to build a complete
  145. distribution!
  146. To build Polycode Lua, you need to build the bindings and the player,
  147. which are disabled by default. To do this, you need to add a couple
  148. of variables to the cmake commands above. To build the bindings, you
  149. need a python installation with the PLY python module. You can get
  150. the PLY module at http://www.dabeaz.com/ply/
  151. Note: You will need python 2 for this step. If you have python 3 installed,
  152. pass -DPYTHON_EXECUTABLE=/usr/bin/python2 or whatever the full path to
  153. the python2 executable is on your system.
  154. To enable the bindings and the player, add the following options to the
  155. cmake command. Otherwise, the steps are exactly the same as the regular
  156. Polycode build for your system.
  157. -DPOLYCODE_BUILD_BINDINGS=ON -DPOLYCODE_BUILD_PLAYER=ON
  158. Note: You need to build the "PolycodeLua" target before you build the "install" target.
  159. After building the install build or running 'make install', perform the
  160. following commands in the Polycode source root:
  161. ### Mac and Linux ###
  162. cd Standalone
  163. mkdir Build
  164. cd Build
  165. cmake -G "Unix Makefiles" ..
  166. make install
  167. This will create a Release/YourArchitecture/Standalone folder with the
  168. same structure as the binary Polycode Lua release.
  169. ### Windows ###
  170. cd Standalone
  171. mkdir Build
  172. cd Build
  173. cmake -G "Visual Studio 10" ..
  174. This will create a Standalone.sln solution in the Build directory. Build the
  175. "install" target of this solution.
  176. This will create a Release/Windows/Standalone folder with the
  177. same structure as the binary Polycode Lua release.
  178. ### Final steps ###
  179. Since the standalone Lua distribution is supposed to compile packages for
  180. all platforms, you need to do this build step on all of the platforms and
  181. merge the Standalone/Modules and Standalone/Publish folders with the one
  182. you just built.
  183. ## TODO ##
  184. It would be good to create a CMake build template for people to create
  185. new Polycode applications with.