Only run the generator script if necessary.

This commit is contained in:
Patrick 2023-11-06 20:45:22 +01:00
parent 5998696860
commit 76a7a5e35b

View File

@ -2,10 +2,13 @@
from SCons.Script import *
import os
import pathlib
import platform
import subprocess
import sys
_SCRIPT_STAMPFILE = '.spp_script_run'
def cook(env: Environment, remote: str = 'github', git_ref: str = '') -> dict:
if remote == 'mewin':
repo = env.Cook('GitBranch', repo_name = 'glslang_mewin', remote_url = 'https://git.mewin.de/mewin/glslang.git', git_ref = git_ref or 'master')
@ -14,7 +17,10 @@ def cook(env: Environment, remote: str = 'github', git_ref: str = '') -> dict:
checkout_root = repo['checkout_root']
# TODO: windows?
subprocess.run(('/usr/bin/env', 'python3', 'update_glslang_sources.py'), cwd=checkout_root, stdout=sys.stdout, stderr=sys.stderr, check=True)
did_run_script = os.path.exists(os.path.join(repo['checkout_root'], _SCRIPT_STAMPFILE))
if not did_run_script or env['UPDATE_REPOSITORIES']:
subprocess.run(('/usr/bin/env', 'python3', 'update_glslang_sources.py'), cwd=checkout_root, stdout=sys.stdout, stderr=sys.stderr, check=True)
pathlib.Path(repo['checkout_root'], _SCRIPT_STAMPFILE).touch()
# build_result = env.Cook('CMakeProject', project_root=checkout_root, generate_args = ['-DBUILD_TESTING=OFF'])
# generator_script = os.path.join(repo['checkout_root'], 'gen_extension_headers.py')