Skip to content

Commit 2c1227f

Browse files
committed
WIP: build with either 2022 or 2026
1 parent e7b9b7f commit 2c1227f

5 files changed

Lines changed: 88 additions & 9 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ Core/vendor/GLAD
2727
Core/vendor/NFD-Extended
2828
Core/vendor/tracy
2929
Editor/SandboxProject/Assets/Scripts/Binaries
30+
Editor/Resources/Cache

scripts/Setup.py

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23
import subprocess
34
import CheckPython
45

@@ -14,6 +15,56 @@
1415

1516
colorama.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
1869
os.chdir('../')
1970

@@ -25,7 +76,7 @@
2576
if (not Vulkan.CheckVulkanSDK()):
2677
print("Vulkan SDK not installed.")
2778
exit()
28-
79+
2980
if (Vulkan.CheckVulkanSDKDebugLibs()):
3081
print(f"{Style.BRIGHT}{Back.GREEN}Vulkan SDK debug libs located.{Style.RESET_ALL}")
3182

@@ -35,8 +86,10 @@
3586
if 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

4194
os.chdir('Editor/SandboxProject')
42-
subprocess.call(["../../vendor/bin/premake5.exe", "vs2022"])
95+
subprocess.call(["../../vendor/bin/premake5.exe", generator])

scripts/Vulkan.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
VULKAN_SDK = os.environ.get('VULKAN_SDK')
1818
LUX_REQUIRED_VULKAN_VERSION = '1.4.' # Any 1.3 version is fine
19-
LUX_INSTALL_VULKAN_VERSION = '1.3.216.0' # Specifically install this one if no 1.3 version is present
19+
LUX_INSTALL_VULKAN_VERSION = '1.4.341.1' # Specifically install this one if no 1.3 version is present
2020
VULKAN_SDK_INSTALLER_URL = f'https://sdk.lunarg.com/sdk/download/{LUX_INSTALL_VULKAN_VERSION}/windows/VulkanSDK-{LUX_INSTALL_VULKAN_VERSION}-Installer.exe'
21-
VULKAN_SDK_LOCAL_PATH = 'Lux/vendor/VulkanSDK'
21+
VULKAN_SDK_LOCAL_PATH = 'Core/vendor/VulkanSDK'
2222
VULKAN_SDK_EXE_PATH = f'{VULKAN_SDK_LOCAL_PATH}/VulkanSDK.exe'
2323

2424
colorama.init()

scripts/Win-GenProjects.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,39 @@
1414

1515
colorama.init()
1616

17+
18+
def select_visual_studio_generator():
19+
generators = {
20+
"2022": "vs2022",
21+
"2026": "vs2026"
22+
}
23+
24+
while True:
25+
choice = input(
26+
f"{Style.BRIGHT}{Fore.CYAN}Which Visual Studio version do you want to generate? "
27+
f"(2022/2026): {Style.RESET_ALL}"
28+
).strip()
29+
30+
if choice in generators:
31+
return generators[choice]
32+
33+
print(
34+
f"{Style.BRIGHT}{Fore.RED}Invalid choice. Please enter 2022 or 2026.{Style.RESET_ALL}"
35+
)
36+
37+
1738
# Change from Scripts directory to root
1839
os.chdir('../')
1940

2041
if not os.path.exists("Editor/DotNet/"):
2142
os.makedirs("Editor/DotNet/")
2243

23-
print(f"{Style.BRIGHT}{Back.GREEN}Generating Visual Studio 2022 solution.{Style.RESET_ALL}")
24-
subprocess.call(["vendor/bin/premake5.exe", "vs2022"])
44+
selected_generator = select_visual_studio_generator()
45+
46+
print(
47+
f"{Style.BRIGHT}{Back.GREEN}Generating Visual Studio {selected_generator[2:]} solution.{Style.RESET_ALL}"
48+
)
49+
subprocess.call(["vendor/bin/premake5.exe", selected_generator])
2550

2651
os.chdir('Editor/SandboxProject')
27-
subprocess.call(["../../vendor/bin/premake5.exe", "vs2022"])
52+
subprocess.call(["../../vendor/bin/premake5.exe", selected_generator])

vendor/bin/premake5.exe

372 KB
Binary file not shown.

0 commit comments

Comments
 (0)