Introduction
This guide is directed to advanced windows users which want to use GCC instead of Visual Studio to build TC for some reason. Regular users should build TC using the basic guide, as using GCC has no benefit for them over VS sollution. Therefore this guide won't provide step-by-step instructions most of the time. This guide only covers only compiling the sourcecode, for other steps about setting up your trinitycore instalation please refer to How to: windows guide.
Preparation
To successfuly build TC with mingw GCC toolchain you need (in addition to requirements from the basic guide):
- MinGW - there are several MinGW distributions around the Net, this guide uses http://www.mingw.org/ , which outputs only 32 bit code. Please install your favourite distro according to the documentation provided with it. For mingw.org the documentation is here: http://www.mingw.org/wiki/Getting_Started .
- MSYS - it's a convenient bash shell for windows, please follow install guide for details.
Libraries for MinGW
Libmysql.lib provided with mysql installation cannot be used by MinGW GCC toolchain, because GCC expects libraries with .a format. The simplest way to fix the problem is to convert .lib file provided with your install. You can do that by doing following in MSYS:
cd /to/your/mysql/install/directory
cd lib/opt
reimp.exe -d libmysql.lib
dlltool.exe -k -d libmysql.def -l libmysql.a
Note
If your mingw installation does not provide reimp or dlltool you need to download them, from example from here.
If you are getting errors with reimp command you may need to rebuild mingw-utils-0.4-1 package from source, as the binary distribution contains a bug.
Build
Once you have done previous steps you can proceed to build the code:
cd /to/directory/you/want/to/build/in #building in the trinitycore source dir is not advised
#the following should be in a single command (1 line)
cmake -G"MSYS Makefiles" -DUSE_COREPCH=0 -DUSE_SCRIPTPCH=0 #build with PCH enabled is not supported
-DUSE_MYSQL_SOURCES=0 -DMYSQL_INCLUDE_DIR=[/path/to/mysql/distribution/]/include -DMYSQL_LIBRARY=[/path/to/mysql/distribution/]/lib/opt/libmysql.a # path to include dir of your mysql distro and to libmysql.a you just created
-DCMAKE_INSTALL_PREFIX=/where/you/want/to/put/installed/tc
/path/to/trinitycore/dir
#end of cmake command
make # this will take a (long) while
make install # this will install the software in your prefered dir. Afterwards you can run make uninstall to remove and make clean to purge build dir
Running the core
Executables were built with dependencies on mingw, so you need to make sure to add mingw/bin dir to your PATH variable. Also, remember to copy libmysql.dll to the install dir, or add it to the PATH aswell.