11import os
2+ import sys
23import subprocess
34import CheckPython
45
1415
1516colorama .init ()
1617
18+
19+ def choose_visual_studio_generator ():
20+ options = ["vs2022" , "vs2026" ]
21+
22+ if len (sys .argv ) > 1 :
23+ selected = sys .argv [1 ].lower ().strip ()
24+ if selected in options :
25+ return selected
26+
27+ try :
28+ import msvcrt
29+ except ImportError :
30+ while True :
31+ choice = input ("Choose Visual Studio generator (vs2022/vs2026): " ).strip ().lower ()
32+ if choice in options :
33+ return choice
34+ print (f"{ Fore .RED } Invalid choice. Please enter vs2022 or vs2026.{ Style .RESET_ALL } " )
35+
36+ selected_index = 0
37+
38+ def render_menu ():
39+ os .system ("cls" )
40+ print (f"{ Style .BRIGHT } { Back .GREEN } Choose Visual Studio generator{ Style .RESET_ALL } " )
41+ print ()
42+ print ("Use the arrow keys to move, then press Enter to confirm." )
43+ print ()
44+
45+ for index , option in enumerate (options ):
46+ prefix = ">" if index == selected_index else " "
47+ if index == selected_index :
48+ print (f"{ Fore .CYAN } { Style .BRIGHT } { prefix } { option } { Style .RESET_ALL } " )
49+ else :
50+ print (f" { option } " )
51+
52+ while True :
53+ render_menu ()
54+ key = msvcrt .getch ()
55+
56+ if key in (b"\r " , b"\n " ):
57+ os .system ("cls" )
58+ return options [selected_index ]
59+
60+ if key in (b"\x00 " , b"\xe0 " ):
61+ arrow = msvcrt .getch ()
62+ if arrow == b"H" : # Up
63+ selected_index = (selected_index - 1 ) % len (options )
64+ elif arrow == b"P" : # Down
65+ selected_index = (selected_index + 1 ) % len (options )
66+
67+
1768# Change from Scripts directory to root
1869os .chdir ('../' )
1970
2576if (not Vulkan .CheckVulkanSDK ()):
2677 print ("Vulkan SDK not installed." )
2778 exit ()
28-
79+
2980if (Vulkan .CheckVulkanSDKDebugLibs ()):
3081 print (f"{ Style .BRIGHT } { Back .GREEN } Vulkan SDK debug libs located.{ Style .RESET_ALL } " )
3182
3586if not os .path .exists ("Editor/DotNet/" ):
3687 os .makedirs ("Editor/DotNet/" )
3788
38- print (f"{ Style .BRIGHT } { Back .GREEN } Generating Visual Studio 2022 solution.{ Style .RESET_ALL } " )
39- subprocess .call (["vendor/bin/premake5.exe" , "vs2022" ])
89+ generator = choose_visual_studio_generator ()
90+
91+ print (f"{ Style .BRIGHT } { Back .GREEN } Generating { generator } solution.{ Style .RESET_ALL } " )
92+ subprocess .call (["vendor/bin/premake5.exe" , generator ])
4093
4194os .chdir ('Editor/SandboxProject' )
42- subprocess .call (["../../vendor/bin/premake5.exe" , "vs2022" ])
95+ subprocess .call (["../../vendor/bin/premake5.exe" , generator ])
0 commit comments