diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/CMakeLists.txt | 92 | ||||
| -rw-r--r-- | src/common/scm_rev.cpp.in | 2 | ||||
| -rw-r--r-- | src/common/scm_rev.h | 1 |
3 files changed, 56 insertions, 39 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 845626fc5..f38c0fee9 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -1,42 +1,56 @@ | |||
| 1 | # Generate cpp with Git revision from template | 1 | # Add a custom command to generate a new shader_cache_version hash when any of the following files change |
| 2 | # Also if this is a CI build, add the build name (ie: Nightly, Canary) to the scm_rev file as well | 2 | # NOTE: This is an approximation of what files affect shader generation, its possible something else |
| 3 | set(REPO_NAME "") | 3 | # could affect the result, but much more unlikely than the following files. Keeping a list of files |
| 4 | set(BUILD_VERSION "0") | 4 | # like this allows for much better caching since it doesn't force the user to recompile binary shaders every update |
| 5 | if ($ENV{CI}) | 5 | set(VIDEO_CORE "${CMAKE_SOURCE_DIR}/src/video_core") |
| 6 | if ($ENV{TRAVIS}) | 6 | add_custom_command(OUTPUT scm_rev.cpp |
| 7 | set(BUILD_REPOSITORY $ENV{TRAVIS_REPO_SLUG}) | 7 | COMMAND cmake -DSRC_DIR="${CMAKE_SOURCE_DIR}" -P "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake" |
| 8 | set(BUILD_TAG $ENV{TRAVIS_TAG}) | 8 | DEPENDS |
| 9 | elseif($ENV{APPVEYOR}) | 9 | # WARNING! It was too much work to try and make a common location for this list, |
| 10 | set(BUILD_REPOSITORY $ENV{APPVEYOR_REPO_NAME}) | 10 | # so if you need to change it, please update CMakeModules/GenerateSCMRev.cmake as well |
| 11 | set(BUILD_TAG $ENV{APPVEYOR_REPO_TAG_NAME}) | 11 | "${VIDEO_CORE}/renderer_opengl/gl_shader_cache.cpp" |
| 12 | endif() | 12 | "${VIDEO_CORE}/renderer_opengl/gl_shader_cache.h" |
| 13 | # regex capture the string nightly or canary into CMAKE_MATCH_1 | 13 | "${VIDEO_CORE}/renderer_opengl/gl_shader_decompiler.cpp" |
| 14 | string(REGEX MATCH "yuzu-emu/yuzu-?(.*)" OUTVAR ${BUILD_REPOSITORY}) | 14 | "${VIDEO_CORE}/renderer_opengl/gl_shader_decompiler.h" |
| 15 | if (${CMAKE_MATCH_COUNT} GREATER 0) | 15 | "${VIDEO_CORE}/renderer_opengl/gl_shader_disk_cache.cpp" |
| 16 | # capitalize the first letter of each word in the repo name. | 16 | "${VIDEO_CORE}/renderer_opengl/gl_shader_disk_cache.h" |
| 17 | string(REPLACE "-" ";" REPO_NAME_LIST ${CMAKE_MATCH_1}) | 17 | "${VIDEO_CORE}/renderer_opengl/gl_shader_gen.cpp" |
| 18 | foreach(WORD ${REPO_NAME_LIST}) | 18 | "${VIDEO_CORE}/renderer_opengl/gl_shader_gen.h" |
| 19 | string(SUBSTRING ${WORD} 0 1 FIRST_LETTER) | 19 | "${VIDEO_CORE}/shader/decode/arithmetic.cpp" |
| 20 | string(SUBSTRING ${WORD} 1 -1 REMAINDER) | 20 | "${VIDEO_CORE}/shader/decode/arithmetic_half.cpp" |
| 21 | string(TOUPPER ${FIRST_LETTER} FIRST_LETTER) | 21 | "${VIDEO_CORE}/shader/decode/arithmetic_half_immediate.cpp" |
| 22 | set(REPO_NAME "${REPO_NAME}${FIRST_LETTER}${REMAINDER}") | 22 | "${VIDEO_CORE}/shader/decode/arithmetic_immediate.cpp" |
| 23 | endforeach() | 23 | "${VIDEO_CORE}/shader/decode/arithmetic_integer.cpp" |
| 24 | if (BUILD_TAG) | 24 | "${VIDEO_CORE}/shader/decode/arithmetic_integer_immediate.cpp" |
| 25 | string(REGEX MATCH "${CMAKE_MATCH_1}-([0-9]+)" OUTVAR ${BUILD_TAG}) | 25 | "${VIDEO_CORE}/shader/decode/bfe.cpp" |
| 26 | if (${CMAKE_MATCH_COUNT} GREATER 0) | 26 | "${VIDEO_CORE}/shader/decode/bfi.cpp" |
| 27 | set(BUILD_VERSION ${CMAKE_MATCH_1}) | 27 | "${VIDEO_CORE}/shader/decode/conversion.cpp" |
| 28 | endif() | 28 | "${VIDEO_CORE}/shader/decode/ffma.cpp" |
| 29 | if (BUILD_VERSION) | 29 | "${VIDEO_CORE}/shader/decode/float_set.cpp" |
| 30 | # This leaves a trailing space on the last word, but we actually want that | 30 | "${VIDEO_CORE}/shader/decode/float_set_predicate.cpp" |
| 31 | # because of how it's styled in the title bar. | 31 | "${VIDEO_CORE}/shader/decode/half_set.cpp" |
| 32 | set(BUILD_FULLNAME "${REPO_NAME} ${BUILD_VERSION} ") | 32 | "${VIDEO_CORE}/shader/decode/half_set_predicate.cpp" |
| 33 | else() | 33 | "${VIDEO_CORE}/shader/decode/hfma2.cpp" |
| 34 | set(BUILD_FULLNAME "") | 34 | "${VIDEO_CORE}/shader/decode/integer_set.cpp" |
| 35 | endif() | 35 | "${VIDEO_CORE}/shader/decode/integer_set_predicate.cpp" |
| 36 | endif() | 36 | "${VIDEO_CORE}/shader/decode/memory.cpp" |
| 37 | endif() | 37 | "${VIDEO_CORE}/shader/decode/other.cpp" |
| 38 | endif() | 38 | "${VIDEO_CORE}/shader/decode/predicate_set_predicate.cpp" |
| 39 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in" "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp" @ONLY) | 39 | "${VIDEO_CORE}/shader/decode/predicate_set_register.cpp" |
| 40 | "${VIDEO_CORE}/shader/decode/register_set_predicate.cpp" | ||
| 41 | "${VIDEO_CORE}/shader/decode/shift.cpp" | ||
| 42 | "${VIDEO_CORE}/shader/decode/video.cpp" | ||
| 43 | "${VIDEO_CORE}/shader/decode/xmad.cpp" | ||
| 44 | "${VIDEO_CORE}/shader/decode.cpp" | ||
| 45 | "${VIDEO_CORE}/shader/shader_ir.cpp" | ||
| 46 | "${VIDEO_CORE}/shader/shader_ir.h" | ||
| 47 | "${VIDEO_CORE}/shader/track.cpp" | ||
| 48 | # and also check that the scm_rev files haven't changed | ||
| 49 | "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in" | ||
| 50 | "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h" | ||
| 51 | # technically we should regenerate if the git version changed, but its not worth the effort imo | ||
| 52 | "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake" | ||
| 53 | ) | ||
| 40 | 54 | ||
| 41 | add_library(common STATIC | 55 | add_library(common STATIC |
| 42 | alignment.h | 56 | alignment.h |
diff --git a/src/common/scm_rev.cpp.in b/src/common/scm_rev.cpp.in index 2b1727769..d69038f65 100644 --- a/src/common/scm_rev.cpp.in +++ b/src/common/scm_rev.cpp.in | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #define BUILD_DATE "@BUILD_DATE@" | 11 | #define BUILD_DATE "@BUILD_DATE@" |
| 12 | #define BUILD_FULLNAME "@BUILD_FULLNAME@" | 12 | #define BUILD_FULLNAME "@BUILD_FULLNAME@" |
| 13 | #define BUILD_VERSION "@BUILD_VERSION@" | 13 | #define BUILD_VERSION "@BUILD_VERSION@" |
| 14 | #define SHADER_CACHE_VERSION "@SHADER_CACHE_VERSION@" | ||
| 14 | 15 | ||
| 15 | namespace Common { | 16 | namespace Common { |
| 16 | 17 | ||
| @@ -21,6 +22,7 @@ const char g_build_name[] = BUILD_NAME; | |||
| 21 | const char g_build_date[] = BUILD_DATE; | 22 | const char g_build_date[] = BUILD_DATE; |
| 22 | const char g_build_fullname[] = BUILD_FULLNAME; | 23 | const char g_build_fullname[] = BUILD_FULLNAME; |
| 23 | const char g_build_version[] = BUILD_VERSION; | 24 | const char g_build_version[] = BUILD_VERSION; |
| 25 | const char g_shader_cache_version[] = SHADER_CACHE_VERSION; | ||
| 24 | 26 | ||
| 25 | } // namespace | 27 | } // namespace |
| 26 | 28 | ||
diff --git a/src/common/scm_rev.h b/src/common/scm_rev.h index af9a9daed..666bf0367 100644 --- a/src/common/scm_rev.h +++ b/src/common/scm_rev.h | |||
| @@ -13,5 +13,6 @@ extern const char g_build_name[]; | |||
| 13 | extern const char g_build_date[]; | 13 | extern const char g_build_date[]; |
| 14 | extern const char g_build_fullname[]; | 14 | extern const char g_build_fullname[]; |
| 15 | extern const char g_build_version[]; | 15 | extern const char g_build_version[]; |
| 16 | extern const char g_shader_cache_version[]; | ||
| 16 | 17 | ||
| 17 | } // namespace Common | 18 | } // namespace Common |