Colleague of your has just commited a stub for a cmake build system Lucky you have smart colleagues
I’m using debian stable 6.0, boost 1.49 and gcc 4.6.3 - both compiled from source. Other libs are from the stable repository. Everything is compiling successfully but I’ve NOT tried to run client with all required files. Without required game and configuration files it looks promising:
daroo@debian:~/projects/vcmi$ build/client/vcmi_client
Starting...
Creating console and logfile: 0
Failed to open file
Last system error was : No such file or directory
Loading settings: 0
VCMI 0.89b (client)
Note: SDL suggests to use 32 bpp instead of24 bpp
New screen flags: 0
Initializing screen: 60
Cannot open ./Data/VIDEO.VID: failed opening file: No such file or directory
Cannot open ./Data/H3ab_ahd.vid: failed opening file: No such file or directory
Initializing video: 0
Initializing minors: 0
Cannot open ./Data/Heroes3.snd: failed opening file: No such file or directory
Cannot open ./Data/H3ab_ahd.snd: failed opening file: No such file or directory
Initializing sound: 0
Initializing screen and sound handling: 0
Cannot open ./Data/H3sprite.lod
Cannot open ./Data/H3bitmap.lod
Cannot open ./Data/H3ab_bmp.lod
Loading .lod files: 0
Cannot find file: ZELP
Fatal error. Missing game file: ZELP.TXT. Aborting!
Killing console... done!
daroo@debian:~/projects/vcmi$ build/server/vcmi_server
Port 3030 will be used.
Cannot open ./Data/H3sprite.lod
Cannot open ./Data/H3bitmap.lod
Cannot open ./Data/H3ab_bmp.lod
Loading .lod files: 0
Cannot find file: ZELP
Fatal error. Missing game file: ZELP.TXT. Aborting!
Locally I’ve edited file GameConstants.h and hardcoded paths:
#ifdef _WIN32
const std::string DATA_DIR = ".";
const std::string BIN_DIR = ".";
const std::string LIB_DIR = ".";
const std::string SERVER_NAME = "VCMI_server.exe";
const std::string LIB_EXT = "dll";
const std::string PATH_SEPARATOR = "\";
#else
//#ifndef M_DATA_DIR
//#error M_DATA_DIR undefined.
//#else
//const std::string DATA_DIR = M_DATA_DIR;
//#endif
//#ifndef M_BIN_DIR
//#error M_BIN_DIR undefined.
//#else
//const std::string BIN_DIR = M_BIN_DIR;
//#endif
//#ifndef M_LIB_DIR
//#error M_LIB_DIR undefined.
//#else
//const std::string LIB_DIR = M_LIB_DIR;
//#endif
const std::string DATA_DIR = ".";
const std::string BIN_DIR = ".";
const std::string LIB_DIR = ".";
const std::string SERVER_NAME = "vcmiserver";
const std::string LIB_EXT = "so";
const std::string PATH_SEPARATOR = "/";
#endif
It needs to be addressed with some more elegant solution.
Locally I’ve also edited file CVideoHandler.cpp and replaced the line 850 with the content from before Ivan’s patch:
#ifdef WITH_AVCODEC_DECODE_VIDEO2
avcodec_decode_video2(codecContext, frame, &frameFinished, &packet);
#else
avcodec_decode_video(codecContext, frame, &frameFinished,
packet.data, packet.size);
#endif
I guess this is because debian stable got older version of the library, which doesn’t contain function avcodec_decode_video2().
CMake files are using default mechanisms for finding all libraries except ffmpeg, which is using a file “cmake_modules/FindFFMPEG_swscale.cmake”. This file may require some tweaks on other *nix systems.
With CMake compilation is like the following:
mkdir build
cd build
cmake ../
make
For multi-core processors I suggest using -j option to speedup building process eg. make -j 4. This option can be also be set in KDevelop for the project.
Lots of warnings is generated because I’ve turned on warnings by default. To disable them you can edit CMakeFiles.txt in the project root directory:
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "-std=c++0x -Wall -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized")
endif()