Langadia++ is mainly developed under Linux and therefore makes heavy use of the concepts and typical building steps used there. For Windows users, these steps are probably unusual and maybe even difficult to follow and understand. This article shall give you a introduction how to set up a working build environment for Langadia and how to build it.
Setting up your system
Langadia++ uses CMake to manage its build process. Beneath, it requires a set of libraries to provides its functionality.
In order to build Langadia, you will require both the CMake toolchain and these libraries. Beneath, you will have to set up a environment to build C++ projects. As I assume that you are interested in a lightweight and but still feature rich environment, I will describe how to install and use the Code::Blocks IDE. However, other IDEs (including Eclipse or MS Visual Studio) should work pretty the same.
Code::Blocks is an free to use, open source IDE mainly for C++ development. It can use a variety of compilers, however, I’ll assume you want to use MinGW, a minimal GNU system for Windows, as it too is open source and will probably make less problems (especially, as Langadia probably will need some porting if it should compile with e.g. MS Visual C++ compiler).
The installation here is pretty easy: Just visit Code::Blocks’ Download pages and go to “Binary packages”. There, go further to the Microsoft Windows binaries and choose the Code::Blocks MinGW package. This package contains both the Code::Blocks IDE and the MinGW binary distribution. After installation, make sure that the MinGW binary directory is in your system’s PATH environment variable. The binary directory is located in the installation directory of Code::Blocks under MinGW\bin. Usually, the installation should enter the path by it’s own, so just be careful when you are ask if you want to change something to your system.
CMake is a build system which became popular recently. It can be compared e.g. to the GNU Autotools tool chain, however it is a bit more intuitive and by this easier to learn for beginners. Just visit the <a href”http://www.cmake.org/cmake/resources/software.html”>Download page and select the Windows installer. After installation, enter the path to the cmake.exe to your PATH environment variable (otherwise you’ll have to enter the full path later).
Setting up needed libraries
Langadia++ needs the following libraries to be build:
Download them all (choose if possible the binary+source packages, if you have no program to unpack the tar.gz archives, have a look at 7-zip) and unpack. Now you have to make sure, that the header files and the libraries (*.dll and *.lib) can be found by CMake. This can be easily archives by creation two environment variables:
- CMAKE_LIBRARY_PATH contains a list of directories where the DLL and LIB files are, e.g. CMAKE_LIBRARY_PATH=C:\SDL\lib;C:\SDL_image\lib
- CMAKE_INCLUDE_PATH contains a list of directories where the header files are, e.g. CMAKE_INCLUDE_PATH=C:\SDL\include;C:\SDL_image\include
Now your system should be ready to compile a own version of Langadia for you. So let’s quickly go on.
Generating Makefiles and Project files
In the next step, we will use CMake to generate the “meta” information needed to build Langadia. CMake usually is used to create simple UNIX Makefiles. However, as we have no UNIX environment, these are useless. Note however, that it currently is possible to set up a UNIX-like environment!.
Beneath, CMake can also generate project files for some well known IDEs including Code::BLocks. So, open a console window and do the following:
cd path\to\langadia\ mkdir build cd build cmake -G "CodeBlocks - MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=C:\Langadia ..
First, change to the Langadia directory. (NOT the directory called Langadia inside the package, however!) Then we create a new directory “build” and change inside it. Then we call CMake. By passing -G “CodeBlocks - MinGW Makefiles” we tell CMake that we want it to generate Code::BLocks project files for us. The -DCMAKE_INSTALL_PREFIX=C:\Langadia option tells CMake the installation directory. By default, it will assume something like C:\Program Files\Langadia, so if this OK for you, you can just omit this option. At last, we have to give CMake the directory, where the file CMakeLists.txt is. As we are in the build subdirectory (remember?) the file is located in the parent directory, so we just pass “..”.
Now, if CMake ran without errors, open the Code::Blocks IDE. There, go to File -> Open, go to the Langadia\build directory and open the file called Langadia++.cbp. Now, press Ctrl+F9 to build the library. Then, go to Build -> Select target -> install. Then again press Ctrl + F9, this time it will install Langadia (the header files needed to build applications using Langadia and the DLL) to the location you set by passing the -DCMAKE_INSTALL_PREFIX option. Note, if you want to rebuild Langadia, you have to go again to Build -> Select target and there, select all.
Build issues and known problems
CMake failes with some error message. What should I do?
First, check if your CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH environment variables are set correctly. Also make sure you have all files needed (this includes Header files (.h), DLLs (.dll) and LIB files (*.lib)). DLL and LIB files should be in the same directory!
Also check your compiler setup and that all paths are set correctly.
If you cannot find the reason, you can also ask in our forum, maybe we can help you there.
CMake ran fine, but when I try to compile Langadia, linking fails with some cryptic [xxx]_NULL_THUNK_DATA not found message.
Make sure the DLL and LIB files of the needed libraries are in the same location and can be found by CMake! Rebuild the Makefiles and project files by again calling CMake!. Delete the old build directory before to make sure, you have a fresh environment!