mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
Let the lazy write-back choice check find its compiler by itself.
tests/wb_lazy_check.py took the compiler from tests/diff/common.py, which imports Unicorn and Capstone before anything else: on a PC without them the check stopped at the import, though it needs only a C compiler. It now picks the compiler as tests/gpa_check.py does. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -1,16 +1,27 @@
|
||||
"""Build and run tests/wb_lazy_check.c: runtime/wb_lazy_choice.h, whether the lazy write-back runs, by the player's
|
||||
setting, the platform and the GPU driver.
|
||||
|
||||
Needs a C compiler only: no Vulkan headers, no GPU and no game files.
|
||||
|
||||
Usage: wb_lazy_check.py
|
||||
"""
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / 'tests' / 'diff'))
|
||||
from common import MSYS_BIN, compiler # noqa: E402
|
||||
MSYS_BIN = Path(r'C:\msys64\ucrt64\bin')
|
||||
|
||||
|
||||
def compiler():
|
||||
"""$CC, else MSYS2 UCRT64's clang, else clang on PATH (as tests/diff/common.py picks it, without its Unicorn)."""
|
||||
if os.environ.get('CC'):
|
||||
return os.environ['CC']
|
||||
if os.name == 'nt' and (MSYS_BIN / 'clang.exe').exists():
|
||||
return str(MSYS_BIN / 'clang.exe')
|
||||
return shutil.which('clang') or 'clang'
|
||||
|
||||
|
||||
def main():
|
||||
@@ -22,7 +33,7 @@ def main():
|
||||
env['PATH'] = str(MSYS_BIN) + os.pathsep + env.get('PATH', '')
|
||||
# every platform's and driver's choice is checked through wb_lazy_choice's arguments; WBL_ON_WINDOWS on the one
|
||||
# built for
|
||||
subprocess.check_call([compiler(), '-O1', '-Wall', '-Werror', '-I', str(ROOT / 'runtime'),
|
||||
subprocess.check_call([compiler(), '-std=gnu11', '-O1', '-Wall', '-Werror', '-I', str(ROOT / 'runtime'),
|
||||
str(ROOT / 'tests' / 'wb_lazy_check.c'), '-o', str(exe)], env=env)
|
||||
return subprocess.run([str(exe)], env=env).returncode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user