
Compilation with makefiles
This page is meant for people which want to use command-line tools
for building their projects. Such building tools are based on the
'makefile' tools: a powerful approach, but also intimidating for
novice users. Therefore, use this method if you are an experienced
programmer.
How to configure
The makefile system of Chrono::Engine is based on a set of .mak files.
Only few modifications are needed before you start compiling. This
configuration is needed only once.
1.b - Check that you have the 'makefile' tool
If you want to use the command-line makefiles, make sure you have
at least one of the following command-line tools:
-
Microsoft 'nmake': it is not available in the
Visual C++ 2005 'Express' edition, but you can find it in the
Microsoft Platform SDK.
-
GNU 'make', available if you install the GNU GCC compiler. Note: in Windows distribution of the GCC (MingW)
this tool is often renamed as 'mingw32-make'
That is: if you are using the Microsoft compiler, you need also to
install the Microsoft Platform SDK for using the nmake tool, otherwise,
if you are using the MingW compiler, simply use the mingw32-make tool which is
already contained in the GCC distribution.
2.b - Edit makefile variables
Use a plain ASCII editor (such as the Notepad or VI) to edit
the configuration file ChronoEngine/makes/config.mak.
If you read the instructions contained in that file, it won't be
difficult to match your system's configuration: it is simply a
matter of changing some variables such as the place where you
unzipped your SDK on hard disk, the compiler you are using, and such.
The most important variables to set is CH_CHRONODIR.
(Note that, if you followed the steps of the Windows installer during
the installation of the Chrono::Engine SDK, these CH_CHRONODIR and
CH_IRRLICHTDIR variables have been automatically written for you).
After you modified this file, save it.
That's all!
How to compile
Now that you have installed and configured your CHRONO::ENGINE SDK, you
may want to check it by compiling some source code.
In fact, we suggest you to start with the compilation of a simple
.cpp example, already shipped whith the SDK.
Read the following steps to learn how to compile a demo and how to
compile other projects of yours.
3.b - Test the installation: compile a demo
To test the correctness of your SDK installation, you may
compile one of the examples in ChronoEngine\demos\...
Open a console (a 'shell') and set the current directory
as the directory where there's the source code of the demo you
wish to compile. For example, if you unzipped your code in C:\ChronoEngine,
type:
cd C:\ChronoEngine\demos\core
Now, supposing you have the Microsoft 'nmake' tool,
type this command to start the compilation:
nmake -f makefile build=RELEASE
Note that if you are using the GNU 'make' tool coming
with MingW distribution, you shoud type instead:
mingw32-make -f makefile build=RELEASE
The 'build' parameter is optional. It could also be build=DEBUG
if you prefer to compile in debug mode.
If everything is ok, you should see the compiler
textual message in the shell, and after few seconds you
should obtain the executable.
The compiled executable can be found into ChronoEngine\bin\[your compiler].
Some notes about compilation with makefiles.
-
The makefile aproach does not need any specific integrated
developement edotor (IDE), however people which like graphical
user interfaces can still use an integrated editor:
their could simply configure their IDE
in a way that it calls the external makefile on compilation.
For example,
in Microsoft Visual C++, create a 'Makefile project', put
your cpp files and your 'makefile' file in the same directory of the project, then go to
the project property page, in General settings, then enter for example
nmake -f makefile build=RELEASE all inside the 'Build
Command Line' field.
-
Important! The makefile system in the Chrono::Engine SDK does
not implement the 'depend' feature. If you need it, you need to
modify the makefiles according to your need.
-
If you want to do makefiles for your projects, start from the
examples of makefiles that you find inside the demos/...
directories. Note that they always start with the inclusion
of the config.mak file, for example
include ../../makes/config.mak
because this means that, using the config.mak, many useful variables
have been automatically set, and the remaining part of the makefile
is simplified.
Back to the installation guide