2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #4706 from ReinUsesLisp/cmake-host-shaders

video_core: Fix instances where msbuild always regenerated host shaders
This commit is contained in:
bunnei 2020-10-23 10:01:16 -07:00 committed by GitHub
commit 3e46934442
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 12 deletions

View file

@ -1,23 +1,16 @@
set(SHADER_FILES set(SHADER_SOURCES
opengl_present.frag opengl_present.frag
opengl_present.vert opengl_present.vert
) )
set(SHADER_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/include) set(SHADER_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/include)
set(HOST_SHADERS_INCLUDE ${SHADER_INCLUDE} PARENT_SCOPE)
set(SHADER_DIR ${SHADER_INCLUDE}/video_core/host_shaders) set(SHADER_DIR ${SHADER_INCLUDE}/video_core/host_shaders)
add_custom_command( set(HOST_SHADERS_INCLUDE ${SHADER_INCLUDE} PARENT_SCOPE)
OUTPUT
${SHADER_DIR}
COMMAND
${CMAKE_COMMAND} -E make_directory ${SHADER_DIR}
)
set(INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/source_shader.h.in) set(INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/source_shader.h.in)
set(HEADER_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/StringShaderHeader.cmake) set(HEADER_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/StringShaderHeader.cmake)
foreach(FILENAME IN ITEMS ${SHADER_FILES}) foreach(FILENAME IN ITEMS ${SHADER_SOURCES})
string(REPLACE "." "_" SHADER_NAME ${FILENAME}) string(REPLACE "." "_" SHADER_NAME ${FILENAME})
set(SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}) set(SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME})
set(HEADER_FILE ${SHADER_DIR}/${SHADER_NAME}.h) set(HEADER_FILE ${SHADER_DIR}/${SHADER_NAME}.h)
@ -29,8 +22,8 @@ foreach(FILENAME IN ITEMS ${SHADER_FILES})
MAIN_DEPENDENCY MAIN_DEPENDENCY
${SOURCE_FILE} ${SOURCE_FILE}
DEPENDS DEPENDS
${HEADER_GENERATOR}
${INPUT_FILE} ${INPUT_FILE}
# HEADER_GENERATOR should be included here but msbuild seems to assume it's always modified
) )
set(SHADER_HEADERS ${SHADER_HEADERS} ${HEADER_FILE}) set(SHADER_HEADERS ${SHADER_HEADERS} ${HEADER_FILE})
endforeach() endforeach()
@ -39,5 +32,5 @@ add_custom_target(host_shaders
DEPENDS DEPENDS
${SHADER_HEADERS} ${SHADER_HEADERS}
SOURCES SOURCES
${SHADER_FILES} ${SHADER_SOURCES}
) )

View file

@ -8,4 +8,6 @@ string(TOUPPER ${CONTENTS_NAME} CONTENTS_NAME)
file(READ ${SOURCE_FILE} CONTENTS) file(READ ${SOURCE_FILE} CONTENTS)
get_filename_component(OUTPUT_DIR ${HEADER_FILE} DIRECTORY)
make_directory(${OUTPUT_DIR})
configure_file(${INPUT_FILE} ${HEADER_FILE} @ONLY) configure_file(${INPUT_FILE} ${HEADER_FILE} @ONLY)