externals: allow user to use system glslang (#7075)

This commit is contained in:
Castor215 2023-10-17 19:02:50 +01:00 committed by GitHub
parent e49b3c75bd
commit 2d83fff581
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 7 deletions

View file

@ -103,6 +103,7 @@ option(USE_SYSTEM_XBYAK "Use the system xbyak (instead of the bundled one)" OFF)
option(USE_SYSTEM_INIH "Use the system inih (instead of the bundled one)" OFF) option(USE_SYSTEM_INIH "Use the system inih (instead of the bundled one)" OFF)
option(USE_SYSTEM_FDK_AAC_HEADERS "Use the system fdk-aac headers (instead of the bundled one)" OFF) option(USE_SYSTEM_FDK_AAC_HEADERS "Use the system fdk-aac headers (instead of the bundled one)" OFF)
option(USE_SYSTEM_FFMPEG_HEADERS "Use the system FFmpeg headers (instead of the bundled one)" OFF) option(USE_SYSTEM_FFMPEG_HEADERS "Use the system FFmpeg headers (instead of the bundled one)" OFF)
option(USE_SYSTEM_GLSLANG "Use the system glslang and SPIR-V libraries (instead of the bundled ones)" OFF)
if (CITRA_USE_PRECOMPILED_HEADERS) if (CITRA_USE_PRECOMPILED_HEADERS)
message(STATUS "Using Precompiled Headers.") message(STATUS "Using Precompiled Headers.")

View file

@ -117,13 +117,24 @@ endif()
add_subdirectory(glad) add_subdirectory(glad)
# glslang # glslang
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "") if(USE_SYSTEM_GLSLANG)
set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "") find_package(glslang REQUIRED)
set(ENABLE_SPVREMAPPER OFF CACHE BOOL "") add_library(glslang INTERFACE)
set(ENABLE_CTEST OFF CACHE BOOL "") add_library(SPIRV INTERFACE)
set(ENABLE_HLSL OFF CACHE BOOL "") target_link_libraries(glslang INTERFACE glslang::glslang)
set(BUILD_EXTERNAL OFF CACHE BOOL "") target_link_libraries(SPIRV INTERFACE glslang::SPIRV)
add_subdirectory(glslang) # System include path is different from submodule include path
get_target_property(GLSLANG_PREFIX glslang::SPIRV INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(SPIRV SYSTEM INTERFACE "${GLSLANG_PREFIX}/glslang")
else()
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "")
set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "")
set(ENABLE_SPVREMAPPER OFF CACHE BOOL "")
set(ENABLE_CTEST OFF CACHE BOOL "")
set(ENABLE_HLSL OFF CACHE BOOL "")
set(BUILD_EXTERNAL OFF CACHE BOOL "")
add_subdirectory(glslang)
endif()
# inih # inih
if(USE_SYSTEM_INIH) if(USE_SYSTEM_INIH)