Better namespace CMake folders for Visual Studio

This helps Visual Studio users have less clutter in their solution
explorer. This also updates spirv-tools to a newer version that folders
itself. This also updates spirv-headers so that spirv-tools compiles.
This commit is contained in:
Corentin Wallez 2017-07-10 19:08:46 -04:00 committed by Corentin Wallez
parent fd589f3919
commit 6fb3aebf0c
5 changed files with 25 additions and 6 deletions

View File

@ -58,7 +58,7 @@ endif()
function(NXTExternalTarget folder target) function(NXTExternalTarget folder target)
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS ${NXT_FLAGS}) set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS ${NXT_FLAGS})
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${NXT_DEFS}) set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${NXT_DEFS})
set_property(TARGET ${target} PROPERTY FOLDER ${folder}) set_property(TARGET ${target} PROPERTY FOLDER "nxt/${folder}")
endfunction() endfunction()
function(NXTInternalTarget folder target) function(NXTInternalTarget folder target)

View File

@ -27,4 +27,4 @@ list(APPEND COMMON_SOURCES
add_library(nxt_common STATIC ${COMMON_SOURCES}) add_library(nxt_common STATIC ${COMMON_SOURCES})
target_include_directories(nxt_common PUBLIC ${SRC_DIR}) target_include_directories(nxt_common PUBLIC ${SRC_DIR})
NXTInternalTarget("src" nxt_common) NXTInternalTarget("" nxt_common)

View File

@ -40,7 +40,11 @@ target_include_directories(glad PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/glad/include)
NXTExternalTarget("third_party" glad) NXTExternalTarget("third_party" glad)
# ShaderC # ShaderC
# Prevent SPIRV-Tools from using Werror as it has a warning on MSVC
set(SPIRV_WERROR OFF)
# Don't add unnecessary shaderc targets
set(SHADERC_SKIP_TESTS ON) set(SHADERC_SKIP_TESTS ON)
# Help shaderc find the non-standard paths for its dependencies
set(SHADERC_GOOGLE_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest CACHE STRING "Location of googletest source") set(SHADERC_GOOGLE_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest CACHE STRING "Location of googletest source")
set(SHADERC_GLSLANG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/glslang" CACHE STRING "Location of glslang source") set(SHADERC_GLSLANG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/glslang" CACHE STRING "Location of glslang source")
set(SHADERC_SPIRV_TOOLS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools CACHE STRING "Location of spirv-tools source") set(SHADERC_SPIRV_TOOLS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools CACHE STRING "Location of spirv-tools source")
@ -50,8 +54,23 @@ set(PYTHON_EXE ${PYTHON_EXECUTABLE})
# Need to include this for spirv-tools to find it # Need to include this for spirv-tools to find it
add_subdirectory(spirv-headers) add_subdirectory(spirv-headers)
add_subdirectory(shaderc) add_subdirectory(shaderc)
NXTExternalTarget("third_party" shaderc) # Namespace the shaderc targets in a folder to avoid cluttering the
NXTExternalTarget("third_party" shaderc_util) # Visual Studio solution explorer
set_target_properties(
add-copyright
build-version
check-copyright
glslc
glslc_exe
install-headers
shaderc
shaderc_util
shaderc_combined_genfile
shaderc-online-compile testdata
SPIRV-Headers-example
SPIRV-Headers-example-1.1
PROPERTIES FOLDER "third_party/shaderc"
)
# SPIRV-Cross # SPIRV-Cross
add_library(spirv_cross STATIC add_library(spirv_cross STATIC

@ -1 +1 @@
Subproject commit 90dbe74b1f182aed7c4bd1cdccf1426df1032c49 Subproject commit 661ad91124e6af2272afd00f804d8aa276e17107

@ -1 +1 @@
Subproject commit f92e87a8f85915e8e0cbd39d0ca7fb004c0da05e Subproject commit 06d4fd52c244ee5abf6819f721b9f68e5a3fcdb0