mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-06 08:01:58 +02:00
Use a better default march for binary builds
x86-64-v2 implies SSE4.2 which should be available everywhere by now. We will see if we get errors with it. https://developers.redhat.com/blog/2021/01/05/building-red-hat-enterprise-linux-9-for-the-x86-64-v2-microarchitecture-level#architectural_considerations_for_rhel_9
This commit is contained in:
15
setup.py
15
setup.py
@@ -416,10 +416,6 @@ def init_env(
|
||||
vcs_rev: str = '',
|
||||
) -> Env:
|
||||
native_optimizations = native_optimizations and not sanitize
|
||||
if native_optimizations and is_macos and is_arm:
|
||||
# see https://github.com/kovidgoyal/kitty/issues/3126
|
||||
# -march=native is not supported when targeting Apple Silicon
|
||||
native_optimizations = False
|
||||
cc, ccver = cc_version()
|
||||
if verbose:
|
||||
print('CC:', cc, ccver)
|
||||
@@ -447,7 +443,6 @@ def init_env(
|
||||
werror = '' if ignore_compiler_warnings else '-pedantic-errors -Werror'
|
||||
std = '' if is_openbsd else '-std=c11'
|
||||
sanitize_flag = ' '.join(sanitize_args)
|
||||
march = '-march=native' if native_optimizations else ''
|
||||
# Using -mbranch-protection=standard causes crashes on Linux ARM, reported
|
||||
# in https://github.com/kovidgoyal/kitty/issues/6845#issuecomment-1835886938
|
||||
arm_control_flow_protection = '-mbranch-protection=standard' if is_macos else ''
|
||||
@@ -459,6 +454,16 @@ def init_env(
|
||||
env_ldflags = shlex.split(os.environ.get('LDFLAGS', ''))
|
||||
if control_flow_protection and not test_compile(cc, control_flow_protection, *env_cppflags, *env_cflags, ldflags=env_ldflags):
|
||||
control_flow_protection = ''
|
||||
march = ''
|
||||
if is_macos and is_arm:
|
||||
# see https://github.com/kovidgoyal/kitty/issues/3126
|
||||
# -march=native is not supported when targeting Apple Silicon
|
||||
pass
|
||||
else:
|
||||
if native_optimizations:
|
||||
march = '-march=native -mtune=native'
|
||||
elif sys.maxsize > 2**32 and not is_arm: # 64 bit Intel
|
||||
march = '-march=x86-64-v2 -mtune=generic'
|
||||
cflags_ = os.environ.get(
|
||||
'OVERRIDE_CFLAGS', (
|
||||
f'-Wextra {float_conversion} -Wno-missing-field-initializers -Wall -Wstrict-prototypes {std}'
|
||||
|
||||
Reference in New Issue
Block a user