Просмотр исходного кода

Updated instructions and added a fix for new gcc

Ivan Safrin 14 лет назад
Родитель
Сommit
d135ffaa53
5 измененных файлов с 301 добавлено и 19 удалено
  1. 63 18
      BUILD.md
  2. 209 0
      BUILD.txt
  3. 27 0
      CMake/FindSDL.cmake
  4. 1 0
      Core/Contents/Include/PolyGlobals.h
  5. 1 1
      README

+ 63 - 18
BUILD.md

@@ -11,6 +11,10 @@ http://cmake.org/cmake/resources/software.html or installed using apt
 or rpm on most Linux distributions. CMake 2.8.4 or greater is 
 recommended.
 
+When Polycode and its Dependencies are built, they will be available
+in the Release/YourArchitecture folder under the main source tree in 
+a structure that should mimic the main binary release.
+
 ## Building dependencies ##
 
 Polycode depends on a number of third party packages that are not
@@ -96,21 +100,6 @@ perform the following steps in the Polycode directory from a terminal:
 The Polycode CMake build will look for dependencies installed on the 
 system and by the above dependency build step.
 
-### CMake variables ###
-
-There are a number of CMake variables that can be used to control what is
-built. These can be passed into CMake on the comment line as -D<name>=<value> 
-or edited in the CMake GUI. Things should build without setting any options,
-but not that some things (Lua bindings, for example) are disabled by default.
-
-* POLYCODE_BUILD_BINDINGS 
-* POLYCODE_BUILD_EXAMPLES
-* POLYCODE_BUILD_MODULES
-* POLYCODE_BUILD_PLAYER
-* POLYCODE_BUILD_TOOLS
-* POLYCODE_INSTALL_FRAMEWORK
-* POLYCODE_INSTALL_PLAYER
- 
 ### Mac OS X and Xcode ###
 
 To generate an Xcode project for building Polycode, perform the
@@ -124,7 +113,7 @@ This generates a Polycode Xcode project in the Build directory.
 
 Build the "ALL_BUILD" target in this project in both Debug and Release
 and then build the "install" target, also in Debug and Release. This
-will install Polycode into the Release/<Platform>/Framework directory,
+will install Polycode into the Release/Darwin/Framework directory,
 which should mirror the binary download from the website and contain
 templates and examples that will build out of the box.
 
@@ -138,24 +127,80 @@ command prompt:
     cd Build
     cmake -G "Visual Studio 10" ..
     
-This generates a Polycode.sln in the Build directory.
+Build the "ALL_BUILD" target in this project in both Debug and Release
+and then build the "install" target, also in Debug and Release. This
+will install Polycode into the Release/Windows/Framework directory,
+which should mirror the binary download from the website and contain
+templates and examples that will build out of the box.
 
-### Unix Makefiles ###
+### Linux ###
 
 To generate and build Debug and Release builds with Unix Makefiles 
 perform the following steps in the Polycode directory from a terminal:
 
+NOTE: You need to install SDL development libraries on your system
+before doing this as they are not automatically installed by the 
+Dependencies project above. You can get SDL from http://www.libsdl.org 
+or using the package manager of your distribution.
+
     mkdir Build
     cd Build
     mkdir Debug
     cd Debug
     cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ../..
     make
+    make install
     cd ..
     mkdir Release
     cd Release
     cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../..
     make
+    make install
+
+This will install Polycode into the Release/Linux/Framework directory,
+which should mirror the binary download from the website and contain
+templates and examples that will build out of the box.
+
+## Building Polycode Lua ##
+
+To build Polycode Lua, you need to build the bindings and the player,
+which are disabled by default. To do this, you need to add a couple
+of variables to the cmake commands above. To build the bindings, you
+need a python installation with the PLY python module. You can get
+the PLY module at http://www.dabeaz.com/ply/
+
+To enable the bindings and the player, add the following options to the
+cmake command. Otherwise, the steps are exactly the same as the regular 
+Polycode build for your system.
+
+    -DPOLYCODE_BUILD_BINDINGS=ON -DPOLYCODE_BUILD_PLAYER=ON
+
+After building the install build or running 'make install', perform the
+following commands in the Polycode source root:
+
+### Mac and Linux ###
+
+    cd Standalone
+    mkdir Build
+    cd Build
+    cmake -G "Unix Makefiles" ..
+    make install
+
+This will create a Release/<YourArchitecture>/Standalone folder with the
+same structure as the binary Polycode Lua release.
+
+### Windows ###
+    
+    cd Standalone
+    mkdir Build
+    cd Build
+    cmake -G "Visual Studio 10" ..
+
+This will create a Standalone.sln solution in the Build directory. Build the
+"install" target of this solution. 
+
+This will create a Release/Windows/Standalone folder with the
+same structure as the binary Polycode Lua release.
 
 ## TODO ##
 

