Add run-cmake.py, deprecate run-cmake.bat

Also drop-in replacement mostly, except extra cmake args need to be provided now after `--` - `python run-cmake.py vs2022-x64 -- -DGLTF_SUPPORT=ON`.

Internally, script relies on env variables much much less.
This commit is contained in:
Andrej730
2026-09-11 16:07:36 +05:00
parent e7b33a909d
commit d5fd959e6c
8 changed files with 352 additions and 31 deletions
+22 -7
View File
@@ -99,6 +99,9 @@ def is_on_off(value: str | None, *, default: bool) -> bool:
return default
OFF_ON = ("OFF", "ON")
BuildCfg = Literal["MinSizeRel", "Release", "RelWithDebInfo", "Debug"]
DebugOrRelease = Literal["Debug", "Release"]
@@ -190,11 +193,23 @@ class BuildDepsCache:
return entries
def find_cached_gen_shorthand() -> str | None:
"""Read GEN_SHORTHAND from the most recently modified BuildDepsCache-*.txt, if any."""
def resolve_generator(generator: str | None) -> str:
"""Return `generator` as-is, or fall back to the GEN_SHORTHAND from the most recently modified
BuildDepsCache-*.txt. Exits if neither is available.
"""
if generator is not None:
return generator
cache_files = sorted(SCRIPT_DIR.glob("BuildDepsCache-*.txt"), key=lambda p: p.stat().st_mtime, reverse=True)
if not cache_files:
return None
cache_file = cache_files[0]
logger.info(f"Found {cache_file.name}, reading GEN_SHORTHAND from it.")
return BuildDepsCache.parse(cache_file).get("GEN_SHORTHAND")
cached_generator = None
if cache_files:
cache_file = cache_files[0]
logger.info(f"Found {cache_file.name}, reading GEN_SHORTHAND from it.")
cached_generator = BuildDepsCache.parse(cache_file).get("GEN_SHORTHAND")
if cached_generator is None:
logger.error(
"BuildDepsCache file does not exist and/or GEN_SHORTHAND missing from it. Run build-deps.py to create it."
)
sys.exit(1)
return cached_generator