Generate cantera.pc for use with pkg-config
This commit is contained in:
parent
824a364af8
commit
205312e632
2 changed files with 59 additions and 42 deletions
|
|
@ -22,55 +22,82 @@ if env['python_package'] == 'full':
|
|||
install(localenv.AddPostAction, inst, Chmod('$TARGET', 0755))
|
||||
|
||||
# Cantera.mak include file for Makefile projects
|
||||
# cantera.pc for use with pkg-config
|
||||
|
||||
pc_libs = []
|
||||
pc_libdirs = []
|
||||
pc_incdirs = []
|
||||
pc_cflags = []
|
||||
|
||||
if env['use_sundials'] == 'n':
|
||||
localenv['mak_sundials_libs'] = '-lcvode'
|
||||
localenv['mak_sundials_libdir'] = ''
|
||||
localenv['mak_sundials_include'] = ''
|
||||
else:
|
||||
#
|
||||
# Add links to the sundials environment
|
||||
#
|
||||
localenv['mak_sundials_libs'] = ' '.join('-l%s' % s
|
||||
for s in localenv['sundials_libs'])
|
||||
localenv['mak_sundials_libdir'] = ('-L' + localenv['sundials_libdir']
|
||||
if localenv['sundials_libdir'] else '')
|
||||
localenv['mak_sundials_include'] = ('-I' + localenv['sundials_include']
|
||||
if localenv['sundials_include'] else '')
|
||||
for s in localenv['sundials_libs'])
|
||||
pc_libs += localenv['sundials_libs']
|
||||
if localenv['sundials_libdir']:
|
||||
localenv['mak_sundials_libdir'] = '-L' + localenv['sundials_libdir']
|
||||
pc_libdirs.append(localenv['sundials_libdir'])
|
||||
else:
|
||||
localenv['mak_sundials_libdir'] = ''
|
||||
|
||||
localenv['mak_boost_include'] = ('-I' + localenv['boost_inc_dir']
|
||||
if localenv['boost_inc_dir'] else '')
|
||||
localenv['mak_boost_libdir'] = ('-L' + localenv['boost_lib_dir']
|
||||
if localenv['boost_inc_dir'] and
|
||||
localenv['use_boost_libs'] else '')
|
||||
localenv['mak_boost_libs'] = ' '.join('-l%s' % s
|
||||
for s in localenv['boost_libs'])
|
||||
if localenv['sundials_include']:
|
||||
localenv['mak_sundials_include'] = '-I' + localenv['sundials_include']
|
||||
pc_incdirs.append(localenv['sundials_include'])
|
||||
else:
|
||||
localenv['mak_sundials_include'] = ''
|
||||
|
||||
#
|
||||
# Handle blas lapack linkage
|
||||
#
|
||||
if localenv['boost_inc_dir']:
|
||||
localenv['mak_boost_include'] = '-I' + localenv['boost_inc_dir']
|
||||
pc_incdirs.append(localenv['boost_inc_dir'])
|
||||
else:
|
||||
localenv['mak_boost_include'] = ''
|
||||
|
||||
if localenv['boost_lib_dir'] and localenv['use_boost_libs']:
|
||||
localenv['mak_boost_libdir'] = '-L' + localenv['boost_lib_dir']
|
||||
pc_libdirs.append(localenv['boost_lib_dir'])
|
||||
else:
|
||||
localenv['mak_boost_libdir'] = ''
|
||||
|
||||
localenv['mak_boost_libs'] = ' '.join('-l%s' % s for s in localenv['boost_libs'])
|
||||
pc_libs += localenv['boost_libs']
|
||||
|
||||
# Handle blas/lapack linkage
|
||||
localenv['mak_have_blas_lapack_dir'] = '1' if localenv['blas_lapack_dir'] else '0'
|
||||
|
||||
if localenv['blas_lapack_dir']:
|
||||
localenv['mak_blas_lapack_libs'] = ' '.join('-l%s' % s
|
||||
for s in localenv['blas_lapack_libs'])
|
||||
localenv['mak_blas_lapack_libs'] = ' '.join('-l%s' % s for s in localenv['blas_lapack_libs'])
|
||||
pc_libs += localenv['blas_lapack_libs']
|
||||
else:
|
||||
localenv['mak_blas_lapack_libs'] = ('-L' + '$inst_libdir' + ' -lctlapack -lctblas')
|
||||
|
||||
localenv['mak_threadflags'] = localenv['thread_flags']
|
||||
if '-pthread' in localenv['thread_flags']:
|
||||
localenv['mak_fort_threadflags'] = '-lpthread'
|
||||
pc_cflags.append('-pthread')
|
||||
pc_libs.append('pthread')
|
||||
else:
|
||||
localenv['mak_fort_threadflags'] = ''
|
||||
|
||||
#
|
||||
# Handle f2c Linkage
|
||||
#
|
||||
localenv['mak_have_f2c_lib'] = '1' if localenv['build_with_f2c'] else '0'
|
||||
# print 'make_have-f2c_lib = ', localenv['mak_have_f2c_lib']
|
||||
|
||||
mak = build(localenv.SubstFile('Cantera.mak', 'Cantera.mak.in'))
|
||||
install('$inst_incdir', mak)
|
||||
|
||||
# Generate cantera.pc for use with pkg-config
|
||||
localenv['pc_prefix'] = localenv['prefix']
|
||||
localenv['pc_libdirs'] = ' '.join('-L' + d for d in pc_libdirs)
|
||||
localenv['pc_libs'] = ' '.join('-l' + lib for lib in pc_libs)
|
||||
localenv['pc_incdirs'] = ' '.join('-I' + d for d in pc_incdirs)
|
||||
localenv['pc_cflags'] = ' '.join(pc_cflags)
|
||||
|
||||
pc = build(localenv.SubstFile('cantera.pc', 'cantera.pc.in'))
|
||||
install('$inst_libdir/pkgconfig', pc)
|
||||
|
||||
# @deprecated The install_tsc script is unused and should be removed
|
||||
if localenv['layout'] != 'debian':
|
||||
install('$inst_bindir', '#platform/posix/bin/install_tsc')
|
||||
|
|
|
|||
|
|
@ -1,22 +1,12 @@
|
|||
# @PACKAGE_NAME@ installation details
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
# Fortran compilation and linking information
|
||||
# Retrieve these using `pkg-config --variable=name @PACKAGE_NAME@`
|
||||
fflags=-I@libdir@
|
||||
flibs=-L@libdir@ -lf@PACKAGE_NAME@ -l@PACKAGE_NAME@
|
||||
prefix=@pc_prefix@
|
||||
exec_prefix=${prefix}/bin
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: @PACKAGE_NAME@
|
||||
Description: @PACKAGE_DESCRIPTION@
|
||||
URL: @PACKAGE_URL@
|
||||
Requires:
|
||||
Version: @VERSION@
|
||||
Name: Cantera
|
||||
Description: Cantera library
|
||||
URL: http://cantera.googlecode.com
|
||||
Version: @cantera_version@
|
||||
|
||||
LINK = -lctcxx -luser -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
|
||||
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
|
||||
LINK += -lctlapack -lctblas -lctf2c -lm -lstdc++
|
||||
|
||||
Libs: -L${libdir} ${LINK}
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} @pc_libdirs@ -lcantera @pc_libs@
|
||||
Cflags: @pc_cflags@ -I${includedir} @pc_incdirs@
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue