<div dir="ltr">Pushed to the Release_3.4 branch</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 24, 2021 at 10:14 AM Janani T E <<a href="mailto:janani.te@multicorewareinc.com">janani.te@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks for the review Aruna. Please find the new patch attached.<div><br></div><div>From 2a9f30c0df659e5dd4ecd9619ba7cdd85da1221d Mon Sep 17 00:00:00 2001<br>From: Janani TE <<a href="mailto:janani.te@multicorewareinc.com" target="_blank">janani.te@multicorewareinc.com</a>><br>Date: Tue, 24 Aug 2021 10:10:08 +0530<br>Subject: [PATCH] Update x265Version.txt for Release_3.4<br><br>---<br> source/CMakeLists.txt      |   4 +-<br> source/cmake/Version.cmake | 179 +++++++++++++++++++++++++++++++++++++++++++++<br> source/cmake/version.cmake |  97 ------------------------<br> x265Version.txt            |   4 +<br> 4 files changed, 185 insertions(+), 99 deletions(-)<br> create mode 100644 source/cmake/Version.cmake<br> delete mode 100644 source/cmake/version.cmake<br> create mode 100644 x265Version.txt<br><br>diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt<br>index 1d1a613..f4a9cb7 100644<br>--- a/source/CMakeLists.txt<br>+++ b/source/CMakeLists.txt<br>@@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CPU" OFF)<br> option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)<br> mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)<br> # X265_BUILD must be incremented each time the public API is changed<br>-set(X265_BUILD 192)<br>+set(X265_BUILD 201)<br> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in" target="_blank">x265.def.in</a>"<br>                "${PROJECT_BINARY_DIR}/x265.def")<br> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in" target="_blank">x265_config.h.in</a>"<br>@@ -485,7 +485,7 @@ if(POWER)<br>     endif()<br> endif()<br> <br>-include(version) # determine X265_VERSION and X265_LATEST_TAG<br>+include(Version) # determine X265_VERSION and X265_LATEST_TAG<br> include_directories(. common encoder "${PROJECT_BINARY_DIR}")<br> <br> option(ENABLE_PPA "Enable PPA profiling instrumentation" OFF)<br>diff --git a/source/cmake/Version.cmake b/source/cmake/Version.cmake<br>new file mode 100644<br>index 0000000..3bbf42f<br>--- /dev/null<br>+++ b/source/cmake/Version.cmake<br>@@ -0,0 +1,179 @@<br>+ #################################################################################################################<br>+ #<br>+ #    Copyright (C) 2013-2020 MulticoreWare, Inc<br>+ #<br>+ # This program is free software; you can redistribute it and/or modify<br>+ # it under the terms of the GNU General Public License as published by<br>+ # the Free Software Foundation; either version 2 of the License, or<br>+ # (at your option) any later version.<br>+ #<br>+ # This program is distributed in the hope that it will be useful,<br>+ # but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>+ # GNU General Public License for more details.<br>+ #<br>+ # You should have received a copy of the GNU General Public License<br>+ # along with this program; if not, write to the Free Software<br>+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.<br>+ #<br>+ # This program is also available under a commercial proprietary license.<br>+ # For more information, contact us at license @ <a href="http://x265.com" target="_blank">x265.com</a><br>+ #<br>+ # Authors: Janani T.E <<a href="mailto:janani.te@multicorewareinc.com" target="_blank">janani.te@multicorewareinc.com</a>>, Srikanth Kurapati <<a href="mailto:srikanthkurapati@multicorewareinc.com" target="_blank">srikanthkurapati@multicorewareinc.com</a>><br>+ #<br>+ #################################################################################################################<br>+ # PURPOSE: Identity version control software version display, also read version files to present x265 version.<br>+ #################################################################################################################<br>+ #Default Settings, for user to be vigilant about x265 version being reported during product build.<br>+set(X265_VERSION "unknown")<br>+set(X265_LATEST_TAG "0.0")<br>+set(X265_TAG_DISTANCE "0")<br>+<br>+#Find version control software to be used for live and extracted repositories from compressed tarballs<br>+if(CMAKE_VERSION VERSION_LESS "2.8.10")<br>+    find_program(HG_EXECUTABLE hg)<br>+    if(EXISTS "${HG_EXECUTABLE}.bat")<br>+        set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")<br>+    endif()<br>+    message(STATUS "hg found at ${HG_EXECUTABLE}")<br>+else()<br>+    find_package(Hg QUIET)<br>+endif()<br>+if(HG_EXECUTABLE)<br>+    #Set Version Control binary for source code kind<br>+    if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt)<br>+        set(HG_ARCHETYPE "1")<br>+    elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg)<br>+        set(HG_ARCHETYPE "0")<br>+    endif()<br>+endif(HG_EXECUTABLE)<br>+find_package(Git QUIET) #No restrictions on Git versions used, any versions from 1.8.x to 2.2.x or later should do.<br>+if(GIT_FOUND)<br>+    find_program(GIT_EXECUTABLE git)<br>+    message(STATUS "GIT_EXECUTABLE ${GIT_EXECUTABLE}")<br>+    if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git)<br>+        set(GIT_ARCHETYPE "0")<br>+    elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../x265Version.txt)<br>+        set(GIT_ARCHETYPE "1")<br>+    endif()<br>+endif(GIT_FOUND)<br>+if(HG_ARCHETYPE)<br>+    #Read the lines of the archive summary file to extract the version<br>+    message(STATUS "SOURCE CODE IS FROM x265 HG ARCHIVED ZIP OR TAR BALL")<br>+    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt archive)<br>+    STRING(REGEX REPLACE "\n" ";" archive "${archive}")<br>+    foreach(f ${archive})<br>+        string(FIND "${f}" ": " pos)<br>+        string(SUBSTRING "${f}" 0 ${pos} key)<br>+        string(SUBSTRING "${f}" ${pos} -1 value)<br>+        string(SUBSTRING "${value}" 2 -1 value)<br>+        set(hg_${key} ${value})<br>+    endforeach()<br>+    if(DEFINED hg_tag)<br>+        set(X265_LATEST_TAG ${hg_tag})<br>+    elseif(DEFINED hg_node)<br>+        set(X265_LATEST_TAG ${hg_latesttag})<br>+        set(X265_TAG_DISTANCE ${hg_latesttagdistance})<br>+        string(SUBSTRING "${hg_node}" 0 12 X265_REVISION_ID)<br>+    endif()<br>+    message(STATUS "HG ARCHIVAL INFORMATION PROCESSED")<br>+elseif(NOT DEFINED GIT_ARCHETYPE)<br>+# means that's its neither hg archive nor git clone/archive hence it has to be hg live repo as these are only four cases that need to processed in mutual exclusion.<br>+    execute_process(COMMAND<br>+        ${HG_EXECUTABLE} log -r. --template "{latesttag}"<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_LATEST_TAG<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    execute_process(COMMAND<br>+        ${HG_EXECUTABLE} log -r. --template "{latesttagdistance}"<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_TAG_DISTANCE<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    execute_process(<br>+        COMMAND<br>+        ${HG_EXECUTABLE} log -r. --template "{node}"<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_REVISION_ID<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    string(SUBSTRING "${X265_REVISION_ID}" 0 12 X265_REVISION_ID)<br>+    if(X265_LATEST_TAG MATCHES "^r")<br>+        string(SUBSTRING ${X265_LATEST_TAG} 1 -1 X265_LATEST_TAG)<br>+    endif()<br>+    message(STATUS "HG LIVE REPO STATUS CHECK DONE")<br>+elseif(GIT_ARCHETYPE)<br>+    message(STATUS "SOURCE CODE IS FROM x265 GIT ARCHIVED ZIP OR TAR BALL")<br>+    #Read the lines of the archive summary file to extract the version<br>+    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../x265Version.txt filebuf)<br>+    STRING(REGEX REPLACE "\n" ";" filebuf "${filebuf}")<br>+    foreach(line ${filebuf})<br>+        string(FIND "${line}" ": " pos)<br>+        string(SUBSTRING "${line}" 0 ${pos} key)<br>+        string(SUBSTRING "${line}" ${pos} -1 value)<br>+        string(SUBSTRING "${value}" 2 -1 value)<br>+        set(git_${key} ${value})<br>+    endforeach()<br>+    if(DEFINED git_releasetag)<br>+        set(X265_LATEST_TAG ${git_releasetag})<br>+        if(DEFINED git_releasetagdistance)<br>+            set(X265_TAG_DISTANCE ${git_releasetagdistance})<br>+            if(X265_TAG_DISTANCE STRGREATER "0" OR X265_TAG_DISTANCE STREQUAL "0")<br>+                #for x265 the repository changeset has to be a tag id or commit id after the tag<br>+                #hence mandating it's presence in version file always for valid tag distances.<br>+                if(DEFINED git_repositorychangeset)<br>+                    string(SUBSTRING "${git_repositorychangeset}" 0 9 X265_REVISION_ID)<br>+                else()<br>+                    message(WARNING "X265 LATEST COMMIT TIP INFORMATION NOT AVAILABLE")<br>+                endif()<br>+            else()<br>+                message(WARNING "X265 TAG DISTANCE INVALID")<br>+            endif()<br>+        else()<br>+            message(WARNING "COMMIT INFORMATION AFTER LATEST REVISION UNAVAILABLE")<br>+        endif()<br>+    else()<br>+        message(WARNING "X265 RELEASE VERSION LABEL MISSING: ${X265_LATEST_TAG}")<br>+    endif()<br>+    message(STATUS "GIT ARCHIVAL INFORMATION PROCESSED")<br>+else()<br>+    execute_process(<br>+        COMMAND<br>+        ${GIT_EXECUTABLE} describe --abbrev=0 --tags<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_LATEST_TAG<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    execute_process(<br>+        COMMAND<br>+        ${GIT_EXECUTABLE} rev-list ${X265_LATEST_TAG}.. --count --first-parent<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_TAG_DISTANCE<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    execute_process(<br>+        COMMAND<br>+        ${GIT_EXECUTABLE} log --pretty=format:%h -n 1<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_REVISION_ID<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    message(STATUS "GIT LIVE REPO VERSION RETRIEVED")<br>+endif()<br>+<br>+# formatting based on distance from tag<br>+if(X265_TAG_DISTANCE STREQUAL "0")<br>+    set(X265_VERSION "${X265_LATEST_TAG}")<br>+elseif(X265_TAG_DISTANCE STRGREATER "0")<br>+    set(X265_VERSION "${X265_LATEST_TAG}+${X265_TAG_DISTANCE}-${X265_REVISION_ID}")<br>+endif()<br>+<br>+#will always be printed in its entirety based on version file configuration to avail revision monitoring by repo owners<br>+message(STATUS "X265 RELEASE VERSION ${X265_VERSION}")<br>diff --git a/source/cmake/version.cmake b/source/cmake/version.cmake<br>deleted file mode 100644<br>index 3530224..0000000<br>--- a/source/cmake/version.cmake<br>+++ /dev/null<br>@@ -1,97 +0,0 @@<br>-if(CMAKE_VERSION VERSION_LESS "2.8.10")<br>-    find_program(HG_EXECUTABLE hg)<br>-else()<br>-    find_package(Hg QUIET)<br>-endif()<br>-find_package(Git QUIET) # present in 2.8.8<br>-<br>-# defaults, in case everything below fails<br>-set(X265_VERSION "unknown")<br>-set(X265_LATEST_TAG "0.0")<br>-set(X265_TAG_DISTANCE "0")<br>-<br>-if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt)<br>-    # read the lines of the archive summary file to extract the version<br>-    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt archive)<br>-    STRING(REGEX REPLACE "\n" ";" archive "${archive}")<br>-    foreach(f ${archive})<br>-        string(FIND "${f}" ": " pos)<br>-        string(SUBSTRING "${f}" 0 ${pos} key)<br>-        string(SUBSTRING "${f}" ${pos} -1 value)<br>-        string(SUBSTRING "${value}" 2 -1 value)<br>-        set(hg_${key} ${value})<br>-    endforeach()<br>-    if(DEFINED hg_tag)<br>-        set(X265_LATEST_TAG ${hg_tag})<br>-    elseif(DEFINED hg_node)<br>-        set(X265_LATEST_TAG ${hg_latesttag})<br>-        set(X265_TAG_DISTANCE ${hg_latesttagdistance})<br>-        string(SUBSTRING "${hg_node}" 0 12 X265_REVISION_ID)<br>-    endif()<br>-elseif(HG_EXECUTABLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg)<br>-    if(EXISTS "${HG_EXECUTABLE}.bat")<br>-        # mercurial source installs on Windows require .bat extension<br>-        set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")<br>-    endif()<br>-    message(STATUS "hg found at ${HG_EXECUTABLE}")<br>-<br>-    execute_process(COMMAND<br>-        ${HG_EXECUTABLE} log -r. --template "{latesttag}"<br>-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>-        OUTPUT_VARIABLE X265_LATEST_TAG<br>-        ERROR_QUIET<br>-        OUTPUT_STRIP_TRAILING_WHITESPACE<br>-        )<br>-    execute_process(COMMAND<br>-        ${HG_EXECUTABLE} log -r. --template "{latesttagdistance}"<br>-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>-        OUTPUT_VARIABLE X265_TAG_DISTANCE<br>-        ERROR_QUIET<br>-        OUTPUT_STRIP_TRAILING_WHITESPACE<br>-        )<br>-    execute_process(<br>-        COMMAND<br>-        ${HG_EXECUTABLE} log -r. --template "{node}"<br>-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>-        OUTPUT_VARIABLE X265_REVISION_ID<br>-        ERROR_QUIET<br>-        OUTPUT_STRIP_TRAILING_WHITESPACE<br>-        )<br>-    string(SUBSTRING "${X265_REVISION_ID}" 0 12 X265_REVISION_ID)<br>-<br>-    if(X265_LATEST_TAG MATCHES "^r")<br>-        string(SUBSTRING ${X265_LATEST_TAG} 1 -1 X265_LATEST_TAG)<br>-    endif()<br>-elseif(GIT_EXECUTABLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git)<br>-    execute_process(<br>-        COMMAND<br>-        ${GIT_EXECUTABLE} describe --abbrev=0 --tags<br>-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>-        OUTPUT_VARIABLE X265_LATEST_TAG<br>-        ERROR_QUIET<br>-        OUTPUT_STRIP_TRAILING_WHITESPACE<br>-        )<br>-    execute_process(<br>-        COMMAND<br>-        ${GIT_EXECUTABLE} rev-list ${X265_LATEST_TAG}.. --count --first-parent<br>-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>-        OUTPUT_VARIABLE X265_TAG_DISTANCE<br>-        ERROR_QUIET<br>-        OUTPUT_STRIP_TRAILING_WHITESPACE<br>-        )<br>-    execute_process(<br>-        COMMAND<br>-        ${GIT_EXECUTABLE} log -1 --format=g%h<br>-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>-        OUTPUT_VARIABLE X265_REVISION_ID<br>-        ERROR_QUIET<br>-        OUTPUT_STRIP_TRAILING_WHITESPACE<br>-        )<br>-endif()<br>-if(X265_TAG_DISTANCE STREQUAL "0")<br>-    set(X265_VERSION "${X265_LATEST_TAG}")<br>-else()<br>-    set(X265_VERSION "${X265_LATEST_TAG}+${X265_TAG_DISTANCE}-${X265_REVISION_ID}")<br>-endif()<br>-<br>-message(STATUS "x265 version ${X265_VERSION}")<br>diff --git a/x265Version.txt b/x265Version.txt<br>new file mode 100644<br>index 0000000..9f01be5<br>--- /dev/null<br>+++ b/x265Version.txt<br>@@ -0,0 +1,4 @@<br>+#Attribute:       Values<br>+repositorychangeset: 57022ba54<br>+releasetagdistance: 1<br>+releasetag: 3.4.1<br>-- <br>1.8.3.1<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 3, 2021 at 6:57 PM Janani T E <<a href="mailto:janani.te@multicorewareinc.com" target="_blank">janani.te@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>From a3dd554074f7f02d6589b4661ec0c403aa4cf0c5 Mon Sep 17 00:00:00 2001<br>From: Janani TE <<a href="mailto:janani.te@multicorewareinc.com" target="_blank">janani.te@multicorewareinc.com</a>><br>Date: Tue, 3 Aug 2021 18:46:47 +0530<br>Subject: [PATCH] Update x265Version.txt for Release_3.4<br><br>---<br> source/CMakeLists.txt      |   4 +-<br> source/cmake/Version.cmake | 179 +++++++++++++++++++++++++++++++++++++++++++++<br> x265Version.txt            |   4 +<br> 3 files changed, 185 insertions(+), 2 deletions(-)<br> create mode 100644 source/cmake/Version.cmake<br> create mode 100644 x265Version.txt<br><br>diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt<br>index 1d1a613..f4a9cb7 100644<br>--- a/source/CMakeLists.txt<br>+++ b/source/CMakeLists.txt<br>@@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CPU" OFF)<br> option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)<br> mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)<br> # X265_BUILD must be incremented each time the public API is changed<br>-set(X265_BUILD 192)<br>+set(X265_BUILD 201)<br> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in" target="_blank">x265.def.in</a>"<br>                "${PROJECT_BINARY_DIR}/x265.def")<br> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in" target="_blank">x265_config.h.in</a>"<br>@@ -485,7 +485,7 @@ if(POWER)<br>     endif()<br> endif()<br> <br>-include(version) # determine X265_VERSION and X265_LATEST_TAG<br>+include(Version) # determine X265_VERSION and X265_LATEST_TAG<br> include_directories(. common encoder "${PROJECT_BINARY_DIR}")<br> <br> option(ENABLE_PPA "Enable PPA profiling instrumentation" OFF)<br>diff --git a/source/cmake/Version.cmake b/source/cmake/Version.cmake<br>new file mode 100644<br>index 0000000..3bbf42f<br>--- /dev/null<br>+++ b/source/cmake/Version.cmake<br>@@ -0,0 +1,179 @@<br>+ #################################################################################################################<br>+ #<br>+ #    Copyright (C) 2013-2020 MulticoreWare, Inc<br>+ #<br>+ # This program is free software; you can redistribute it and/or modify<br>+ # it under the terms of the GNU General Public License as published by<br>+ # the Free Software Foundation; either version 2 of the License, or<br>+ # (at your option) any later version.<br>+ #<br>+ # This program is distributed in the hope that it will be useful,<br>+ # but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>+ # GNU General Public License for more details.<br>+ #<br>+ # You should have received a copy of the GNU General Public License<br>+ # along with this program; if not, write to the Free Software<br>+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.<br>+ #<br>+ # This program is also available under a commercial proprietary license.<br>+ # For more information, contact us at license @ <a href="http://x265.com" target="_blank">x265.com</a><br>+ #<br>+ # Authors: Janani T.E <<a href="mailto:janani.te@multicorewareinc.com" target="_blank">janani.te@multicorewareinc.com</a>>, Srikanth Kurapati <<a href="mailto:srikanthkurapati@multicorewareinc.com" target="_blank">srikanthkurapati@multicorewareinc.com</a>><br>+ #<br>+ #################################################################################################################<br>+ # PURPOSE: Identity version control software version display, also read version files to present x265 version.<br>+ #################################################################################################################<br>+ #Default Settings, for user to be vigilant about x265 version being reported during product build.<br>+set(X265_VERSION "unknown")<br>+set(X265_LATEST_TAG "0.0")<br>+set(X265_TAG_DISTANCE "0")<br>+<br>+#Find version control software to be used for live and extracted repositories from compressed tarballs<br>+if(CMAKE_VERSION VERSION_LESS "2.8.10")<br>+    find_program(HG_EXECUTABLE hg)<br>+    if(EXISTS "${HG_EXECUTABLE}.bat")<br>+        set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")<br>+    endif()<br>+    message(STATUS "hg found at ${HG_EXECUTABLE}")<br>+else()<br>+    find_package(Hg QUIET)<br>+endif()<br>+if(HG_EXECUTABLE)<br>+    #Set Version Control binary for source code kind<br>+    if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt)<br>+        set(HG_ARCHETYPE "1")<br>+    elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg)<br>+        set(HG_ARCHETYPE "0")<br>+    endif()<br>+endif(HG_EXECUTABLE)<br>+find_package(Git QUIET) #No restrictions on Git versions used, any versions from 1.8.x to 2.2.x or later should do.<br>+if(GIT_FOUND)<br>+    find_program(GIT_EXECUTABLE git)<br>+    message(STATUS "GIT_EXECUTABLE ${GIT_EXECUTABLE}")<br>+    if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git)<br>+        set(GIT_ARCHETYPE "0")<br>+    elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../x265Version.txt)<br>+        set(GIT_ARCHETYPE "1")<br>+    endif()<br>+endif(GIT_FOUND)<br>+if(HG_ARCHETYPE)<br>+    #Read the lines of the archive summary file to extract the version<br>+    message(STATUS "SOURCE CODE IS FROM x265 HG ARCHIVED ZIP OR TAR BALL")<br>+    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt archive)<br>+    STRING(REGEX REPLACE "\n" ";" archive "${archive}")<br>+    foreach(f ${archive})<br>+        string(FIND "${f}" ": " pos)<br>+        string(SUBSTRING "${f}" 0 ${pos} key)<br>+        string(SUBSTRING "${f}" ${pos} -1 value)<br>+        string(SUBSTRING "${value}" 2 -1 value)<br>+        set(hg_${key} ${value})<br>+    endforeach()<br>+    if(DEFINED hg_tag)<br>+        set(X265_LATEST_TAG ${hg_tag})<br>+    elseif(DEFINED hg_node)<br>+        set(X265_LATEST_TAG ${hg_latesttag})<br>+        set(X265_TAG_DISTANCE ${hg_latesttagdistance})<br>+        string(SUBSTRING "${hg_node}" 0 12 X265_REVISION_ID)<br>+    endif()<br>+    message(STATUS "HG ARCHIVAL INFORMATION PROCESSED")<br>+elseif(NOT DEFINED GIT_ARCHETYPE)<br>+# means that's its neither hg archive nor git clone/archive hence it has to be hg live repo as these are only four cases that need to processed in mutual exclusion.<br>+    execute_process(COMMAND<br>+        ${HG_EXECUTABLE} log -r. --template "{latesttag}"<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_LATEST_TAG<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    execute_process(COMMAND<br>+        ${HG_EXECUTABLE} log -r. --template "{latesttagdistance}"<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_TAG_DISTANCE<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    execute_process(<br>+        COMMAND<br>+        ${HG_EXECUTABLE} log -r. --template "{node}"<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_REVISION_ID<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    string(SUBSTRING "${X265_REVISION_ID}" 0 12 X265_REVISION_ID)<br>+    if(X265_LATEST_TAG MATCHES "^r")<br>+        string(SUBSTRING ${X265_LATEST_TAG} 1 -1 X265_LATEST_TAG)<br>+    endif()<br>+    message(STATUS "HG LIVE REPO STATUS CHECK DONE")<br>+elseif(GIT_ARCHETYPE)<br>+    message(STATUS "SOURCE CODE IS FROM x265 GIT ARCHIVED ZIP OR TAR BALL")<br>+    #Read the lines of the archive summary file to extract the version<br>+    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../x265Version.txt filebuf)<br>+    STRING(REGEX REPLACE "\n" ";" filebuf "${filebuf}")<br>+    foreach(line ${filebuf})<br>+        string(FIND "${line}" ": " pos)<br>+        string(SUBSTRING "${line}" 0 ${pos} key)<br>+        string(SUBSTRING "${line}" ${pos} -1 value)<br>+        string(SUBSTRING "${value}" 2 -1 value)<br>+        set(git_${key} ${value})<br>+    endforeach()<br>+    if(DEFINED git_releasetag)<br>+        set(X265_LATEST_TAG ${git_releasetag})<br>+        if(DEFINED git_releasetagdistance)<br>+            set(X265_TAG_DISTANCE ${git_releasetagdistance})<br>+            if(X265_TAG_DISTANCE STRGREATER "0" OR X265_TAG_DISTANCE STREQUAL "0")<br>+                #for x265 the repository changeset has to be a tag id or commit id after the tag<br>+                #hence mandating it's presence in version file always for valid tag distances.<br>+                if(DEFINED git_repositorychangeset)<br>+                    string(SUBSTRING "${git_repositorychangeset}" 0 9 X265_REVISION_ID)<br>+                else()<br>+                    message(WARNING "X265 LATEST COMMIT TIP INFORMATION NOT AVAILABLE")<br>+                endif()<br>+            else()<br>+                message(WARNING "X265 TAG DISTANCE INVALID")<br>+            endif()<br>+        else()<br>+            message(WARNING "COMMIT INFORMATION AFTER LATEST REVISION UNAVAILABLE")<br>+        endif()<br>+    else()<br>+        message(WARNING "X265 RELEASE VERSION LABEL MISSING: ${X265_LATEST_TAG}")<br>+    endif()<br>+    message(STATUS "GIT ARCHIVAL INFORMATION PROCESSED")<br>+else()<br>+    execute_process(<br>+        COMMAND<br>+        ${GIT_EXECUTABLE} describe --abbrev=0 --tags<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_LATEST_TAG<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    execute_process(<br>+        COMMAND<br>+        ${GIT_EXECUTABLE} rev-list ${X265_LATEST_TAG}.. --count --first-parent<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_TAG_DISTANCE<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    execute_process(<br>+        COMMAND<br>+        ${GIT_EXECUTABLE} log --pretty=format:%h -n 1<br>+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+        OUTPUT_VARIABLE X265_REVISION_ID<br>+        ERROR_QUIET<br>+        OUTPUT_STRIP_TRAILING_WHITESPACE<br>+        )<br>+    message(STATUS "GIT LIVE REPO VERSION RETRIEVED")<br>+endif()<br>+<br>+# formatting based on distance from tag<br>+if(X265_TAG_DISTANCE STREQUAL "0")<br>+    set(X265_VERSION "${X265_LATEST_TAG}")<br>+elseif(X265_TAG_DISTANCE STRGREATER "0")<br>+    set(X265_VERSION "${X265_LATEST_TAG}+${X265_TAG_DISTANCE}-${X265_REVISION_ID}")<br>+endif()<br>+<br>+#will always be printed in its entirety based on version file configuration to avail revision monitoring by repo owners<br>+message(STATUS "X265 RELEASE VERSION ${X265_VERSION}")<br>diff --git a/x265Version.txt b/x265Version.txt<br>new file mode 100644<br>index 0000000..9f01be5<br>--- /dev/null<br>+++ b/x265Version.txt<br>@@ -0,0 +1,4 @@<br>+#Attribute:          Values<br>+repositorychangeset: 57022ba54<br>+releasetagdistance: 1<br>+releasetag: 3.4.1<br>-- <br>1.8.3.1<br><br></div>-- <br><div dir="ltr"><div dir="ltr">Thanks and Regards,<div>Janani.</div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr">Thanks and Regards,<div>Janani.</div></div></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div>