Skip to content

Commit 4b8198d

Browse files
committed
Fix the pathing for install_dependencies_windows.bat also fix CMakeLists.txt slang pathing.
1 parent 16019ca commit 4b8198d

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

attachments/simple_engine/CMakeLists.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,10 @@ target_sources(VulkanCppModule
5454
# Platform-specific settings
5555
if(ANDROID)
5656
# Android-specific settings
57-
add_definitions(-DPLATFORM_ANDROID=1)
58-
add_definitions(-DPLATFORM_DESKTOP=0)
57+
add_definitions(-DPLATFORM_ANDROID)
5958
else()
6059
# Desktop-specific settings
61-
add_definitions(-DPLATFORM_ANDROID=0)
62-
add_definitions(-DPLATFORM_DESKTOP=1)
60+
add_definitions(-DPLATFORM_DESKTOP)
6361
endif()
6462

6563
# Shader compilation
@@ -69,8 +67,11 @@ file(GLOB SLANG_SHADER_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/shaders/*.slang)
6967
# Find slangc executable (optional)
7068
find_program(SLANGC_EXECUTABLE slangc HINTS $ENV{VULKAN_SDK}/bin)
7169

72-
# Compile Slang shaders using slangc if available
7370
if(SLANGC_EXECUTABLE)
71+
# Ensure the output directory for compiled shaders exists
72+
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/shaders)
73+
74+
# Compile Slang shaders using slangc
7475
foreach(SHADER ${SLANG_SHADER_SOURCES})
7576
get_filename_component(SHADER_NAME ${SHADER} NAME)
7677
get_filename_component(SHADER_NAME_WE ${SHADER_NAME} NAME_WE)
@@ -83,6 +84,7 @@ if(SLANGC_EXECUTABLE)
8384
)
8485
list(APPEND SHADER_SPVS ${CMAKE_CURRENT_BINARY_DIR}/shaders/${OUTPUT_NAME}.spv)
8586
endforeach()
87+
8688
add_custom_target(shaders DEPENDS ${SHADER_SPVS})
8789
else()
8890
message(STATUS "slangc not found. Skipping shader compilation step.")
@@ -189,7 +191,9 @@ endif()
189191

190192
# Include binary and resource directories in the package
191193
install(TARGETS SimpleEngine DESTINATION bin)
192-
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/shaders DESTINATION share/SimpleEngine)
194+
if(SLANGC_EXECUTABLE)
195+
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/shaders DESTINATION share/SimpleEngine)
196+
endif()
193197

194198
# Install models and textures if they exist
195199
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/models)

attachments/simple_engine/install_dependencies_windows.bat

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@ if %errorLevel% neq 0 (
6161
)
6262
)
6363

64+
set "CHOCO_EXE=choco"
65+
if exist "%ProgramData%\chocolatey\bin\choco.exe" set "CHOCO_EXE=%ProgramData%\chocolatey\bin\choco.exe"
66+
6467
REM Install CMake if not present
6568
where cmake >nul 2>&1
6669
if %errorLevel% neq 0 (
6770
echo Installing CMake...
68-
choco install cmake -y
71+
"%CHOCO_EXE%" install cmake -y
6972
if %errorLevel% neq 0 (
7073
echo Failed to install CMake via Chocolatey. Please install manually from https://cmake.org/download/
7174
)
@@ -75,7 +78,7 @@ REM Install Git if not present
7578
where git >nul 2>&1
7679
if %errorLevel% neq 0 (
7780
echo Installing Git...
78-
choco install git -y
81+
"%CHOCO_EXE%" install git -y
7982
if %errorLevel% neq 0 (
8083
echo Failed to install Git via Chocolatey. Please install manually from https://git-scm.com/download/win
8184
)
@@ -85,7 +88,7 @@ REM Install Vulkan SDK
8588
echo Installing Vulkan SDK...
8689
if not exist "C:\VulkanSDK" (
8790
echo Downloading and installing Vulkan SDK...
88-
choco install vulkan-sdk -y
91+
"%CHOCO_EXE%" install vulkan-sdk -y
8992
if %errorLevel% neq 0 (
9093
echo Failed to install Vulkan SDK via Chocolatey.
9194
echo Please download and install manually from https://vulkan.lunarg.com/sdk/home#windows
@@ -156,8 +159,7 @@ if not exist "C:\Program Files\Slang" (
156159

157160
REM Add Slang to PATH (requires restart or new command prompt)
158161
echo Adding Slang to system PATH...
159-
for /f "tokens=2*" %%A in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH') do set "CURRENT_PATH=%%B"
160-
setx PATH "%CURRENT_PATH%;C:\Program Files\Slang\bin" /M
162+
powershell -NoProfile -ExecutionPolicy Bypass -Command "$p=[Environment]::GetEnvironmentVariable('Path','Machine'); if(-not ($p -split ';' | ForEach-Object { $_.ToLower() }) -contains 'c:\\program files\\slang\\bin'){ [Environment]::SetEnvironmentVariable('Path',($p + ';C:\\Program Files\\Slang\\bin'),'Machine'); Write-Host 'Added Slang to machine PATH'; } else { Write-Host 'Slang already in machine PATH'; }"
161163
echo Note: You may need to restart your command prompt for Slang to be available in PATH
162164
) else (
163165
echo Failed to download Slang compiler. Please install manually from:

0 commit comments

Comments
 (0)