From 6aaedb813fa11ba0679c3051bc2eb28646b9506c Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sat, 30 Aug 2025 16:53:58 -0700 Subject: Update to SDL3 --- .../SDL-3.2.20/VisualC/examples/generate.py | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 src/contrib/SDL-3.2.20/VisualC/examples/generate.py (limited to 'src/contrib/SDL-3.2.20/VisualC/examples/generate.py') diff --git a/src/contrib/SDL-3.2.20/VisualC/examples/generate.py b/src/contrib/SDL-3.2.20/VisualC/examples/generate.py new file mode 100755 index 0000000..e06110e --- /dev/null +++ b/src/contrib/SDL-3.2.20/VisualC/examples/generate.py @@ -0,0 +1,54 @@ +import os +import pathlib +import uuid + +REPOSITORY_ROOT = pathlib.Path(__file__).parent.parent.parent + + +def generate(category, example_name, c_source_file): + guid = str(uuid.uuid4()).upper() + text = f""" + + + + {{{guid}}} + + + + + + + + + +""".strip() + + project_file = REPOSITORY_ROOT / "VisualC" / "examples" / category / example_name / f"{example_name}.vcxproj" + + if project_file.exists(): + print("Skipping:", project_file) + return + + print("Generating file:", project_file) + os.makedirs(project_file.parent, exist_ok=True) + with open(project_file, "w", encoding="utf-8") as f: + f.write(text) + + +def get_c_source_filename(example_dir: pathlib.Path): + """Gets the one and only C source file name in the directory of the example.""" + c_files = [f.name for f in example_dir.iterdir() if f.name.endswith(".c")] + assert len(c_files) == 1 + return c_files[0] + + +def main(): + path = REPOSITORY_ROOT / "examples" + for category in path.iterdir(): + if category.is_dir(): + for example in category.iterdir(): + generate(category.name, example.name, get_c_source_filename(example)) + + +if __name__ == "__main__": + main() -- cgit v1.2.3