Skip to content

Commit b84e3d2

Browse files
authored
Merge pull request #273 from Bam4d/fix_shader_build
Fix shader build
2 parents 26532b9 + 65be3ff commit b84e3d2

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ find_package(yaml-cpp REQUIRED)
128128
find_package(spdlog REQUIRED)
129129

130130
if(NOT WASM)
131+
132+
include(${CMAKE_BINARY_DIR}/conan_paths.cmake)
133+
131134
# find the dependencies from conan
132135
set(PYBIND11_FINDPYTHON FALSE)
133136

@@ -149,6 +152,7 @@ if(NOT WASM)
149152

150153
# ShaderC for compiling shaders
151154
find_package(shaderc REQUIRED)
155+
152156
endif()
153157

154158
include(${CMAKE_CONFIG_FOLDER}/targets/griddly.cmake)
@@ -163,9 +167,15 @@ else()
163167
set(ENV{GLSLC_BIN} ${CONAN_SHADERC_ROOT}/bin/glslc)
164168

165169
if(MSVC)
166-
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.bat RESULT_VARIABLE rv)
170+
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.bat RESULT_VARIABLE STATUS)
171+
if(STATUS AND NOT STATUS EQUAL 0)
172+
message( FATAL_ERROR "Cannot compile shaders: ${STATUS}")
173+
endif()
167174
else()
168-
execute_process(COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.sh RESULT_VARIABLE rv)
175+
execute_process(COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.sh RESULT_VARIABLE STATUS)
176+
if(STATUS AND NOT STATUS EQUAL 0)
177+
message( FATAL_ERROR "Cannot compile shaders: ${STATUS}")
178+
endif()
169179
endif()
170180

171181
if(ENABLE_PYTHON_BINDINGS)

CMakeUserPresets.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535
"buildPresets": [
3636
{
3737
"name": "Debug WASM",
38-
"configurePreset": "Debug WASM"
38+
"configurePreset": "Debug WASM",
39+
"configuration": "Debug"
3940
},
4041
{
4142
"name": "Debug Native",
42-
"configurePreset": "Debug Native"
43+
"configurePreset": "Debug Native",
44+
"configuration": "Debug"
4345
}
4446
]
4547
}

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,15 @@ You will need to set up a python environment of your choice and then install con
235235
pip install conan
236236
```
237237

238+
### Debug Layers for Vulkan
239+
240+
When compiling using Debug, you will need the install vulkan validation layers which are part of the [vulkan sdk](https://vulkan.lunarg.com/).
241+
Otherwise you will run into errors like:
242+
```
243+
[2023-01-04 15:21:54.412] [warning] Required vulkan layer unavailable: VK_LAYER_KHRONOS_validation
244+
[2023-01-04 15:21:54.412] [error] Missing vulkan extensions in driver. Please upgrade your vulkan drivers.
245+
```
246+
238247
### Ubuntu
239248

240249
```

compile_shaders.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
2+
set -e
33
cd "$(dirname "$0")"
44

55
compile_shaders_in_dir () {

deps/conanfile.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ tools.cmake.cmaketoolchain:generator=Ninja
1414
[generators]
1515
CMakeToolchain
1616
CMakeDeps
17+
cmake_paths
1718

1819

0 commit comments

Comments
 (0)