mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Switch to detecting clang rather than gcc
gcc makes it impossible to detect that it is gcc via --version so instead detect clang and assume gcc if not clang. Fixes #7218
This commit is contained in:
@@ -46,7 +46,6 @@ class BinaryArch(NamedTuple):
|
|||||||
isa: ISA = ISA.AMD64
|
isa: ISA = ISA.AMD64
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Env:
|
class Env:
|
||||||
|
|
||||||
cc: List[str] = []
|
cc: List[str] = []
|
||||||
@@ -89,8 +88,8 @@ class Env:
|
|||||||
return self._cc_version_string
|
return self._cc_version_string
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_gcc(self) -> bool:
|
def is_clang(self) -> bool:
|
||||||
return 'gcc' in self.cc_version_string.split(maxsplit=1)[0].lower()
|
return 'clang' in self.cc_version_string.split(maxsplit=1)[0].lower()
|
||||||
|
|
||||||
def copy(self) -> 'Env':
|
def copy(self) -> 'Env':
|
||||||
ans = Env(self.cc, list(self.cppflags), list(self.cflags), list(self.ldflags), dict(self.library_paths), list(self.ldpaths), self.ccver)
|
ans = Env(self.cc, list(self.cppflags), list(self.cflags), list(self.ldflags), dict(self.library_paths), list(self.ldpaths), self.ccver)
|
||||||
|
|||||||
8
setup.py
8
setup.py
@@ -701,11 +701,11 @@ def get_source_specific_cflags(env: Env, src: str) -> List[str]:
|
|||||||
ans.append('-msse4.2' if '128' in src else '-mavx2')
|
ans.append('-msse4.2' if '128' in src else '-mavx2')
|
||||||
if '256' in src:
|
if '256' in src:
|
||||||
# We have manual vzeroupper so prevent compiler from emitting it causing duplicates
|
# We have manual vzeroupper so prevent compiler from emitting it causing duplicates
|
||||||
if env.is_gcc:
|
if env.is_clang:
|
||||||
ans.append('-mno-vzeroupper')
|
|
||||||
else:
|
|
||||||
ans.append('-mllvm')
|
ans.append('-mllvm')
|
||||||
ans.append('-x86-use-vzeroupper=0')
|
ans.append('-x86-use-vzeroupper=0')
|
||||||
|
else:
|
||||||
|
ans.append('-mno-vzeroupper')
|
||||||
elif env.binary_arch.isa != ISA.ARM64:
|
elif env.binary_arch.isa != ISA.ARM64:
|
||||||
ans.append('-DKITTY_NO_SIMD')
|
ans.append('-DKITTY_NO_SIMD')
|
||||||
elif src.startswith('3rdparty/base64/lib/arch/'):
|
elif src.startswith('3rdparty/base64/lib/arch/'):
|
||||||
@@ -1170,7 +1170,7 @@ def build_launcher(args: Options, launcher_dir: str = '.', bundle_type: str = 's
|
|||||||
sanitize_args = get_sanitize_args(env.cc, env.ccver)
|
sanitize_args = get_sanitize_args(env.cc, env.ccver)
|
||||||
cflags.extend(sanitize_args)
|
cflags.extend(sanitize_args)
|
||||||
ldflags.extend(sanitize_args)
|
ldflags.extend(sanitize_args)
|
||||||
libs += ['-lasan'] if not is_macos and env.is_gcc else []
|
libs += ['-lasan'] if not is_macos and not env.is_clang else []
|
||||||
else:
|
else:
|
||||||
cflags.append('-g')
|
cflags.append('-g')
|
||||||
if args.profile:
|
if args.profile:
|
||||||
|
|||||||
Reference in New Issue
Block a user