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:
model.vve
with the command:make
by mingw32-make
or gmake
depending on your installation of MinGW.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.
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
.
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.