diff --git a/SConstruct b/SConstruct index ce40e1831..11ffeb5de 100644 --- a/SConstruct +++ b/SConstruct @@ -1684,10 +1684,6 @@ if env['blas_lapack_libs']: linkLibs.extend(env['blas_lapack_libs']) linkSharedLibs.extend(env['blas_lapack_libs']) -if env['system_fmt']: - linkLibs.append('fmt') - linkSharedLibs.append('fmt') - # Store the list of needed static link libraries in the environment env['cantera_libs'] = linkLibs env['cantera_shared_libs'] = linkSharedLibs diff --git a/ext/SConscript b/ext/SConscript index 3b9c89c03..954256e2c 100644 --- a/ext/SConscript +++ b/ext/SConscript @@ -36,30 +36,23 @@ def prep_gmock(env): def prep_fmt(env): localenv = prep_default(env) - if not env['system_fmt']: - localenv.Prepend(CPPPATH=Dir('#include/cantera/ext')) - license_files.append(('fmtlib', 'fmt/LICENSE.rst')) - for name in ('format.h', 'ostream.h', 'printf.h', 'core.h', 'format-inl.h', 'posix.h'): - build(copyenv.Command("#include/cantera/ext/fmt/" + name, - "#ext/fmt/include/fmt/" + name, - Copy('$TARGET', '$SOURCE'))) return localenv # each element of libs is: (subdir, (file extensions), prepfunction) libs = [('libexecstream', ['cpp'], prep_default)] -# fmtlib versions less than 5.0.0 had the source files for the library in a different folder. -# Also, we expect system-installed versions of fmtlib >= 5.0.0 to have a library already compiled -if LooseVersion(env['FMT_VERSION']) < LooseVersion('5.0.0'): - libs.append(('fmt/fmt', ['cc'], prep_fmt)) -elif not env['system_fmt']: - libs.append(('fmt/src', ['cc'], prep_fmt)) - for subdir, extensions, prepFunction in libs: localenv = prepFunction(env) objects = localenv.SharedObject(mglob(localenv, subdir, *extensions)) libraryTargets.extend(objects) +if not env['system_fmt']: + license_files.append(('fmtlib', 'fmt/LICENSE.rst')) + for name in ('format.h', 'ostream.h', 'printf.h', 'core.h', 'format-inl.h', 'posix.h'): + build(copyenv.Command("#include/cantera/ext/fmt/" + name, + "#ext/fmt/include/fmt/" + name, + Copy('$TARGET', '$SOURCE'))) + if env['system_sundials'] == 'n': localenv = prep_default(env) localenv.Prepend(CPPPATH=Dir('#include/cantera/ext')) diff --git a/include/cantera/base/fmt.h b/include/cantera/base/fmt.h index 211fe4e98..8ea3ef0a5 100644 --- a/include/cantera/base/fmt.h +++ b/include/cantera/base/fmt.h @@ -7,6 +7,10 @@ //! the same name in kinetics/Group.h #define FMT_NO_FMT_STRING_ALIAS +//! Use header-only library to avoid relocation issues with linking to the +//! static libfmt.a +#define FMT_HEADER_ONLY + #if CT_USE_SYSTEM_FMT #include "fmt/format.h" #if defined(FMT_VERSION) && FMT_VERSION >= 40000