howtocompile-windows

Compiling ToME4 on Windows

We do not recommend compiling ToME4 on Windows from sources. The process is considerably more involved than under OS X and Linux -- probably due to the lack of out-of-the-box build tools and support under Windows.
 

BETA 41

Compiled using SVN 5343 Version. For this part I'll assume Libs are in E:\Libs folder, Mingw is in E:\Libs\MinGW, and t-engine is in E:\t-engine.
 

Building libs

Requirements:

in cmd shell type:

 e:
 cd Libs
 hg clone http://hg.libsdl.org/SDL_image/
 hg clone http://hg.libsdl.org/SDL_ttf/

explanation - ill explain commands that occurs for first time:
"e:" - change drive
"cd e:\Libs" - Change current Directory to Libs
"hg clone http://hg.libsdl.org/SDL_image/" use mercurial to get newest version from mercurial deposit - NOTE at the time im writhing this its last change Mon, 30 Jan 2012 21:40:54 -0500 so NEWEST might not work
http://hg.libsdl.org/SDL_ttf/ last change Sat, 07 Jul 2012 09:00:50 -0400

GET and UNPACK it to E:\Libs

SDL2
requires: nothing
required by: SDL_ttf, SDL_image, t-engine

 e:
 cd e:\Libs
 cd SDL-2.0.0-6373
 sh configure --prefix=/e/libs/mingw --disable-directx
 make install

explanation:
"sh configure --prefix=/e/libs/mingw" - configures makefile to suit our system the
  • "--prefix=" switch is telling where our build will land
  • "--disable-directx" switch is telling our build to not use any directx features(since t-engine is using only OpenGL we dont care)

"make install" - builds libraries and moves files to suitable directories like (MinGW\include or MinGW\lib)

zlib
requires: nothing
required by: libpng and t-engine

 e:
 cd e:\Libs
 ren zlib-1.2.7 zlib
 cd zlib
 copy .\win32\makefile.gcc .\makefile
 make

explanation:
"ren zlib-1.2.7 zlib" - rename directory to help libpng find it
"copy .\win32\makefile.gcc .\makefile" copy premade makefile for gcc compiler
"make" build zlib libraries (static .a and dynamic .dll)

libpng
requires: zlib
required by: SDL_image

 e:
 cd e:\Libs\libpng-1.5.12
 sh configure --prefix=/e/libs/mingw
 make install

explanation:
"sh configure --prefix=/e/libs/mingw" - configures makefile to suit our system the "--prefix=" switch is telling where our build will land

SDL_image
requires: libpng, SDL2
required by: t-engine

 e:
 cd e:\Libs\SDL_image
 sh configure --prefix=/e/libs/mingw
 make install


 

freetype

requires: nothing
required by: SDL_ttf

 e:
 cd e:\Libs\freetype-2.4.10
 sh configure --prefix=/e/libs/mingw
 make install


 

SDL_ttf

requires: freetype, SDL2
required by: t-engine

 e:
 cd e:\Libs\SDL_ttf-2.0.11
 sh configure --prefix=/e/libs/mingw
 make install


 

OpenAL

requires: nothing
required by: t-engine

 e:
 cd e:\Libs\openal-soft-1.13
 cmake -DCMAKE_INSTALL_PREFIX:PATH=e:/libs/mingw -G "MSYS Makefiles" ..
 make install

explanation:
"cmake -DCMAKE_INSTALL_PREFIX:PATH=e:/libs/mingw -G "MSYS Makefiles" .." - another make program this time CMake -DCMAKE_INSTALL_PREFIX:PATH switch is identical to --prefix in configure -G "MSYS Makefiles" tells for which compiler make makefile and .. is root directory of our application

WARNING:
if you happen to hear only 1 channel after successfully building this lib its cause it coudnt find dsound.h and/or dsound.lib - true story it happend to me - if you want you can copy this one (.dll file) from t-engine BETA 41
 

libogg

requires: nothing
required by: libvorbisfile

 e:
 cd e:\Libs\libogg-1.3.0
 sh configure --prefix=/e/libs/mingw
 make install


 

libVorbis

requires: libogg
required by: t-engine

 e:
 cd e:\Libs\libVorbis-1.3.3
 sh configure --prefix=/e/libs/mingw
 make install


 

building t-engine

edit file "premake4.lua"
find code block

configuration "windows"

if you did everything in this guide all you need to do is point our build dirs for:
  • libs in MinGW directory
  • SDL includes
  • GL includes (should be shipped with MinGW)
  • and rest of includes (in MinGW/include)

in the end that code block should look like

    libdirs {
        "/e/libs/mingw/lib",
    }
    includedirs {
        "/e/libs/mingw/include",
        "/e/libs/mingw/include/SDL2",
        "/e/libs/mingw/include/GL",
    }

now lets build our t-engine!

e:
cd t-engine
premake4 gmake
make -e CC=gcc

all that is left is to bring .dll we've build for our t-engine
in my directory ive 8 dll's most of them can be found in "MinGW/bin" directory only "zlib1.dll" is in its native place
  • libfreetype-6.dll
  • libogg-0.dll
  • libvorbisfile-3.dll
  • OpenAL32.dll
  • SDL2.dll
  • SDL2_image.dll
  • SDL2_ttf.dll
  • zlib1.dll

I NOTICED that it lacks of 7 files that are in BETA-41 but it works (i hope not only for me) also you'll notice that most of our files are MUCH larger that those shipped in t-engine (probably its cause of default -O3 switch - optimize speed as much as it can by disregarding file size)