Browse Source

Specify C source file in example VC projects

Susko3 5 tháng trước cách đây
mục cha
commit
94d110edd5
24 tập tin đã thay đổi với 34 bổ sung26 xóa
  1. 1 1
      VisualC/examples/audio/01-simple-playback/01-simple-playback.vcxproj
  2. 1 1
      VisualC/examples/audio/02-simple-playback-callback/02-simple-playback-callback.vcxproj
  3. 1 1
      VisualC/examples/audio/03-load-wav/03-load-wav.vcxproj
  4. 1 1
      VisualC/examples/camera/01-read-and-draw/01-read-and-draw.vcxproj
  5. 1 1
      VisualC/examples/game/01-snake/01-snake.vcxproj
  6. 1 1
      VisualC/examples/game/02-woodeneye-008/02-woodeneye-008.vcxproj
  7. 1 1
      VisualC/examples/game/03-infinite-monkeys/03-infinite-monkeys.vcxproj
  8. 11 3
      VisualC/examples/generate.py
  9. 1 1
      VisualC/examples/pen/01-drawing-lines/01-drawing-lines.vcxproj
  10. 1 1
      VisualC/examples/renderer/01-clear/01-clear.vcxproj
  11. 1 1
      VisualC/examples/renderer/02-primitives/02-primitives.vcxproj
  12. 1 1
      VisualC/examples/renderer/03-lines/03-lines.vcxproj
  13. 1 1
      VisualC/examples/renderer/04-points/04-points.vcxproj
  14. 1 1
      VisualC/examples/renderer/05-rectangles/05-rectangles.vcxproj
  15. 1 1
      VisualC/examples/renderer/06-textures/06-textures.vcxproj
  16. 1 1
      VisualC/examples/renderer/07-streaming-textures/07-streaming-textures.vcxproj
  17. 1 1
      VisualC/examples/renderer/08-rotating-textures/08-rotating-textures.vcxproj
  18. 1 1
      VisualC/examples/renderer/09-scaling-textures/09-scaling-textures.vcxproj
  19. 1 1
      VisualC/examples/renderer/10-geometry/10-geometry.vcxproj
  20. 1 1
      VisualC/examples/renderer/11-color-mods/11-color-mods.vcxproj
  21. 1 1
      VisualC/examples/renderer/14-viewport/14-viewport.vcxproj
  22. 1 1
      VisualC/examples/renderer/15-cliprect/15-cliprect.vcxproj
  23. 1 1
      VisualC/examples/renderer/17-read-pixels/17-read-pixels.vcxproj
  24. 1 1
      VisualC/examples/renderer/18-debug-text/18-debug-text.vcxproj

+ 1 - 1
VisualC/examples/audio/01-simple-playback/01-simple-playback.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\audio\01-simple-playback\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\audio\01-simple-playback\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\audio\01-simple-playback\simple-playback.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/audio/02-simple-playback-callback/02-simple-playback-callback.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\audio\02-simple-playback-callback\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\audio\02-simple-playback-callback\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\audio\02-simple-playback-callback\simple-playback-callback.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/audio/03-load-wav/03-load-wav.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\audio\03-load-wav\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\audio\03-load-wav\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\audio\03-load-wav\load-wav.c" />
     <Content Include="$(SolutionDir)\..\test\sample.wav" CopyToOutputDirectory="PreserveNewest" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+ 1 - 1
VisualC/examples/camera/01-read-and-draw/01-read-and-draw.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\camera\01-read-and-draw\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\camera\01-read-and-draw\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\camera\01-read-and-draw\read-and-draw.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/game/01-snake/01-snake.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\game\01-snake\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\game\01-snake\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\game\01-snake\snake.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/game/02-woodeneye-008/02-woodeneye-008.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\game\02-woodeneye-008\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\game\02-woodeneye-008\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\game\02-woodeneye-008\woodeneye-008.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/game/03-infinite-monkeys/03-infinite-monkeys.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\game\03-infinite-monkeys\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\game\03-infinite-monkeys\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\game\03-infinite-monkeys\infinite-monkeys.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 11 - 3
VisualC/examples/generate.py

@@ -4,7 +4,8 @@ import uuid
 
 REPOSITORY_ROOT = pathlib.Path(__file__).parent.parent.parent
 
