<div dir="ltr"><div>From a3dd554074f7f02d6589b4661ec0c403aa4cf0c5 Mon Sep 17 00:00:00 2001<br>From: Janani TE <<a href="mailto:janani.te@multicorewareinc.com">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">x265.def.in</a>"<br>                "${PROJECT_BINARY_DIR}/x265.def")<br> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in">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">x265.com</a><br>+ #<br>+ # Authors: Janani T.E <<a href="mailto:janani.te@multicorewareinc.com">janani.te@multicorewareinc.com</a>>, Srikanth Kurapati <<a href="mailto:srikanthkurapati@multicorewareinc.com">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" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Thanks and Regards,<div>Janani.</div></div></div></div>