Skip to content

Commit

Permalink
[External] Add a patching mechanism to external libraries
Browse files Browse the repository at this point in the history
Also using this to fix the DXC with VS2019.2

Related work item: Github #49
  • Loading branch information
Minmin Gong committed Sep 5, 2019
1 parent 7f76560 commit c9db185
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CI/AzurePipelines/ContinuousBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ steps:
- bash: eval '$(installCommand)'
displayName: 'Install'

- script: |
git config --global user.email "[email protected]"
git config --global user.name "Dummy Name"
displayName: 'Config git'

- task: PythonScript@0
displayName: 'Build'
inputs:
Expand Down
12 changes: 12 additions & 0 deletions External/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,23 @@ function(UpdateExternalLib name url rev)
endif()
endfunction()

function(ApplyPatch name patch)
set(external_folder "${SC_ROOT_DIR}/External")
set(external_lib_folder "${external_folder}/${name}")

execute_process(COMMAND "${git_executable}" "apply" "--check" "--ignore-space-change" "${patch}" WORKING_DIRECTORY ${external_lib_folder} RESULT_VARIABLE checkout_err)
if(NOT checkout_err)
message(STATUS "Applying ${patch}...")
execute_process(COMMAND "${git_executable}" "am" "--ignore-space-change" "${patch}" WORKING_DIRECTORY ${external_lib_folder})
endif()
endfunction()

UpdateExternalLib("cxxopts" "https://github.com/jarro2783/cxxopts.git" ${cxxopts_REV})
UpdateExternalLib("googletest" "https://github.com/google/googletest.git" ${googletest_REV})
UpdateExternalLib("SPIRV-Headers" "https://github.com/KhronosGroup/SPIRV-Headers.git" ${SPIRV_Headers_REV})
UpdateExternalLib("SPIRV-Tools" "https://github.com/KhronosGroup/SPIRV-Tools.git" ${SPIRV_Tools_REV})
UpdateExternalLib("DirectXShaderCompiler" "https://github.com/Microsoft/DirectXShaderCompiler.git" ${DirectXShaderCompiler_REV})
ApplyPatch("DirectXShaderCompiler" "${CMAKE_CURRENT_SOURCE_DIR}/Patches/DirectXShaderCompiler/0001-Fix-the-compiling-problem-on-VS2019.2.patch")
UpdateExternalLib("SPIRV-Cross" "https://github.com/KhronosGroup/SPIRV-Cross.git" ${SPIRV_Cross_REV})

set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 895b1301afea91017500a82dd9d709d9941d1abc Mon Sep 17 00:00:00 2001
From: Minmin Gong <[email protected]>
Date: Wed, 28 Aug 2019 22:52:12 -0700
Subject: [PATCH] Fix the compiling problem on VS2019.2

---
utils/TableGen/AsmWriterEmitter.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp
index 8163f681..4372420d 100644
--- a/utils/TableGen/AsmWriterEmitter.cpp
+++ b/utils/TableGen/AsmWriterEmitter.cpp
@@ -763,7 +763,7 @@ static unsigned CountNumOperands(StringRef AsmString, unsigned Variant) {
namespace {
struct AliasPriorityComparator {
typedef std::pair<CodeGenInstAlias *, int> ValueType;
- bool operator()(const ValueType &LHS, const ValueType &RHS) {
+ bool operator()(const ValueType &LHS, const ValueType &RHS) const {
if (LHS.second == RHS.second) {
// We don't actually care about the order, but for consistency it
// shouldn't depend on pointer comparisons.
--
2.17.1.windows.2

0 comments on commit c9db185

Please sign in to comment.