mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
Merge pull request #33177 from tchaikov/wip-clang-pybind
pybind: customize compiler before checking cflags Reviewed-by: Mark Kogan <mkogan@redhat.com>
This commit is contained in:
commit
ccb8d61ff3
@ -9,20 +9,21 @@ import tempfile
|
||||
import textwrap
|
||||
from distutils.ccompiler import new_compiler
|
||||
from distutils.errors import CompileError, LinkError
|
||||
from itertools import filterfalse
|
||||
from itertools import filterfalse, takewhile
|
||||
import distutils.sysconfig
|
||||
|
||||
|
||||
def filter_unsupported_flags(compiler, flags):
|
||||
if 'clang' in compiler:
|
||||
return filterfalse(lambda f:
|
||||
f in ('-mcet',
|
||||
'-fstack-clash-protection',
|
||||
'-fno-var-tracking-assignments',
|
||||
'-Wno-deprecated-register',
|
||||
'-Wno-gnu-designator') or
|
||||
f.startswith('-fcf-protection'),
|
||||
flags)
|
||||
args = takewhile(lambda argv: not argv.startswith('-'), [compiler] + flags)
|
||||
if any('clang' in arg for arg in args):
|
||||
return list(filterfalse(lambda f:
|
||||
f in ('-mcet',
|
||||
'-fstack-clash-protection',
|
||||
'-fno-var-tracking-assignments',
|
||||
'-Wno-deprecated-register',
|
||||
'-Wno-gnu-designator') or
|
||||
f.startswith('-fcf-protection'),
|
||||
flags))
|
||||
else:
|
||||
return flags
|
||||
|
||||
@ -61,6 +62,7 @@ def get_python_flags(libs):
|
||||
py_libs = sum((libs.split() for libs in
|
||||
distutils.sysconfig.get_config_vars('LIBS', 'SYSLIBS')), [])
|
||||
compiler = new_compiler()
|
||||
distutils.sysconfig.customize_compiler(compiler)
|
||||
return dict(
|
||||
include_dirs=[distutils.sysconfig.get_python_inc()],
|
||||
library_dirs=distutils.sysconfig.get_config_vars('LIBDIR', 'LIBPL'),
|
||||
|
@ -2,7 +2,7 @@ from __future__ import print_function
|
||||
import distutils.sysconfig
|
||||
from distutils.errors import CompileError, LinkError
|
||||
from distutils.ccompiler import new_compiler
|
||||
from itertools import filterfalse
|
||||
from itertools import filterfalse, takewhile
|
||||
|
||||
import os
|
||||
import pkgutil
|
||||
@ -14,15 +14,16 @@ import textwrap
|
||||
|
||||
|
||||
def filter_unsupported_flags(compiler, flags):
|
||||
if 'clang' in compiler:
|
||||
return filterfalse(lambda f:
|
||||
f in ('-mcet',
|
||||
'-fstack-clash-protection',
|
||||
'-fno-var-tracking-assignments',
|
||||
'-Wno-deprecated-register',
|
||||
'-Wno-gnu-designator') or
|
||||
f.startswith('-fcf-protection'),
|
||||
flags)
|
||||
args = takewhile(lambda argv: not argv.startswith('-'), [compiler] + flags)
|
||||
if any('clang' in arg for arg in args):
|
||||
return list(filterfalse(lambda f:
|
||||
f in ('-mcet',
|
||||
'-fstack-clash-protection',
|
||||
'-fno-var-tracking-assignments',
|
||||
'-Wno-deprecated-register',
|
||||
'-Wno-gnu-designator') or
|
||||
f.startswith('-fcf-protection'),
|
||||
flags))
|
||||
else:
|
||||
return flags
|
||||
|
||||
@ -64,6 +65,7 @@ def get_python_flags(libs):
|
||||
py_libs = sum((libs.split() for libs in
|
||||
distutils.sysconfig.get_config_vars('LIBS', 'SYSLIBS')), [])
|
||||
compiler = new_compiler()
|
||||
distutils.sysconfig.customize_compiler(compiler)
|
||||
return dict(
|
||||
include_dirs=[distutils.sysconfig.get_python_inc()],
|
||||
library_dirs=distutils.sysconfig.get_config_vars('LIBDIR', 'LIBPL'),
|
||||
|
@ -9,20 +9,21 @@ import tempfile
|
||||
import textwrap
|
||||
from distutils.ccompiler import new_compiler
|
||||
from distutils.errors import CompileError, LinkError
|
||||
from itertools import filterfalse
|
||||
from itertools import filterfalse, takewhile
|
||||
import distutils.sysconfig
|
||||
|
||||
|
||||
def filter_unsupported_flags(compiler, flags):
|
||||
if 'clang' in compiler:
|
||||
return filterfalse(lambda f:
|
||||
f in ('-mcet',
|
||||
'-fstack-clash-protection',
|
||||
'-fno-var-tracking-assignments',
|
||||
'-Wno-deprecated-register',
|
||||
'-Wno-gnu-designator') or
|
||||
f.startswith('-fcf-protection'),
|
||||
flags)
|
||||
args = takewhile(lambda argv: not argv.startswith('-'), [compiler] + flags)
|
||||
if any('clang' in arg for arg in args):
|
||||
return list(filterfalse(lambda f:
|
||||
f in ('-mcet',
|
||||
'-fstack-clash-protection',
|
||||
'-fno-var-tracking-assignments',
|
||||
'-Wno-deprecated-register',
|
||||
'-Wno-gnu-designator') or
|
||||
f.startswith('-fcf-protection'),
|
||||
flags))
|
||||
else:
|
||||
return flags
|
||||
|
||||
@ -61,6 +62,7 @@ def get_python_flags(libs):
|
||||
py_libs = sum((libs.split() for libs in
|
||||
distutils.sysconfig.get_config_vars('LIBS', 'SYSLIBS')), [])
|
||||
compiler = new_compiler()
|
||||
distutils.sysconfig.customize_compiler(compiler)
|
||||
return dict(
|
||||
include_dirs=[distutils.sysconfig.get_python_inc()],
|
||||
library_dirs=distutils.sysconfig.get_config_vars('LIBDIR', 'LIBPL'),
|
||||
|
@ -10,19 +10,21 @@ import tempfile
|
||||
import textwrap
|
||||
from distutils.ccompiler import new_compiler
|
||||
from distutils.errors import CompileError, LinkError
|
||||
from itertools import filterfalse, takewhile
|
||||
import distutils.sysconfig
|
||||
|
||||
|
||||
def filter_unsupported_flags(compiler, flags):
|
||||
if 'clang' in compiler:
|
||||
return filterfalse(lambda f:
|
||||
f in ('-mcet',
|
||||
'-fstack-clash-protection',
|
||||
'-fno-var-tracking-assignments',
|
||||
'-Wno-deprecated-register',
|
||||
'-Wno-gnu-designator') or
|
||||
f.startswith('-fcf-protection'),
|
||||
flags)
|
||||
args = takewhile(lambda argv: not argv.startswith('-'), [compiler] + flags)
|
||||
if any('clang' in arg for arg in args):
|
||||
return list(filterfalse(lambda f:
|
||||
f in ('-mcet',
|
||||
'-fstack-clash-protection',
|
||||
'-fno-var-tracking-assignments',
|
||||
'-Wno-deprecated-register',
|
||||
'-Wno-gnu-designator') or
|
||||
f.startswith('-fcf-protection'),
|
||||
flags))
|
||||
else:
|
||||
return flags
|
||||
|
||||
@ -61,6 +63,7 @@ def get_python_flags(libs):
|
||||
py_libs = sum((libs.split() for libs in
|
||||
distutils.sysconfig.get_config_vars('LIBS', 'SYSLIBS')), [])
|
||||
compiler = new_compiler()
|
||||
distutils.sysconfig.customize_compiler(compiler)
|
||||
return dict(
|
||||
include_dirs=[distutils.sysconfig.get_python_inc()],
|
||||
library_dirs=distutils.sysconfig.get_config_vars('LIBDIR', 'LIBPL'),
|
||||
|
Loading…
Reference in New Issue
Block a user