From cd5a640aac99b6f96291b84beb78660987a3da51 Mon Sep 17 00:00:00 2001 From: Cody Northrop Date: Mon, 5 Feb 2018 12:03:10 -0700 Subject: [PATCH] scripts: Update android-generate to support UUID This allows use of the script as is, automatically selecting git_dir vs. rev_file based on detected paths. --- build-android/android-generate.bat | 29 ++++++++++++++++++++++++++++- build-android/android-generate.sh | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/build-android/android-generate.bat b/build-android/android-generate.bat index 128543a..39cf132 100644 --- a/build-android/android-generate.bat +++ b/build-android/android-generate.bat @@ -34,6 +34,33 @@ py -3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_layer_d py -3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_extension_helper.h py -3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml object_tracker.cpp py -3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_typemap_helper.h -py -3 ../../../scripts/external_revision_generator.py --git_dir ../../third_party/shaderc/third_party/spirv-tools -s SPIRV_TOOLS_COMMIT_ID -o spirv_tools_commit_id.h + +set SPIRV_TOOLS_PATH=../../third_party/shaderc/third_party/spirv-tools +set SPIRV_TOOLS_UUID=spirv_tools_uuid.txt + +if exist %SPIRV_TOOLS_PATH% ( + + echo Found spirv-tools, using git_dir for external_revision_generator.py + py -3 ../../../scripts/external_revision_generator.py ^ + --git_dir %SPIRV_TOOLS_PATH% ^ + -s SPIRV_TOOLS_COMMIT_ID ^ + -o spirv_tools_commit_id.h + +) else ( + + echo No spirv-tools git_dir found, generating UUID for external_revision_generator.py + + REM Ensure uuidgen is installed, this should error if not found + uuidgen.exe -v + + uuidgen.exe > %SPIRV_TOOLS_UUID% + type %SPIRV_TOOLS_UUID% + py -3 ../../../scripts/external_revision_generator.py ^ + --rev_file %SPIRV_TOOLS_UUID% ^ + -s SPIRV_TOOLS_COMMIT_ID ^ + -o spirv_tools_commit_id.h + +) + cd ../.. diff --git a/build-android/android-generate.sh b/build-android/android-generate.sh index 6f97a6c..0c0f5e1 100755 --- a/build-android/android-generate.sh +++ b/build-android/android-generate.sh @@ -37,6 +37,39 @@ mkdir -p generated/include generated/common ( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_extension_helper.h ) ( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml object_tracker.cpp ) ( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_typemap_helper.h ) -( cd generated/include; python3 ../../../scripts/external_revision_generator.py --git_dir ../../third_party/shaderc/third_party/spirv-tools -s SPIRV_TOOLS_COMMIT_ID -o spirv_tools_commit_id.h ) + +SPIRV_TOOLS_PATH=../../third_party/shaderc/third_party/spirv-tools +SPIRV_TOOLS_UUID=spirv_tools_uuid.txt + +set -e + +( cd generated/include; + + if [[ -d $SPIRV_TOOLS_PATH ]]; then + + echo Found spirv-tools, using git_dir for external_revision_generator.py + + python3 ../../../scripts/external_revision_generator.py \ + --git_dir $SPIRV_TOOLS_PATH \ + -s SPIRV_TOOLS_COMMIT_ID \ + -o spirv_tools_commit_id.h + + else + + echo No spirv-tools git_dir found, generating UUID for external_revision_generator.py + + # Ensure uuidgen is installed, this should error if not found + uuidgen --v + + uuidgen > $SPIRV_TOOLS_UUID; + cat $SPIRV_TOOLS_UUID; + python3 ../../../scripts/external_revision_generator.py \ + --rev_file $SPIRV_TOOLS_UUID \ + -s SPIRV_TOOLS_COMMIT_ID \ + -o spirv_tools_commit_id.h + + fi +) + exit 0 -- 2.7.4