Model compilation

Table of content

General intructions

The compilation of the model is defined in the file called Makefile. The makefile starts with the inclusion of a compile-time generated makefile to allow for multi-plateform makefiles. Every makefile should contain:

include $(shell vveinterpreter --makefile)

A makefile containing only that line will be able to compile a model consisting of only one file called model.cpp.

Then, you can:

Note:
On windows, you might have to replace make by mingw32-make or gmake depending on your installation of MinGW.

Adding dependencies

You can add other files to compile by specifying the variable EXTRA_SRCS. This variable takes the name of the extra files without their extension. For example, if you want to add the files bsurface.cpp and key_framer.cpp to the compilation, your Makefile will be:

EXTRA_SRCS=bsurface key_framer
include $(shell vveinterpreter --makefile)

If the files bsurface.h or key_framer.h exist, they will automatically be added as dependencies for the compilation of the model.

You can also add header dependencies by modifying the variable EXTRA_HEADERS. For example, if you have a header mytemplate.h you want to add, you change your makefile to be:

EXTRA_HEADERS=mytemplate.h
include $(shell vveinterpreter --makefile)

Now, the compilation of your model will be conditionned to the modification of this file too.

Changing the model name

You might not want to call you model model. In that case, just define the variable MODEL:

MODEL=system
include $(shell vveinterpreter --makefile)

This will compile the file system.cpp into system.vve.

Changing the compilation options

By default, the compilation is performed using chosen optimized flags. This is great for running the model as fast as possible, but not for debugging. The options for debugging are prepared in a CXXFLAGS_DEBUG variable. To enable it you can redefine CXXFLAGS like this:

include $(shell vveinterpreter --makefile)
CXXFLAGS=$(CXXFLAGS_DEBUG)

You can also add options to the compilation or linking stage:

include $(shell vveinterpreter --makefile)
CXXFLAGS+=-WError
LD_SO_FLAGS+=-flag
LD_EXE_FLAGS+=-flag

This will add the "warnings as error" options to the compilation stage, and add some flag to the linking stage. The variable LD_SO_FLAGS is specific to the compilation of the dynamic library (i.e. shared object) and the LD_EXE_FLAGS to the compilation of the standalone model.

Note:
adding options might make you makefile plateform-dependant.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Fri May 31 15:37:53 2013 for VVE by  doxygen 1.6.3