-def generate(category, example_name):
+
+def generate(category, example_name, c_source_file):
     guid = str(uuid.uuid4()).upper()
     text = f"""
 <?xml version="1.0" encoding="utf-8"?>
@@ -16,7 +17,7 @@ def generate(category, example_name):
   <Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\\..\\examples\\{category}\\{example_name}\\README.txt" />
-    <ClCompile Include="$(SolutionDir)\\..\\examples\\{category}\\{example_name}\\*.c" />
+    <ClCompile Include="$(SolutionDir)\\..\\examples\\{category}\\{example_name}\\{c_source_file}" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />
 </Project>
@@ -34,12 +35,19 @@ def generate(category, example_name):
         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)
+                generate(category.name, example.name, get_c_source_filename(example))
 
 
 if __name__ == "__main__":

+ 1 - 1
VisualC/examples/pen/01-drawing-lines/01-drawing-lines.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\pen\01-drawing-lines\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\pen\01-drawing-lines\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\pen\01-drawing-lines\drawing-lines.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/renderer/01-clear/01-clear.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\01-clear\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\01-clear\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\01-clear\clear.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/renderer/02-primitives/02-primitives.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\02-primitives\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\02-primitives\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\02-primitives\primitives.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/renderer/03-lines/03-lines.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\03-lines\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\03-lines\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\03-lines\lines.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/renderer/04-points/04-points.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\04-points\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\04-points\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\04-points\points.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/renderer/05-rectangles/05-rectangles.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\05-rectangles\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\05-rectangles\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\05-rectangles\rectangles.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/renderer/06-textures/06-textures.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\06-textures\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\06-textures\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\06-textures\textures.c" />
     <Content Include="$(SolutionDir)\..\test\sample.bmp" CopyToOutputDirectory="PreserveNewest" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+ 1 - 1
VisualC/examples/renderer/07-streaming-textures/07-streaming-textures.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\07-streaming-textures\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\07-streaming-textures\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\07-streaming-textures\streaming-textures.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/renderer/08-rotating-textures/08-rotating-textures.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\08-rotating-textures\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\08-rotating-textures\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\08-rotating-textures\rotating-textures.c" />
     <Content Include="$(SolutionDir)\..\test\sample.bmp" CopyToOutputDirectory="PreserveNewest" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+ 1 - 1
VisualC/examples/renderer/09-scaling-textures/09-scaling-textures.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\09-scaling-textures\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\09-scaling-textures\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\09-scaling-textures\scaling-textures.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>

+ 1 - 1
VisualC/examples/renderer/10-geometry/10-geometry.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\10-geometry\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\10-geometry\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\10-geometry\geometry.c" />
     <Content Include="$(SolutionDir)\..\test\sample.bmp" CopyToOutputDirectory="PreserveNewest" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+ 1 - 1
VisualC/examples/renderer/11-color-mods/11-color-mods.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\11-color-mods\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\11-color-mods\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\11-color-mods\color-mods.c" />
     <Content Include="$(SolutionDir)\..\test\sample.bmp" CopyToOutputDirectory="PreserveNewest" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+ 1 - 1
VisualC/examples/renderer/14-viewport/14-viewport.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\14-viewport\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\14-viewport\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\14-viewport\viewport.c" />
     <Content Include="$(SolutionDir)\..\test\sample.bmp" CopyToOutputDirectory="PreserveNewest" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+ 1 - 1
VisualC/examples/renderer/15-cliprect/15-cliprect.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\15-cliprect\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\15-cliprect\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\15-cliprect\cliprect.c" />
     <Content Include="$(SolutionDir)\..\test\sample.bmp" CopyToOutputDirectory="PreserveNewest" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+ 1 - 1
VisualC/examples/renderer/17-read-pixels/17-read-pixels.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\17-read-pixels\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\17-read-pixels\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\17-read-pixels\read-pixels.c" />
     <Content Include="$(SolutionDir)\..\test\sample.bmp" CopyToOutputDirectory="PreserveNewest" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+ 1 - 1
VisualC/examples/renderer/18-debug-text/18-debug-text.vcxproj

@@ -7,7 +7,7 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ItemGroup>
     <None Include="$(SolutionDir)\..\examples\renderer\18-debug-text\README.txt" />
-    <ClCompile Include="$(SolutionDir)\..\examples\renderer\18-debug-text\*.c" />
+    <ClCompile Include="$(SolutionDir)\..\examples\renderer\18-debug-text\debug-text.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 </Project>