parent
89fd726e07
commit
12763e19d8
26
setup.py
26
setup.py
@ -261,6 +261,7 @@ def init_env(
|
|||||||
canberra_library: Optional[str] = None,
|
canberra_library: Optional[str] = None,
|
||||||
extra_logging: Iterable[str] = (),
|
extra_logging: Iterable[str] = (),
|
||||||
extra_include_dirs: Iterable[str] = (),
|
extra_include_dirs: Iterable[str] = (),
|
||||||
|
ignore_compiler_warnings: bool = False
|
||||||
) -> Env:
|
) -> Env:
|
||||||
native_optimizations = native_optimizations and not sanitize and not debug
|
native_optimizations = native_optimizations and not sanitize and not debug
|
||||||
if native_optimizations and is_macos and is_arm:
|
if native_optimizations and is_macos and is_arm:
|
||||||
@ -287,19 +288,15 @@ def init_env(
|
|||||||
cppflags = shlex.split(cppflags_)
|
cppflags = shlex.split(cppflags_)
|
||||||
for el in extra_logging:
|
for el in extra_logging:
|
||||||
cppflags.append('-DDEBUG_{}'.format(el.upper().replace('-', '_')))
|
cppflags.append('-DDEBUG_{}'.format(el.upper().replace('-', '_')))
|
||||||
|
werror = '' if ignore_compiler_warnings else '-Werror'
|
||||||
|
std = '' if is_openbsd else '-std=c11'
|
||||||
|
sanitize_flag = ' '.join(sanitize_args)
|
||||||
|
march = '-march=native' if native_optimizations else ''
|
||||||
cflags_ = os.environ.get(
|
cflags_ = os.environ.get(
|
||||||
'OVERRIDE_CFLAGS', (
|
'OVERRIDE_CFLAGS', (
|
||||||
'-Wextra {} -Wno-missing-field-initializers -Wall -Wstrict-prototypes {}'
|
f'-Wextra {float_conversion} -Wno-missing-field-initializers -Wall -Wstrict-prototypes {std}'
|
||||||
' -pedantic-errors -Werror {} {} -fwrapv {} {} -pipe {} -fvisibility=hidden {}'
|
f' -pedantic-errors {werror} {optimize} {sanitize_flag} -fwrapv {stack_protector} {missing_braces}'
|
||||||
).format(
|
f' -pipe {march} -fvisibility=hidden {fortify_source}'
|
||||||
float_conversion,
|
|
||||||
'' if is_openbsd else '-std=c11',
|
|
||||||
optimize,
|
|
||||||
' '.join(sanitize_args),
|
|
||||||
stack_protector,
|
|
||||||
missing_braces,
|
|
||||||
'-march=native' if native_optimizations else '',
|
|
||||||
fortify_source
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
cflags = shlex.split(cflags_) + shlex.split(
|
cflags = shlex.split(cflags_) + shlex.split(
|
||||||
@ -754,7 +751,7 @@ def init_env_from_args(args: Options, native_optimizations: bool = False) -> Non
|
|||||||
env = init_env(
|
env = init_env(
|
||||||
args.debug, args.sanitize, native_optimizations, args.link_time_optimization, args.profile,
|
args.debug, args.sanitize, native_optimizations, args.link_time_optimization, args.profile,
|
||||||
args.egl_library, args.startup_notification_library, args.canberra_library,
|
args.egl_library, args.startup_notification_library, args.canberra_library,
|
||||||
args.extra_logging, args.extra_include_dirs
|
args.extra_logging, args.extra_include_dirs, args.ignore_compiler_warnings
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -1234,6 +1231,11 @@ def option_parser() -> argparse.ArgumentParser: # {{{
|
|||||||
action='store_false',
|
action='store_false',
|
||||||
help='Turn off Link Time Optimization (LTO).'
|
help='Turn off Link Time Optimization (LTO).'
|
||||||
)
|
)
|
||||||
|
p.add_argument(
|
||||||
|
'--ignore-compiler-warnings',
|
||||||
|
default=False, action='store_true',
|
||||||
|
help='Ignore any warnings from the compiler while building'
|
||||||
|
)
|
||||||
return p
|
return p
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user