CMake Error at CMakeLists.txt:442 (ADD_PRECOMPILED_HEADER):

Unknown CMake command "ADD_PRECOMPILED_HEADER".

CMake Warning (dev) in CMakeLists.txt:

No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.8)

should be added at the top of the file. The version specified may be lower

if you wish to support older CMake versions for this project. For more

information run "cmake --help-policy CMP0000".

This warning is for project developers. Use -Wno-dev to suppress it.

Configuring incomplete, errors occurred!

CMake Error at CMakeLists.txt:442 (ADD_PRECOMPILED_HEADER):

Unknown CMake command "ADD_PRECOMPILED_HEADER".

CMake Warning (dev) in CMakeLists.txt:

No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.8)

should be added at the top of the file. The version specified may be lower

if you wish to support older CMake versions for this project. For more

information run "cmake --help-policy CMP0000".

This warning is for project developers. Use -Wno-dev to suppress it.

Configuring incomplete, errors occurred!

CMake Error at CMakeLists.txt:28 (ADD_DEPENDENCIES):

add_dependencies called with incorrect number of arguments

CMake Error at CMakeLists.txt:30 (SET_TARGET_PROPERTIES):

set_target_properties called with incorrect number of arguments.

CMake Error at CMakeLists.txt:45 (ADD_POST_BUILD):

Unknown CMake command "ADD_POST_BUILD".

CMake Warning (dev) in CMakeLists.txt:

No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.8)

should be added at the top of the file. The version specified may be lower

if you wish to support older CMake versions for this project. For more

information run "cmake --help-policy CMP0000".

This warning is for project developers. Use -Wno-dev to suppress it.

Configuring incomplete, errors occurred!

上面有一堆cmake的错误

是我在用build_all.py运行失败之后自己尝试用cmake配置产生的

这些只是因为。。cmake 没用最新版

我使用的cmake 2.8.2

---------------------------------------------------------------------

错误 1 error C2679: 二进制“=”: 没有找到接受“const KlayGE::InputActionMap”类型的右操作数的运算符(或没有可接受的转换) \KlayGE_4_2_0\External\boost\boost\container\detail\pair.hpp 203

错误 25 error C2220: 警告被视为错误 - 没有生成“object”文件 KlayGE_4_2_0\KlayGE\Core\Src\KGEConfig\KGEConfig.cpp 786

这些是在klayGe生成时的错误

是因为vc9的缘故 用vc10/11就不会这样

http://www.opengpu.org/forum.php?mod=viewthread&tid=9659

所以正确的安装方法应该是

1 下载最新 python 和cmake 安装

2 解压klayge

3 cfg_build.py 里面修改成适合自己的配置(可选)

compiler = "vc9" # could be "vc11", "vc10", "vc9", "mingw", "auto".
arch= ("x86", )# could be "x86", "x64", "arm_app", "x86_app"
config= ("Debug", "RelWithDebInfo") # could be "Debug", "Release", "MinSizeRel", "RelWithDebInfo"

4运行build_all.py

这里用vc9会遇到很多错误 1 error C2679: 二进制“=”: 这样的问题

需要修改

错误 4 error C2039: “i”: 不是“MeshMLLib::MathLib::recip_sqrt::FNI”的成员 e:\KlayGE_4_2_0\MeshMLLib\src\MeshMLLib.cpp 114

union FNI
{
float f;
int32_t i;
} fni;
fni.f = number;// evil floating point bit level hacking
fni.i = 0x5f375a86 - (fni.i >> 1);// what the fuck?
fni.f = fni.f * (threehalfs - (x2 * fni.f * fni.f));// 1st iteration
fni.f = fni.f * (threehalfs - (x2 * fni.f * fni.f));// 2nd iteration, this can be removed

return fni.f;
}

int32_t vc9不认识 改成int

----------------------------------------------------------

改完以上两个地方 编译klayge还有如下几个错误

警告 5 warning C4985: “WinMain”: 以前的声明上不存在属性。 e:\KlayGE_4_2_0\KlayGE\Core\Src\KGEConfig\KGEConfig.cpp 786

错误 2 error C2220: 警告被视为错误 - 没有生成“object”文件 e:\KlayGE_4_2_0\KlayGE\Core\Src\KGEConfig\KGEConfig.cpp 786

错误 4 fatal error C1083: 无法打开包括文件:“KHR/khrplatform.h”: No such file or directory E:\KlayGE_4_2_0\glloader\include\glloader\glloader.h 64

这个是少EGL要用的就装上

错误 1 fatal error LNK1181: 无法打开输入文件“libvorbis_static_d.lib” KlayGE_AudioDataSource_OggVorbis

--\KlayGE_4_2_0\External\libvorbis\libs\Win32

这个下面生成的libvorbis_static.lib 复制下改名libvorbis_static_d.lib

libvorbisfile_static.lib 复制下改名libvorbisfile_static_d.lib

 

警告 1 warning LNK4098: 默认库“MSVCRT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library KlayGE_AudioDataSource_OggVorbis

把#ifdef _In_
int WINAPI WinMain(_In_ hInstance, _In_op_ /*hPrevInstance*/, LPSTR /*lpszCmdLine*/, int /*nCmdShow*/)
#else
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpszCmdLine*/, int /*nCmdShow*/)
#endif

改成
#ifdef _In_
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpszCmdLine*/, int /*nCmdShow*/)
#else
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpszCmdLine*/, int /*nCmdShow*/)
#endif

05-08 08:35