Difference between revisions of "Installation"

From KlayGE
Jump to: navigation, search
m
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Before compiling [[KlayGE]], some [[third-party libraries and tools]] must be installed.
+
== General ==
  
Since [[KlayGE]] 3.10.0, include and lib paths are set up inside the project files. After extraction, just open the corresponding project file under "Build" directory, [[KlayGE/en|KlayGE]]itself can be built directly. If you need to use the engine to develop your own projects, you need to do some additional setup:
+
Before compiling [[KlayGE/en|KlayGE]], Python 2.7+ and CMake 3.4+ must be installed first. Then you can run build_external.py to build and install [[Third-party libraries and tools|third-party libraries and tools]]. [[KlayGE/en|KlayGE]] has been tested on these [[Compilers tested|compilers]].
  
# Run the env_vars.py under KlayGE directory. The script sets the environment variable "KLAYGE_HOME", and adds the "bin" directory into OS's PATH
+
Since [[KlayGE/en|KlayGE]] 3.12.0, include and lib paths are set up inside the project files. After extraction, just open the corresponding project file under "Build" directory, [[KlayGE/en|KlayGE]] itself can be built directly. Or you can run build_all.py to do that job.
# environment variable. If you do not have pywin32 installed, you may need to manually modify the environment variables, or restart your computer.
+
 
# Set the pathes. Taking Visual Studio 2008 as an example (for other IDEs, please refer to their own help files):
+
Since [[KlayGE]] 4.1.0, project files are migrated to cmake. Several on-stop compiling scripts written in Python is also included. The build_glloader.py is used for compiling [[glloader/en|glloader]]; the build_kfont.py for [[kfont/en|kfont]]; the build_KlayGE.py for [[KlayGE/en|KlayGE]], [[Samples]], [[Toolset|Tools]] and [[Tutorials]]. The build_all.py can build all of them. Those .py have two optional parameters. The first one is compiler name, the second one is configuration name. For example, "build_all.py vc10 x64" means uses vc10's x64 configuration for compiling. Currently, compiler names such as vc8, vc9, vc10, vc11, vc12, mingw and gcc are supported. Configuration names such as x86, x64, x86_app, and arm_app are supported. If no parameter in the command line, default parameters inside cfg_build.py will be used.
## Open "Tools"->"Options"->"Projects and Solutions"->"VC++ Directories", select "Include files" in "Show directories for:" drop-down box, adds $(KLAYGE_HOME)\Core\Include and $(KLAYGE_HOME)\Plugins\Include.
+
 
## Select "Library files" in "Show directories for:", adds $(KLAYGE_HOME)\lib\Win32(For x64 version, replace "Win32" by "x64").
+
Since [[KlayGE]] 4.4.0, 3rd party libraries uses cmake as project files. You only need to run build_external.py to finish the build, not native project files provided by 3rd party libraries themselves.
## Click "OK". It's recommended to restart Visual Studio in order to ensure the environment settings have been saved properly.
+
 
 +
Since [[KlayGE]] 4.5.0, Android and WinRT version can be build with the same cmake, too. Before that, you need a Windows version of tools. They are used in the process of building Android and WinRT version.
 +
 
 +
During the compilation, if the vc said couldn't find v110_xp toolset, please install Visual Studio 2012 Update or up.
  
 
'''Notes for MinGW users:'''
 
'''Notes for MinGW users:'''
  
 
There are some incompatibilities between new versions of the Windows SDK/DirectX SDK and MinGW. When compiling the DirectSound plug-in, and the compiler will report sal.h cannot be found. VC's "sal.h" needs to be copied to "MinGW/include". Then open "MinGW/lib/gcc/mingw32/4.4.1/include/stddef.h", replace "#define NULL __null" by "#define NULL 0". Otherwise, sal.h will define __null to some other token incorrectly.
 
