mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-15 17:28:28 +00:00
Add examples to SDL.sln
(#11255)
This commit is contained in:
parent
1e7c186461
commit
152bcce85f
46 changed files with 1029 additions and 2 deletions
46
VisualC/examples/generate.py
Normal file
46
VisualC/examples/generate.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
import os
|
||||
import pathlib
|
||||
import uuid
|
||||
|
||||
REPOSITORY_ROOT = pathlib.Path(__file__).parent.parent.parent
|
||||
|
||||
def generate(x, y):
|
||||
guid = str(uuid.uuid4()).upper()
|
||||
text = f"""
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{{{guid}}}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />
|
||||
<ItemGroup>
|
||||
<None Include="$(SolutionDir)\\..\\examples\\{x}\\{y}\\README.txt" />
|
||||
<ClCompile Include="$(SolutionDir)\\..\\examples\\{x}\\{y}\\*.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
""".strip()
|
||||
|
||||
file_name = REPOSITORY_ROOT / "VisualC" / "examples" / x / y / f"{y}.vcxproj"
|
||||
|
||||
if file_name.exists():
|
||||
print("Skipping:", file_name)
|
||||
return
|
||||
|
||||
print("Generating file:", file_name)
|
||||
os.makedirs(file_name.parent, exist_ok=True)
|
||||
with open(file_name, "w", encoding="utf-8") as f:
|
||||
f.write(text)
|
||||
|
||||
|
||||
def main():
|
||||
path = REPOSITORY_ROOT / "examples"
|
||||
for x in path.iterdir():
|
||||
if x.is_dir():
|
||||
for y in x.iterdir():
|
||||
generate(x.name, y.name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue