klayge 4.2.0 編譯vc9

minggoddess發表於2013-06-24

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

 

相關文章