Skip to content

Commit

Permalink
cmake: allow system glslang library
Browse files Browse the repository at this point in the history
  • Loading branch information
abouvier committed Mar 18, 2024
1 parent c7ee42f commit f1c0efa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
23 changes: 15 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ option(ENABLE_LOG "Enable full logging" OFF)
option(ASAN "Enable address sanitizer" OFF)
option(USE_GLES "Use GLES[3] API" OFF)
option(USE_GLES2 "Use GLES2 API" OFF)
option(USE_HOST_GLSLANG "Use host glslang" OFF)
option(USE_HOST_LIBZIP "Use host libzip" ON)
option(USE_HOST_SDL "Use host SDL library" ${USE_HOST_SDL_DEFAULT})
option(USE_OPENMP "Use OpenMP if available" ON)
Expand Down Expand Up @@ -383,14 +384,20 @@ add_subdirectory(core/deps/glm)
target_link_libraries(${PROJECT_NAME} PRIVATE glm::glm)

if(USE_VULKAN)
option(BUILD_EXTERNAL "Build external dependencies in /External" OFF)
option(SKIP_GLSLANG_INSTALL "Skip installation" ON)
option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" OFF)
option(ENABLE_GLSLANG_BINARIES "Builds glslang and spirv-remap" OFF)
option(ENABLE_HLSL "Enables HLSL input support" OFF)
option(ENABLE_PCH "Enables Precompiled header" OFF)
add_subdirectory(core/deps/glslang EXCLUDE_FROM_ALL)
target_link_libraries(${PROJECT_NAME} PRIVATE glslang-default-resource-limits SPIRV)
if(USE_HOST_GLSLANG)
find_package(glslang REQUIRED)
else()
option(BUILD_EXTERNAL "Build external dependencies in /External" OFF)
option(SKIP_GLSLANG_INSTALL "Skip installation" ON)
option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" OFF)
option(ENABLE_GLSLANG_BINARIES "Builds glslang and spirv-remap" OFF)
option(ENABLE_HLSL "Enables HLSL input support" OFF)
option(ENABLE_PCH "Enables Precompiled header" OFF)
add_subdirectory(core/deps/glslang EXCLUDE_FROM_ALL)
add_library(glslang::glslang-default-resource-limits ALIAS glslang-default-resource-limits)
add_library(glslang::SPIRV ALIAS SPIRV)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE glslang::glslang-default-resource-limits glslang::SPIRV)
endif()

if(NOT LIBRETRO)
Expand Down
3 changes: 2 additions & 1 deletion core/rend/vulkan/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
#include "vulkan_context.h"

#include <glslang/Public/ResourceLimits.h>
#include <SPIRV/GlslangToSpv.h>
#include <glslang/Public/ShaderLang.h>
#include <glslang/SPIRV/GlslangToSpv.h>

int ShaderCompiler::initCount;

Expand Down
2 changes: 1 addition & 1 deletion core/rend/vulkan/shaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
#pragma once
#include "vulkan.h"
#include "SPIRV/GlslangToSpv.h"
#include <glslang/SPIRV/GlslangToSpv.h>

#include <glm/glm.hpp>
#include <map>
Expand Down

0 comments on commit f1c0efa

Please sign in to comment.