Hello :)
I am one of the developers of OpenDungeons a FOSS RTS game inspired by
Dungeon Keeper. I am trying to cross-compile our game on Ubuntu 12.04 for
Windows (XP, Vista and 7), but I have run into some trouble.
I following these guides:
http://www.cmake.org/Wiki/CMake_Cross_Compiling
http://www.cmake.org/Wiki/CmakeMingw
I use the following external libraries:
Ogre SDK 1.7.2 (MingW)
https://sourceforge.net/projects/ogre/files/ogre/1.7/OgreSDK_mingw_v1-7-2.exe/download
CEGUI SDK 0.7.5 (MingW)
https://sourceforge.net/projects/crayzedsgui/files/CEGUI%20Mk-2/0.7.5/CEGUI-SDK-0.7.5-mingw.zip/download
SFML 1.6 (MingW)
https://sourceforge.net/projects/sfml/files/sfml/1.6/SFML-1.6-dev-windows-mingw.zip/download
and have made the following toolchain file (Toolchain.cmake):
# this one is important
SET(CMAKE_SYSTEM_NAME Windows)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
SET(CMAKE_C_COMPILER /usr/bin/i686-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/i686-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER /usr/bin/i686-w64-mingw32-windres)
SET(BOOST_ROOT ${CROSS_DIR}/OgreSDK_mingw_v1-7-2/boost)
SET(CEGUIOGRE_LIBRARY ${CROSS_DIR}/OgreSDK_mingw_v1-7-2/lib/release)
SET(CEGUI_LIBRARY ${CROSS_DIR}/CEGUI/lib)
SET(CEGUI_INCLUDE_DIR ${CROSS_DIR}/CEGUI/cegui/include)
SET(OPENAL_LIBRARY ${CROSS_DIR}/SFML-1.6/lib)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH ${CROSS_DIR}/OgreSDK_mingw_v1-7-2
${CROSS_DIR}/SFML-1.6 ${CROSS_DIR}/CEGUI)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Which I use when I call cmake as follows:
export CROSS_DIR=`pwd`
cd opendungeons*
cmake -DCROSS_DIR=$CROSS_DIR
-DCMAKE_TOOLCHAIN_FILE=$CROSS_DIR/Toolchain.cmake .
Running cmake goes almost fine (I get the following warnings)
ckr@ckr-laptop:~/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir$ ./CrossCompile.sh
...
-- Configuring done
WARNING: Target OpenDungeons requests linking to directory
/home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/SFML-1.6/lib. Targets may
link only to libraries. CMake is dropping the item.
WARNING: Target OpenDungeons requests linking to directory
/home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/CEGUI/lib. Targets may link
only to libraries. CMake is dropping the item.
WARNING: Target OpenDungeons requests linking to directory
/home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/OgreSDK_mingw_v1-7-2/lib/release.
Targets may link only to libraries. CMake is dropping the item.
WARNING: Target OpenDungeons requests linking to directory
/home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/SFML-1.6/lib. Targets may
link only to libraries. CMake is dropping the item.
WARNING: Target OpenDungeons requests linking to directory
/home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/CEGUI/lib. Targets may link
only to libraries. CMake is dropping the item.
WARNING: Target OpenDungeons requests linking to directory
/home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/OgreSDK_mingw_v1-7-2/lib/release.
Targets may link only to libraries. CMake is dropping the item.
-- Generating done
-- Build files have been written to: /home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/opendungeons-0.4.9
Which I am not sure are important or not (but that is not my question for
now).
When I then compile our game with make I get the following error:
ckr@ckr-laptop:~/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/opendungeons-0.4.9$ make
Scanning dependencies of target OpenDungeons
[ 0%] Building CXX object
CMakeFiles/OpenDungeons.dir/dependencies/angelscript/angelscript/source/as_atomic.cpp.obj
...
[ 44%] Building CXX object
CMakeFiles/OpenDungeons.dir/source/ASWrapper.cpp.obj
In file included from /home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/OgreSDK_mingw_v1-7-2/boost_1_44/boost/thread/detail/thread_heap_alloc.hpp:15:0,
from /home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/OgreSDK_mingw_v1-7-2/boost_1_44/boost/thread/tss.hpp:10,
from /home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/OgreSDK_mingw_v1-7-2/include/OGRE/Threading/OgreThreadHeadersBoost.h:29,
from /home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/OgreSDK_mingw_v1-7-2/include/OGRE/Threading/OgreThreadHeaders.h:30,
from /home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/OgreSDK_mingw_v1-7-2/include/OGRE/OgreStdHeaders.h:110,
from /home/ckr/Documents/OD
SVN/mediaSource/ODLinuxBuildScripts/build_dir/OgreSDK_mingw_v1-7-2/include/OGRE/OgrePrerequisites.h:315,
from