mirror of
https://github.com/Cantera/cantera.git
synced 2024-07-07 04:53:34 -05:00
[SCons] Remove duplicated flags from cantera.pc
This commit is contained in:
parent
2820749d0f
commit
8360ad95e7
|
@ -18,12 +18,17 @@ pc_libdirs = []
|
|||
pc_incdirs = []
|
||||
pc_cflags = list(localenv['CXXFLAGS'])
|
||||
|
||||
if 'Accelerate' in localenv['FRAMEWORKS']:
|
||||
pc_cflags.append('-framework Accelerate')
|
||||
|
||||
if '-pthread' in localenv['thread_flags']:
|
||||
pc_cflags.append('-pthread')
|
||||
pc_libs.append('pthread')
|
||||
|
||||
flag_excludes = []
|
||||
if localenv["package_build"]:
|
||||
# Remove local conda build environment from the installed include list
|
||||
for i in range(len(pc_cflags) - 1):
|
||||
if pc_cflags[i] == '-isystem' and '/_build_env/' in pc_cflags[i+1]:
|
||||
del pc_cflags[i:i+2]
|
||||
break
|
||||
flag_excludes.extend(("-isysroot", "-mmacosx", "-march", "-mtune",
|
||||
"-fdebug-prefix-map", ".*/_build_env/"))
|
||||
else:
|
||||
pc_incdirs.extend(localenv["extra_inc_dirs"])
|
||||
pc_libdirs.extend(localenv["extra_lib_dirs"])
|
||||
|
@ -37,29 +42,13 @@ else:
|
|||
if localenv["use_hdf5"]:
|
||||
pc_incdirs.append(localenv["hdf_include"])
|
||||
|
||||
if 'Accelerate' in localenv['FRAMEWORKS']:
|
||||
pc_cflags.append('-framework Accelerate')
|
||||
|
||||
if '-pthread' in localenv['thread_flags']:
|
||||
pc_cflags.append('-pthread')
|
||||
pc_libs.append('pthread')
|
||||
|
||||
if localenv["package_build"]:
|
||||
# Remove sysroot flags in templated output files. This only applies to the
|
||||
# conda package for now.
|
||||
# Users should compile against their local SDKs, which should be backwards
|
||||
# compatible with the SDK used for building.
|
||||
excludes = (
|
||||
"-isysroot", "-mmacosx", "-march", "-mtune", "-fdebug-prefix-map")
|
||||
localenv["CCFLAGS"] = compiler_flag_list(localenv["CCFLAGS"], env["CC"], excludes)
|
||||
localenv["CXXFLAGS"] = compiler_flag_list(localenv["CXXFLAGS"], env["CC"], excludes)
|
||||
pc_cflags.extend(f"-isystem {dir}" for dir in pc_incdirs if dir)
|
||||
|
||||
# Generate cantera.pc for use with pkg-config
|
||||
localenv["pc_prefix"] = localenv["prefix"]
|
||||
localenv["pc_libdirs"] = " ".join(f"-L{dir}" for dir in pc_libdirs)
|
||||
localenv["pc_libdirs"] = " ".join(f"-L{dir}" for dir in pc_libdirs if dir)
|
||||
localenv["pc_libs"] = " ".join(f"-l{lib}" for lib in pc_libs)
|
||||
localenv["pc_incdirs"] = " ".join(f"-I{dir}" for dir in pc_incdirs)
|
||||
localenv["pc_cflags"] = " ".join(pc_cflags)
|
||||
localenv["pc_cflags"] = " ".join(compiler_flag_list(pc_cflags, env["CC"], flag_excludes))
|
||||
|
||||
pc = build(localenv.SubstFile("cantera.pc", "cantera.pc.in"))
|
||||
install("$inst_libdir/pkgconfig", pc)
|
||||
|
|
|
@ -9,4 +9,4 @@ URL: https://cantera.org
|
|||
Version: @cantera_version@
|
||||
|
||||
Libs: -L${libdir} -Wl,-rpath,${libdir} @pc_libdirs@ @pc_libs@
|
||||
Cflags: @pc_cflags@ -I${includedir} @pc_incdirs@
|
||||
Cflags: @pc_cflags@ -isystem ${includedir}
|
||||
|
|
Loading…
Reference in New Issue
Block a user