Added example Makefiles to install with the F77/F90 samples
This commit is contained in:
parent
21100f1cb0
commit
489469b6bf
6 changed files with 97 additions and 6 deletions
|
|
@ -8,9 +8,11 @@
|
|||
# Main Variables:
|
||||
#
|
||||
# CANTERA_INCLUDES = Variable containing the include path
|
||||
#
|
||||
# CANTERA_LIBS = List of libraries to include on the link line
|
||||
#
|
||||
# CANTERA_FORTRAN_LIBS = list of libraries to link for Fortran programs
|
||||
# CANTERA_FORTRAN_MODS = Directory containing the F90 .mod files
|
||||
#
|
||||
|
||||
CANTERA_VERSION=@cantera_version@
|
||||
|
||||
|
|
@ -28,6 +30,10 @@ CANTERA_CORE_INCLUDES=-I@ct_incroot@
|
|||
# Required Cantera libraries
|
||||
CANTERA_CORE_LIBS=-L@ct_libdir@ -lcantera
|
||||
|
||||
CANTERA_CORE_FTN=-L@ct_libdir@ -lcantera_fortran -lcantera
|
||||
|
||||
CANTERA_FORTRAN_MODS=@ct_incroot@/cantera
|
||||
|
||||
###############################################################################
|
||||
# BOOST
|
||||
###############################################################################
|
||||
|
|
@ -67,6 +73,10 @@ CANTERA_DEFINES = -DCANTERA_VERSION=@cantera_version@
|
|||
CANTERA_LIBS=$(CANTERA_CORE_LIBS) $(CANTERA_SUNDIALS_LIBS) \
|
||||
$(CANTERA_BLAS_LAPACK_LIBS) $(CANTERA_BOOST_LIBS)
|
||||
|
||||
CANTERA_FORTRAN_LIBS=$(CANTERA_CORE_FTN) $(CANTERA_SUNDIALS_LIBS) \
|
||||
$(CANTERA_BLAS_LAPACK_LIBS) $(CANTERA_BOOST_LIBS) \
|
||||
-lstdc++
|
||||
|
||||
###############################################################################
|
||||
# END
|
||||
###############################################################################
|
||||
|
|
|
|||
21
samples/f77/Makefile.in
Normal file
21
samples/f77/Makefile.in
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
include ../Cantera.mak
|
||||
|
||||
FC=@F77@
|
||||
RM=rm -f
|
||||
FFLAGS=-g
|
||||
LDFLAGS=
|
||||
LDLIBS=$(CANTERA_FORTRAN_LIBS)
|
||||
CPPFLAGS=$(CANTERA_INCLUDES)
|
||||
|
||||
OBJS=isentropic.o demo_ftnlib.o
|
||||
|
||||
all: isentropic
|
||||
|
||||
isentropic: $(OBJS)
|
||||
$(F77) $(LDFLAGS) -o isentropic $(OBJS) $(LDLIBS)
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS)
|
||||
|
||||
dist-clean: clean
|
||||
$(RM) *~
|
||||
|
|
@ -30,3 +30,6 @@ localenv['tmpl_cantera_libs'] = repr([x for x in libs if x])
|
|||
localenv['tmpl_cantera_libdirs'] = repr([x for x in libdirs if x])
|
||||
|
||||
sconstruct = localenv.SubstFile('SConstruct', 'SConstruct.in')
|
||||
|
||||
# Generate Makefile to be installed
|
||||
makefile = localenv.SubstFile('Makefile', 'Makefile.in')
|
||||
|
|
|
|||
|
|
@ -10,12 +10,9 @@ env.Append(FFLAGS='-g',
|
|||
|
||||
ctlib = env.Object('demo_ftnlib.cpp')
|
||||
|
||||
demo_obj = env.Object('demo.f')
|
||||
isentropic_obj = env.Object('isentropic.f')
|
||||
|
||||
demo = env.Program('demo', [ctlib, demo_obj],
|
||||
demo = env.Program('demo', [ctlib, 'demo.f'],
|
||||
LINK='$F77')
|
||||
isentropic = env.Program('isentropic', [ctlib, isentropic_obj],
|
||||
isentropic = env.Program('isentropic', [ctlib, 'isentropic.f'],
|
||||
LINK='$F77')
|
||||
|
||||
Default(demo)
|
||||
|
|
|
|||
26
samples/f90/Makefile.in
Normal file
26
samples/f90/Makefile.in
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
include ../Cantera.mak
|
||||
|
||||
F90=@F90@
|
||||
RM=rm -f
|
||||
F90FLAGS=-g
|
||||
FORTRANMODDIRPREFIX=@FORTRANMODDIRPREFIX@
|
||||
F90MODDIR=$(CANTERA_FORTRAN_MODS)
|
||||
LDFLAGS=
|
||||
LDLIBS=$(CANTERA_FORTRAN_LIBS)
|
||||
|
||||
SRCS=@make_sourcefile@
|
||||
OBJS=$(subst .f90,.o,$(SRCS))
|
||||
|
||||
all: @make_target@
|
||||
|
||||
@make_target@: $(OBJS)
|
||||
$(F90) $(LDFLAGS) -o @make_target@ $(OBJS) $(LDLIBS)
|
||||
|
||||
%.o : %.f90
|
||||
$(F90) -c $< $(FORTRANMODDIRPREFIX)$(F90MODDIR) $(F90FLAGS)
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS)
|
||||
|
||||
dist-clean: clean
|
||||
$(RM) *~
|
||||
34
samples/f90/SConscript
Normal file
34
samples/f90/SConscript
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
from buildutils import *
|
||||
|
||||
Import('env', 'installTargets', 'sampleTargets')
|
||||
localenv = env.Clone()
|
||||
|
||||
# (program name, [source files])
|
||||
samples = [('demo', ['demo.f90'])]
|
||||
|
||||
for programName, sources in samples:
|
||||
if 'samples' in COMMAND_LINE_TARGETS:
|
||||
prog = localenv.Program(programName, sources,
|
||||
CPPPATH=['#build/src/fortran', '#include'],
|
||||
LIBS=env['cantera_libs']+['cantera_fortran']+['stdc++'],
|
||||
LIBPATH=[env['sundials_libdir'], '#build/lib'])
|
||||
sampleTargets.extend(prog)
|
||||
|
||||
# Generate SConstruct files to be installed
|
||||
incdirs = [pjoin(localenv['ct_incroot'], 'cantera')]
|
||||
libs = (['cantera_fortran', 'cantera'] + localenv['sundials_libs'] +
|
||||
localenv['boost_libs'] + localenv['blas_lapack_libs'] + ['stdc++'])
|
||||
libdirs = (localenv['ct_libdir'], localenv['sundials_libdir'],
|
||||
localenv['blas_lapack_dir'], localenv['boost_lib_dir'])
|
||||
localenv['tmpl_cantera_incdirs'] = repr([x for x in incdirs if x])
|
||||
localenv['tmpl_cantera_libs'] = repr([x for x in libs if x])
|
||||
localenv['tmpl_cantera_libdirs'] = repr([x for x in libdirs if x])
|
||||
localenv['tmpl_progname'] = programName
|
||||
localenv['tmpl_sourcename'] = programName + '.f90'
|
||||
|
||||
sconstruct = localenv.SubstFile('SConstruct', 'SConstruct.in')
|
||||
|
||||
# Generate Makefile to be installed
|
||||
localenv['make_target'] = programName
|
||||
localenv['make_sourcefile'] = programName + '.f90'
|
||||
makefile = localenv.SubstFile('Makefile', 'Makefile.in')
|
||||
Loading…
Add table
Reference in a new issue