There are some incompatibilities between new versions of the Windows SDK/DirectX SDK and MinGW. When compiling the DirectSound plug-in, and the compiler will report sal.h cannot be found. VC's "sal.h" needs to be copied to "MinGW/include". Then open "MinGW/lib/gcc/mingw32/4.4.1/include/stddef.h", replace "#define NULL __null" by "#define NULL 0". Otherwise, sal.h will define __null to some other token incorrectly.
 +
 +
== Linux platform ==
 +
 +
Take Ubuntu as an example here. You need to install wine and its dependencies.
 +
sudo apt-get install wine wine-dev libc6-dev-i386 g++-4.8-multilib libx11-dev libgl1-mesa-dev libglu1-mesa-dev libopenal-dev build-essential
 +
 +
Once you have wine installed, you also have to make it into 32-bit mode. Because 64-bit wine doesn't work at all.
 +
export WINEARCH=win32
 +
winetricks
 +
 +
== OSX platform ==
 +
 +
If you don't have brew.sh installed, run
 +
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
 +
 +
Wine must be installed on OSX, too.
 +
brew cask install xquartz
 +
brew install wine --without-win64
 +
 +
== See Also ==
 +
[[Platforms]]
  
 
[[zh:安装]]
 
[[zh:安装]]
 +
[[ru:Установка]]

Latest revision as of 01:22, 4 January 2017

General

Before compiling KlayGE, Python 2.7+ and CMake 3.4+ must be installed first. Then you can run build_external.py to build and install third-party libraries and tools. KlayGE has been tested on these compilers.

Since KlayGE 3.12.0, include and lib paths are set up inside the project files. After extraction, just open the corresponding project file under "Build" directory, KlayGE itself can be built directly. Or you can run build_all.py to do that job.

Since KlayGE 4.1.0, project files are migrated to cmake. Several on-stop compiling scripts written in Python is also included. The build_glloader.py is used for compiling glloader; the build_kfont.py for kfont; the build_KlayGE.py for KlayGE, Samples, Tools and Tutorials. The build_all.py can build all of them. Those .py have two optional parameters. The first one is compiler name, the second one is configuration name. For example, "build_all.py vc10 x64" means uses vc10's x64 configuration for compiling. Currently, compiler names such as vc8, vc9, vc10, vc11, vc12, mingw and gcc are supported. Configuration names such as x86, x64, x86_app, and arm_app are supported. If no parameter in the command line, default parameters inside cfg_build.py will be used.

Since KlayGE 4.4.0, 3rd party libraries uses cmake as project files. You only need to run build_external.py to finish the build, not native project files provided by 3rd party libraries themselves.

Since KlayGE 4.5.0, Android and WinRT version can be build with the same cmake, too. Before that, you need a Windows version of tools. They are used in the process of building Android and WinRT version.

During the compilation, if the vc said couldn't find v110_xp toolset, please install Visual Studio 2012 Update or up.

Notes for MinGW users:

There are some incompatibilities between new versions of the Windows SDK/DirectX SDK and MinGW. When compiling the DirectSound plug-in, and the compiler will report sal.h cannot be found. VC's "sal.h" needs to be copied to "MinGW/include". Then open "MinGW/lib/gcc/mingw32/4.4.1/include/stddef.h", replace "#define NULL __null" by "#define NULL 0". Otherwise, sal.h will define __null to some other token incorrectly.

Linux platform

Take Ubuntu as an example here. You need to install wine and its dependencies.

sudo apt-get install wine wine-dev libc6-dev-i386 g++-4.8-multilib libx11-dev libgl1-mesa-dev libglu1-mesa-dev libopenal-dev build-essential

Once you have wine installed, you also have to make it into 32-bit mode. Because 64-bit wine doesn't work at all.

export WINEARCH=win32
winetricks

OSX platform

If you don't have brew.sh installed, run

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Wine must be installed on OSX, too.

brew cask install xquartz
brew install wine --without-win64

See Also

Platforms