Cross compilation Win32From VLECross compilation Win32 x86In this page, we describe how to build the Win32 version of VLE using a cross compilation system on GNU/Linux. This toolchain allow to launch build, launch unit test and build an installer for Windows XP, Vista, Seven 32 or 64 bits. Configure the system
sudo apt-get install mingw32 mingw32-binutils mingw32-runtime nsis
# untar the boost sources tar jxf boost_1_39_0.tar.bz2 # build the bjam program provided with Boost ./bootstrap.sh --without-icu # build a cross compilation parameter file and update the version of Gcc (here 4.4) echo "using gcc : 4.4 : i586-mingw32msvc-g++ : <rc>i586-mingw32msvc-windres <archiver>i586-mingw32msvc-ar ;" > user-config.jam # build boost and install them into the directory $PREFIX ./bjam toolset=gcc target-os=windows variant=release threading=multi threadapi=win32\ link=shared runtime-link=shared --prefix=$PREFIX --user-config=user-config.jam -j 2\ --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged install
# Install the library using wine or any Win32 emulator wine gtkmm-win32-devel-2.16.0-4.exe # Copy all file into the $PREFIX directory (the same as Boost installation) cp -r $HOME/.wine/.wine/drive_c/Program\ Files/gtkmm $PREFIX
gunzip -c /usr/share/doc/mingw32-runtime/mingwm10.dll.gz > $PREFIX/bin/mingwm10.dll ConstructionLa dernière étape est en réalité la plus simple puisque l'ensemble de la plate-forme est dorénavant compatible avec ce mode de compilation.
# Le nom de la plate-forme cible. SET(CMAKE_SYSTEM_NAME Windows) SET(CMAKE_SYSTEM_VERSION 1) # Les variables qui définissent les compilateur à utiliser. SET(CMAKE_C_COMPILER /usr/bin/i586-mingw32msvc-gcc) SET(CMAKE_CXX_COMPILER /usr/bin/i586-mingw32msvc-c++) SET(CMAKE_RC_COMPILER /usr/bin/i586-mingw32msvc-windres) # Une variable qui définit les chemins où chercher les bibliothèques et # autres fichiers d'entêtes pour la plate-forme cible. Le deuxième chemin # est ici égal à la variable $prefix SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc $prefix) # Quelques définition de variables à passer au script de compilation Cmake. SET(CMAKE_BUILD_TYPE RelWithDebInfo) SET(Boost_ADDITIONAL_VERSIONS "1.41" "1.41.0") SET(BOOST_ROOT /home/goth/tmp/win32) SET(BOOSTROOT /home/goth/tmp/win32) SET(BOOST_INCLUDEDIR /home/goth/tmp/win32/include) SET(BOOST_LIBRARYDIR /home/goth/tmp/win32/lib) SET(GTKMM_BASEPATH /home/goth/tmp/win32) SET(MINGW_BASEPATH /home/goth/tmp/win32) SET(Boost_COMPILER "-mgw42") # search for programs in the build host directories SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# Téléchargement des sources de VLE. git clone git://vle.git.sourceforge.net/gitroot/vle/vle cd vle mkdir build cd build pushd . # Création d'une variable d'environnement pour forcer la recherche des fichiers pkg-config dans le bon chemin. # À noter qu'il faudra peut être modifier tous les fichiers de ce répertoire pour avoir un chemin correct du # type : prefix=/home/quesnel/cross/win32 cd $prefix/lib/pkgconfig sed -e 's/^prefix=.*$/prefix=\/home\/goth\/tmp\/win32/' -i *.pc popd export PKG_CONFIG_PATH=$prefix/lib/pkgconfig # Création des scripts de compilation, compilation et création du paquet. cmake -DCMAKE_TOOLCHAIN_FILE=$prefix/Toolchain-mingw32.cmake \ -DWITH_TEST=OFF .. # Compilation sur deux coeurs make -j 2 # Création de l'auto-installateur make package
|