CAPD DynSys Library
5.2.0
|
To build your own programs we recommend use of attached scripts that are generated according to your system configuration. They provide compiler flags (parameter –cflags
) or/and linker flags with all dependencies (parameter –libs
).
script name | version of CAPD library |
---|---|
capd-config | double precision without graphics, without CAPD::RedHom |
capd-gui-config | with krak graphical library |
mpcapd-config | with multiple precision support |
mpcapd-gui-config | with krak and multiple precision |
capdRedHom-config | CAPD::RedHom library |
Those scripts are installed into <prefix>/bin
directory. We assume that this location is on the search path of your system so that scripts can be called by its name (if not in the example below you need to provide full path to them).
Assume that you want to build your MyProgram.cpp
that uses double version of CAPD.
Then the instruction might be something like
if g++
is your C++ compiler and you want configuration from capd-config.
It is possible to compile your program without our scripts. But then command line strongly depends on your system configuration.
Assume that the CAPD library was installed to /home/user/capd
and it uses intervals from filib library then the instruction might be
-frounding-math
compiler can optimize code so that it is not rigorous anymore. Proper options for current configuration are returned by capd-config –cflags
.
The command line becomes more complicated if your program uses graphics and/or multiprecision (e.g. see output of mpcapd-gui-config –cflags
).
The example can be found in capd/capdMake/examples/projectStarter
directory.
Assume that in the some directory we have project that contains:
/home/user/capd
To compile all source files create in the project directory a file Makefile that contains the following code (all indents need to be made by tabulators not spaces!!!)
# a list of all the programs in your project PROGS = MyProgram YourProgram # a list of all your units to be linked with your programs (space separated) OTHERS = utils output # directory where capd scripts are (e.g. capd-config) CAPDBINDIR =/home/user/capd/bin/ # setting compiler and linker flags CAPDFLAGS = `${CAPDBINDIR}capd-config --cflags` CAPDLIBS = `${CAPDBINDIR}capd-config --libs` CXXFLAGS += ${CAPDFLAGS} -O2 -Wall # directory where object and dependancy files will be created OBJDIR = .obj/ #============ the following should not be changed ========= OTHERS_OBJ = ${OTHERS:%=${OBJDIR}%.o} OBJ_FILES = ${OTHERS_OBJ} ${PROGS:%=${OBJDIR}%.o} .PHONY: all all: ${PROGS} # rule to link executables ${PROGS}: % : ${OBJDIR}%.o ${OTHERS_OBJ} ${CXX} -o $@ $< ${OTHERS_OBJ} ${CAPDLIBS} # include files with dependencies -include ${OBJ_FILES:%=%.d} #rule to compile .cpp files and generate corresponding files with dependencies ${OBJ_FILES}: ${OBJDIR}%.o : %.cpp @mkdir -p ${OBJDIR} $(CXX) ${CXXFLAGS} -MT $@ -MD -MP -MF ${@:%=%.d} -c -o $@ $< # rule to clean all object files, dependencies and executables .PHONY: clean clean: rm -f ${OBJDIR}*.o ${OBJDIR}*.o.d ${PROGS}
Then by calling make
you will compile all source files and link all programs defined by PROGS
variable. It will also create a list of dependencies (list of header files that it uses) for each source file so that next time source file will be recompiled only if itself or some of its dependencies has changed.