[x265] [PATCH 1 of 1] SVTHEVC: Update Findsvthevc.cmake with static lib and 1.4.0 support

Christopher Degawa ccom at randomderp.com
Tue Aug 20 06:52:24 CEST 2019


# HG changeset patch
# User Christopher Degawa <ccom at randomderp.com>
# Date 1566188835 0
#      Mon Aug 19 04:27:15 2019 +0000
# Node ID 2d344d93096a75c03798bb278b1f53b8a68547aa
# Parent  de920e0a31831f52599f3937c3ee6945e88ed851
SVTHEVC: Update Findsvthevc.cmake with static lib and 1.4.0 support

Added static lib suffixes, removed hardcoding of version to 1.3.0, and
added some default PATHS for the find library and include path for the headers
to remove reliance on the enviroment variables being set, although it still does accept them

diff -r de920e0a3183 -r 2d344d93096a source/cmake/Findsvthevc.cmake
--- a/source/cmake/Findsvthevc.cmake	Tue Jul 23 17:03:51 2019 +0530
+++ b/source/cmake/Findsvthevc.cmake	Mon Aug 19 04:27:15 2019 +0000
@@ -9,52 +9,56 @@
 
 include(FindPackageHandleStandardArgs)
 
-if(UNIX)
-SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so")
-else()
-SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
-endif()
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib;.so;.a;.dll;.lib")
 
 set(SVT_VERSION_MAJOR_REQUIRED 1)
 set(SVT_VERSION_MINOR_REQUIRED 3)
 set(SVT_VERSION_PATCHLEVEL_REQUIRED 0)
+set(SVT_VERSION_REQUIRED "${SVT_VERSION_MAJOR_REQUIRED}.${SVT_VERSION_MINOR_REQUIRED}.${SVT_VERSION_PATCHLEVEL_REQUIRED}")
 
 find_path(SVT_HEVC_INCLUDE_DIR
     NAMES EbApi.h EbErrorCodes.h EbTime.h
-    HINTS $ENV{SVT_HEVC_INCLUDE_DIR}
-    PATHS ENV
+    PATHS /usr/local/include /usr/include $ENV{SystemDrive}/svt-encoders/include
+    HINTS ENV SVT_HEVC_INCLUDE_DIR
+    PATH_SUFFIXES svt-hevc
     DOC "SVT-HEVC include directory")
 
 if(SVT_HEVC_INCLUDE_DIR)
-file(READ "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" version)
+    if(EXISTS "${SVT_HEVC_INCLUDE_DIR}/EbApiVersion.h")
+        set(VERSION_FILE "${SVT_HEVC_INCLUDE_DIR}/EbApiVersion.h")
+    elseif(EXISTS "${SVT_HEVC_INCLUDE_DIR}/EbApi.h")
+        set(VERSION_FILE "${SVT_HEVC_INCLUDE_DIR}/EbApi.h")
+    endif()
 
-string(REGEX MATCH "SVT_VERSION_MAJOR       ([0-9]*)" _ ${version})
-set(SVT_VERSION_MAJOR ${CMAKE_MATCH_1})
-
-string(REGEX MATCH "SVT_VERSION_MINOR       ([0-9]*)" _ ${version})
-set(SVT_VERSION_MINOR ${CMAKE_MATCH_1})
+    file(STRINGS "${VERSION_FILE}" SVT_VERSION_MAJOR
+        REGEX "SVT_VERSION_MAJOR.*\([0-9]\)")
+    string(REGEX MATCH "\([0-9]\)" SVT_VERSION_MAJOR "${SVT_VERSION_MAJOR}")
 
-string(REGEX MATCH "SVT_VERSION_PATCHLEVEL  ([0-9]*)" _ ${version})
-set(SVT_VERSION_PATCHLEVEL ${CMAKE_MATCH_1})
+    file(STRINGS "${VERSION_FILE}" SVT_VERSION_MINOR
+        REGEX "SVT_VERSION_MINOR.*\([0-9]\)")
+    string(REGEX MATCH "\([0-9]\)" SVT_VERSION_MINOR "${SVT_VERSION_MINOR}")
+
+    file(STRINGS "${VERSION_FILE}" SVT_VERSION_PATCHLEVEL
+        REGEX "SVT_VERSION_PATCHLEVEL.*\([0-9]\)")
+    string(REGEX MATCH "\([0-9]\)" SVT_VERSION_PATCHLEVEL "${SVT_VERSION_PATCHLEVEL}")
 
-if(NOT ${SVT_VERSION_MAJOR} EQUAL "1" OR NOT ${SVT_VERSION_MINOR} EQUAL "3" OR NOT ${SVT_VERSION_PATCHLEVEL} EQUAL "0")
-    message (SEND_ERROR "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL} which doesn't match the required version: ${SVT_VERSION_MAJOR_REQUIRED}.${SVT_VERSION_MINOR_REQUIRED}.${SVT_VERSION_PATCHLEVEL_REQUIRED}; Aborting configure  ")
-else()
-    message(STATUS "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL}")
-endif()
+    set(SVT_VERSION "${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL}")
 
+    if(${SVT_VERSION} VERSION_LESS ${SVT_VERSION_REQUIRED})
+        message (SEND_ERROR "-- Found SVT-HEVC Lib Version: ${SVT_VERSION} which doesn't match the required version: ${SVT_VERSION_REQUIRED}; Aborting configure  ")
+    else()
+        message(STATUS "-- Found SVT-HEVC Lib Version: ${SVT_VERSION}")
+    endif()
 endif()
 
 find_library(SVT_HEVC_LIBRARY
-if(UNIX)
     NAMES SvtHevcEnc
-else()
-    NAMES SvtHevcEnc
-endif()
-    HINTS $ENV{SVT_HEVC_LIBRARY_DIR}
-    PATHS ENV
+    PATHS /usr/local/lib /usr/lib /usr/lib64 $ENV{SystemDrive}/svt-encoders/lib $ENV{SystemDrive}/svt-encoders/bin
+    HINTS ENV SVT_HEVC_LIBRARY_DIR
     DOC "SVT-HEVC library")
 
 
 mark_as_advanced(SVT_HEVC_LIBRARY SVT_HEVC_INCLUDE_DIR SVT_HEVC_LIBRARY_DIR)
-find_package_handle_standard_args(SVTHEVC REQUIRED_VARS SVT_HEVC_LIBRARY SVT_HEVC_INCLUDE_DIR)
+find_package_handle_standard_args(SVTHEVC
+    REQUIRED_VARS SVT_HEVC_LIBRARY SVT_HEVC_INCLUDE_DIR
+    VERSION_VAR ${SVT_VERSION})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.patch
Type: text/x-patch
Size: 4387 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20190820/32ede501/attachment.bin>


More information about the x265-devel mailing list