Skip to content

Commit

Permalink
Merge pull request #273 from Bam4d/fix_shader_build
Browse files Browse the repository at this point in the history
Fix shader build
  • Loading branch information
Bam4d authored Jan 4, 2023
2 parents 26532b9 + 65be3ff commit b84e3d2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ find_package(yaml-cpp REQUIRED)
find_package(spdlog REQUIRED)

if(NOT WASM)

include(${CMAKE_BINARY_DIR}/conan_paths.cmake)

# find the dependencies from conan
set(PYBIND11_FINDPYTHON FALSE)

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

# ShaderC for compiling shaders
find_package(shaderc REQUIRED)

endif()

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

if(MSVC)
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.bat RESULT_VARIABLE rv)
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.bat RESULT_VARIABLE STATUS)
if(STATUS AND NOT STATUS EQUAL 0)
message( FATAL_ERROR "Cannot compile shaders: ${STATUS}")
endif()
else()
execute_process(COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.sh RESULT_VARIABLE rv)
execute_process(COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.sh RESULT_VARIABLE STATUS)
if(STATUS AND NOT STATUS EQUAL 0)
message( FATAL_ERROR "Cannot compile shaders: ${STATUS}")
endif()
endif()

if(ENABLE_PYTHON_BINDINGS)
Expand Down
6 changes: 4 additions & 2 deletions CMakeUserPresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@
"buildPresets": [
{
"name": "Debug WASM",
"configurePreset": "Debug WASM"
"configurePreset": "Debug WASM",
"configuration": "Debug"
},
{
"name": "Debug Native",
"configurePreset": "Debug Native"
"configurePreset": "Debug Native",
"configuration": "Debug"
}
]
}
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,15 @@ You will need to set up a python environment of your choice and then install con
pip install conan
```

### Debug Layers for Vulkan

When compiling using Debug, you will need the install vulkan validation layers which are part of the [vulkan sdk](https://vulkan.lunarg.com/).
Otherwise you will run into errors like:
```
[2023-01-04 15:21:54.412] [warning] Required vulkan layer unavailable: VK_LAYER_KHRONOS_validation
[2023-01-04 15:21:54.412] [error] Missing vulkan extensions in driver. Please upgrade your vulkan drivers.
```

### Ubuntu

```
Expand Down
2 changes: 1 addition & 1 deletion compile_shaders.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

set -e
cd "$(dirname "$0")"

compile_shaders_in_dir () {
Expand Down
1 change: 1 addition & 0 deletions deps/conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ tools.cmake.cmaketoolchain:generator=Ninja
[generators]
CMakeToolchain
CMakeDeps
cmake_paths


0 comments on commit b84e3d2

Please sign in to comment.