+ 209 - 0
BUILD.txt

@@ -0,0 +1,209 @@
+# Building Polycode and dependencies #
+
+Polycode uses a CMake build generator for automatically downloading and
+building required 3rd party packages and Polycode itself. Polycode is
+setup for preferring custom static libraries over system ones, so 
+please use the dependency build system even if you have all of the
+dependencies installed on your computer.
+
+The first dependency is CMake. It can be downloaded from 
+http://cmake.org/cmake/resources/software.html or installed using apt
+or rpm on most Linux distributions. CMake 2.8.4 or greater is 
+recommended.
+
+When Polycode and its Dependencies are built, they will be available
+in the Release/YourArchitecture folder under the main source tree in 
+a structure that should mimic the main binary release.
+
+## Building dependencies ##
+
+Polycode depends on a number of third party packages that are not
+included in the Polycode source tree:
+
+* [Lua](http://www.lua.org/)
+* [Freetype](http://www.freetype.org/)
+* [zlib](http://www.zlib.net/)
+* [libpng](http://www.libpng.org/pub/png/libpng.html)
+* [PhysicsFS](http://icculus.org/physfs/)
+* [Ogg Vorbis](http://www.vorbis.com/)
+* [OpenAL](http://www.openal.org/)
+* [SDL](http://www.libsdl.org/)
+* [Box2D](http://www.box2d.org/)
+* [Bullet Physics](http://bulletphysics.org/)
+* [Assimp](http://assimp.sourceforge.net/)
+
+The CMake dependency build system will download and install static
+version of these libraries into the Polycode source tree. It will NOT
+attempt to install any of these packages into your system.
+
+All dependenices will be installed into the Polycode source tree under
+    Release/<Platform>/Framework/
+
+Instructions describe using CMake on the command line, you
+may prefer to use the CMake GUI if unfamiliar with CMake.
+
+
+### Mac OS X and Xcode ###
+
+To generate an Xcode project for building Polycode dependencies, perform
+the following steps in the Polycode directory from a terminal:
+
+    cd Dependencies
+    mkdir Build
+    cd Build
+    cmake -G Xcode ..
+    
+This generates a PolycodeDependencies Xcode project in the Build 
+directory. Building this project in Xcode will download, build and 
+install the dependencies (make sure you build the ALL_BUILD target).
+Note that you need to build both Debug and
+Release in Xcode 
+
+Note: Release is "Build for Archiving" in Xcode4.
+
+### Windows and Visual Studio ###
+
+To generate a Microsoft Visual Studio (any version) project for building
+Polycode dependencies, perform the following steps in the Polycode 
+directory from a command prompt (for VS2010):
+
+    cd Dependencies
+    mkdir Build
+    cd Build
+    cmake -G "Visual Studio 10" ..
+    
+This generates a PolycodeDependencies.sln in the Build directory. 
+Building this project in Visual Studio will download, build and 
+install the dependencies. Note that you need to build both Debug and
+Release in Visual Studio. 
+
+### Unix Makefiles ###
+
+To generate and build Debug and Release builds with Unix Makefiles 
+perform the following steps in the Polycode directory from a terminal:
+
+    cd Dependencies
+    mkdir Build
+    cd Build
+    mkdir Debug
+    cd Debug
+    cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ../..
+    make
+    cd ..
+    mkdir Release
+    cd Release
+    cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../..
+    make
+    
+## Building Polycode ##
+
+The Polycode CMake build will look for dependencies installed on the 
+system and by the above dependency build step.
+
+### Mac OS X and Xcode ###
+
+To generate an Xcode project for building Polycode, perform the
+following steps in the Polycode directory from a terminal:
+
+    mkdir Build
+    cd Build
+    cmake -G Xcode ..
+
+This generates a Polycode Xcode project in the Build directory.
+
+Build the "ALL_BUILD" target in this project in both Debug and Release
+and then build the "install" target, also in Debug and Release. This
+will install Polycode into the Release/Darwin/Framework directory,
+which should mirror the binary download from the website and contain
+templates and examples that will build out of the box.
+
+### Windows and Visual Studio ###
+
+To generate a Microsoft Visual Studio project for building Polycode, 
+perform the following steps in the Polycode directory from a 
+command prompt:
+
+    mkdir Build
+    cd Build
+    cmake -G "Visual Studio 10" ..
+    
+Build the "ALL_BUILD" target in this project in both Debug and Release
+and then build the "install" target, also in Debug and Release. This
+will install Polycode into the Release/Windows/Framework directory,
+which should mirror the binary download from the website and contain
+templates and examples that will build out of the box.
+
+### Linux ###
+
+To generate and build Debug and Release builds with Unix Makefiles 
+perform the following steps in the Polycode directory from a terminal:
+
+NOTE: You need to install SDL development libraries on your system
+before doing this as they are not automatically installed by the 
+Dependencies project above. You can get SDL from http://www.libsdl.org 
+or using the package manager of your distribution.
+
+    mkdir Build
+    cd Build
+    mkdir Debug
+    cd Debug
+    cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ../..
+    make
+    make install
+    cd ..
+    mkdir Release
+    cd Release
+    cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../..
+    make
+    make install
+
+This will install Polycode into the Release/Linux/Framework directory,
+which should mirror the binary download from the website and contain
+templates and examples that will build out of the box.
+
+## Building Polycode Lua ##
+
+To build Polycode Lua, you need to build the bindings and the player,
+which are disabled by default. To do this, you need to add a couple
+of variables to the cmake commands above. To build the bindings, you
+need a python installation with the PLY python module. You can get
+the PLY module at http://www.dabeaz.com/ply/
+
+To enable the bindings and the player, add the following options to the
+cmake command. Otherwise, the steps are exactly the same as the regular 
+Polycode build for your system.
+
+    -DPOLYCODE_BUILD_BINDINGS=ON -DPOLYCODE_BUILD_PLAYER=ON
+
+After building the install build or running 'make install', perform the
+following commands in the Polycode source root:
+
+### Mac and Linux ###
+
+    cd Standalone
+    mkdir Build
+    cd Build
+    cmake -G "Unix Makefiles" ..
+    make install
+
+This will create a Release/<YourArchitecture>/Standalone folder with the
+same structure as the binary Polycode Lua release.
+
+### Windows ###
+    
+    cd Standalone
+    mkdir Build
+    cd Build
+    cmake -G "Visual Studio 10" ..
+
+This will create a Standalone.sln solution in the Build directory. Build the
+"install" target of this solution. 
+
+This will create a Release/Windows/Standalone folder with the
+same structure as the binary Polycode Lua release.
+
+## TODO ##
+
+It would be good to create a CMake build template for people to create
+new Polycode applications with.
+

+ 27 - 0
CMake/FindSDL.cmake

@@ -0,0 +1,27 @@
+# Copied from http://code.google.com/p/osgaudio/source/browse/trunk/CMakeModules/FindVorbis.cmake
+# Locate Vorbis
+# This module defines XXX_FOUND, XXX_INCLUDE_DIRS and XXX_LIBRARIES standard variables
+#
+# $SDLDIR is an environment variable that would
+# correspond to the ./configure --prefix=$SDLDIR
+# used in building Vorbis.
+
+FIND_PATH(SDL_INCLUDE_DIR
+	NAMES SDL.h
+	PATHS $ENV{INCLUDE} $ENV{CPATH}
+	PATH_SUFFIXES include SDL
+)
+
+#SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+FIND_LIBRARY(SDL_LIBRARY 
+	NAMES SDL libSDL
+	PATHS $ENV{LD_LIBRARY_PATH} $ENV{LIBRARY_PATH} $ENV{LIB}
+)
+
+IF(SDL_LIBRARY)
+	SET(SDL_LIBRARIES "${SDL_LIBRARY}")		# Could add "general" keyword, but it is optional
+ENDIF()
+
+# handle the QUIETLY and REQUIRED arguments and set XXX_FOUND to TRUE if all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL DEFAULT_MSG SDL_LIBRARIES SDL_INCLUDE_DIR)

+ 1 - 0
Core/Contents/Include/PolyGlobals.h

@@ -64,6 +64,7 @@ THE SOFTWARE.
 #elif defined(__APPLE__) && defined(__MACH__)
 	#define PLATFORM PLATFORM_MAC
 #else
+	#include <cstddef>
 	#define PLATFORM PLATFORM_UNIX
 #endif
 

+ 1 - 1
README

@@ -6,4 +6,4 @@ On top of the core C++ API, Polycode offers a LUA-based scripting system with it
 
 Polycode is available under the MIT license and was designed and developed by Ivan Safrin.
 
-Please see BUILD.md for instructions on how to build Polycode from source.
+Please see BUILD.md or BUILD.txt for instructions on how to build Polycode from source.