aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/x265
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/x265')
-rw-r--r--vcpkg/ports/x265/compiler-target.diff14
-rw-r--r--vcpkg/ports/x265/disable-install-pdb.patch13
-rw-r--r--vcpkg/ports/x265/fix-cmake-4.patch39
-rw-r--r--vcpkg/ports/x265/linkage.diff18
-rw-r--r--vcpkg/ports/x265/neon.diff18
-rw-r--r--vcpkg/ports/x265/pkgconfig.diff49
-rw-r--r--vcpkg/ports/x265/portfile.cmake66
-rw-r--r--vcpkg/ports/x265/pthread.diff24
-rw-r--r--vcpkg/ports/x265/vcpkg.json21
-rw-r--r--vcpkg/ports/x265/version.patch16
10 files changed, 278 insertions, 0 deletions
diff --git a/vcpkg/ports/x265/compiler-target.diff b/vcpkg/ports/x265/compiler-target.diff
new file mode 100644
index 0000000..f18699e
--- /dev/null
+++ b/vcpkg/ports/x265/compiler-target.diff
@@ -0,0 +1,14 @@
+diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
+index ab5ddfe..e99c4d8 100755
+--- a/source/CMakeLists.txt
++++ b/source/CMakeLists.txt
+@@ -570,6 +570,9 @@ if((MSVC_IDE OR XCODE OR GCC) AND ENABLE_ASSEMBLY)
+ set(SUFFIX o)
+ endif()
+
++ if(CMAKE_CXX_COMPILER_TARGET)
++ list(PREPEND ARM_ARGS "--target=${CMAKE_CXX_COMPILER_TARGET}")
++ endif()
+ if(ARM OR CROSS_COMPILE_ARM)
+ # compile ARM arch asm files here
+ enable_language(ASM)
diff --git a/vcpkg/ports/x265/disable-install-pdb.patch b/vcpkg/ports/x265/disable-install-pdb.patch
new file mode 100644
index 0000000..b7eec63
--- /dev/null
+++ b/vcpkg/ports/x265/disable-install-pdb.patch
@@ -0,0 +1,13 @@
+diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
+index 6183a6d..eaa5c6f 100644
+--- a/source/CMakeLists.txt
++++ b/source/CMakeLists.txt
+@@ -842,7 +842,7 @@ if(SVTHEVC_FOUND)
+ endif()
+
+ install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
+-if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED))
++if(0)
+ if(MSVC_IDE)
+ if(ENABLE_CLI)
+ install(FILES "${PROJECT_BINARY_DIR}/Debug/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug)
diff --git a/vcpkg/ports/x265/fix-cmake-4.patch b/vcpkg/ports/x265/fix-cmake-4.patch
new file mode 100644
index 0000000..8874265
--- /dev/null
+++ b/vcpkg/ports/x265/fix-cmake-4.patch
@@ -0,0 +1,39 @@
+diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
+index 8a9ec44542..54f000c6d4 100644
+--- a/source/CMakeLists.txt
++++ b/source/CMakeLists.txt
+@@ -1,4 +1,5 @@
+ # vim: syntax=cmake
++cmake_minimum_required (VERSION 3.10)
+ if(NOT CMAKE_BUILD_TYPE)
+ # default to Release build for GCC builds
+ set(CMAKE_BUILD_TYPE Release CACHE STRING
+@@ -6,18 +7,9 @@ if(NOT CMAKE_BUILD_TYPE)
+ FORCE)
+ endif()
+ message(STATUS "cmake version ${CMAKE_VERSION}")
+-if(POLICY CMP0025)
+- cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang
+-endif()
+-if(POLICY CMP0042)
+- cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH
+-endif()
+-if(POLICY CMP0054)
+- cmake_policy(SET CMP0054 OLD) # Only interpret if() arguments as variables or keywords when unquoted
+-endif()
+
+ project (x265)
+-cmake_minimum_required (VERSION 2.8.8) # OBJECT libraries require 2.8.8
++
+ include(CheckIncludeFiles)
+ include(CheckFunctionExists)
+ include(CheckSymbolExists)
+@@ -171,7 +163,7 @@ if(APPLE)
+ add_definitions(-DMACOS=1)
+ endif()
+
+-if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
++if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
+ set(CLANG 1)
+ endif()
+ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
diff --git a/vcpkg/ports/x265/linkage.diff b/vcpkg/ports/x265/linkage.diff
new file mode 100644
index 0000000..af5e1f3
--- /dev/null
+++ b/vcpkg/ports/x265/linkage.diff
@@ -0,0 +1,18 @@
+diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
+index d6f0e3e..11512ff 100755
+--- a/source/CMakeLists.txt
++++ b/source/CMakeLists.txt
+@@ -582,9 +582,13 @@ endif()
+ if(SVTHEVC_FOUND)
+ target_link_libraries(x265-static ${SVT_HEVC_LIBRARY})
+ endif()
++if(ENABLE_SHARED)
++ set_target_properties(x265-static PROPERTIES EXCLUDE_FROM_ALL 1)
++else()
+ install(TARGETS x265-static
+ LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
++endif()
+
+ if(ENABLE_HDR10_PLUS)
+ install(TARGETS hdr10plus-static
diff --git a/vcpkg/ports/x265/neon.diff b/vcpkg/ports/x265/neon.diff
new file mode 100644
index 0000000..9747f63
--- /dev/null
+++ b/vcpkg/ports/x265/neon.diff
@@ -0,0 +1,18 @@
+diff --git a/source/cmake/FindNeon.cmake b/source/cmake/FindNeon.cmake
+index cb02180..6a939b8 100644
+--- a/source/cmake/FindNeon.cmake
++++ b/source/cmake/FindNeon.cmake
+@@ -16,6 +16,13 @@ else()
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+
++if(CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a")
++ set(neon_version 1)
++elseif(CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
++ set(neon_version "${CMAKE_ANDROID_ARM_NEON}")
++elseif(CMAKE_CROSSCOMPILING AND CMAKE_SIZEOF_VOID_P LESS "8")
++ set(neon_version 0)
++endif()
+ if(neon_version)
+ set(CPU_HAS_NEON 1)
+ endif()
diff --git a/vcpkg/ports/x265/pkgconfig.diff b/vcpkg/ports/x265/pkgconfig.diff
new file mode 100644
index 0000000..514342f
--- /dev/null
+++ b/vcpkg/ports/x265/pkgconfig.diff
@@ -0,0 +1,49 @@
+diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
+index eaa5c6f..8a9ec44 100644
+--- a/source/CMakeLists.txt
++++ b/source/CMakeLists.txt
+@@ -811,6 +811,9 @@ else()
+ endif()
+ if(NOT MSVC)
+ set_target_properties(x265-static PROPERTIES OUTPUT_NAME x265)
++ set(X265_LIB x265)
++else()
++ set(X265_LIB x265-static)
+ endif()
+ if(EXTRA_LIB)
+ target_link_libraries(x265-static ${EXTRA_LIB})
+@@ -906,8 +909,10 @@ if(ENABLE_SHARED)
+ endif(SVTHEVC_FOUND)
+ if(MSVC)
+ set_target_properties(x265-shared PROPERTIES OUTPUT_NAME libx265)
++ set(X265_LIB libx265)
+ else()
+ set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265)
++ set(X265_LIB x265)
+ endif()
+ if(UNIX)
+ set_target_properties(x265-shared PROPERTIES VERSION ${X265_BUILD})
+@@ -944,7 +949,11 @@ endif()
+
+ if(X265_LATEST_TAG OR NOT GIT_FOUND)
+ # convert lists of link libraries into -lstdc++ -lm etc..
++ cmake_policy(SET CMP0057 NEW)
+ foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
++ if(LIB IN_LIST CMAKE_C_IMPLICIT_LINK_LIBRARIES)
++ continue()
++ endif()
+ if(IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
+ list(APPEND PLIBLIST "${LIB}")
+ else()
+diff --git a/source/x265.pc.in b/source/x265.pc.in
+index 0bf99e9..fe76d20 100644
+--- a/source/x265.pc.in
++++ b/source/x265.pc.in
+@@ -6,6 +6,6 @@ includedir=${prefix}/include
+ Name: @CMAKE_PROJECT_NAME@
+ Description: H.265/HEVC video encoder
+ Version: @X265_LATEST_TAG@
+-Libs: -L${libdir} -lx265
++Libs: -L${libdir} -l@X265_LIB@
+ Libs.private: @PRIVATE_LIBS@
+ Cflags: -I${includedir}
diff --git a/vcpkg/ports/x265/portfile.cmake b/vcpkg/ports/x265/portfile.cmake
new file mode 100644
index 0000000..7609049
--- /dev/null
+++ b/vcpkg/ports/x265/portfile.cmake
@@ -0,0 +1,66 @@
+vcpkg_from_bitbucket(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO multicoreware/x265_git
+ REF "${VERSION}"
+ SHA512 4b7d71f22f0a7f12ff93f9a01e361df2b80532cd8dac01b5465e63b5d8182f1a05c0289ad95f3aa972c963aa6cd90cb3d594f8b9a96f556a006cf7e1bdd9edda
+ HEAD_REF master
+ PATCHES
+ disable-install-pdb.patch
+ version.patch
+ linkage.diff
+ pkgconfig.diff
+ pthread.diff
+ compiler-target.diff
+ neon.diff
+ fix-cmake-4.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS OPTIONS
+ FEATURES
+ tool ENABLE_CLI
+)
+
+if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ vcpkg_find_acquire_program(NASM)
+ list(APPEND OPTIONS "-DNASM_EXECUTABLE=${NASM}")
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" AND NOT VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_OSX)
+ # x265 doesn't create sufficient PIC for asm, breaking usage
+ # in shared libs, e.g. the libheif gdk pixbuf plugin.
+ # Users can override this in custom triplets.
+ list(APPEND OPTIONS "-DENABLE_ASSEMBLY=OFF")
+ endif()
+elseif(VCPKG_TARGET_IS_WINDOWS)
+ list(APPEND OPTIONS "-DENABLE_ASSEMBLY=OFF")
+endif()
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ENABLE_SHARED)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}/source"
+ OPTIONS
+ ${OPTIONS}
+ -DENABLE_SHARED=${ENABLE_SHARED}
+ -DENABLE_PIC=ON
+ -DENABLE_LIBNUMA=OFF
+ "-DVERSION=${VERSION}"
+ OPTIONS_DEBUG
+ -DENABLE_CLI=OFF
+ MAYBE_UNUSED_VARIABLES
+ ENABLE_LIBNUMA
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_fixup_pkgconfig()
+
+if("tool" IN_LIST FEATURES)
+ vcpkg_copy_tools(TOOL_NAMES x265 AUTO_CLEAN)
+endif()
+
+if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/x265.h" "#ifdef X265_API_IMPORTS" "#if 1")
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
diff --git a/vcpkg/ports/x265/pthread.diff b/vcpkg/ports/x265/pthread.diff
new file mode 100644
index 0000000..890d774
--- /dev/null
+++ b/vcpkg/ports/x265/pthread.diff
@@ -0,0 +1,24 @@
+diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
+index a407271..f147d37 100755
+--- a/source/CMakeLists.txt
++++ b/source/CMakeLists.txt
+@@ -85,6 +85,9 @@ else()
+ endif()
+
+ if(UNIX)
++ set(THREADS_PREFER_PTHREAD_FLAG 1)
++ find_package(Threads)
++ add_library(pthread ALIAS Threads::Threads)
+ list(APPEND PLATFORM_LIBS pthread)
+ find_library(LIBRT rt)
+ if(LIBRT)
+@@ -705,6 +708,9 @@ if(X265_LATEST_TAG)
+ list(REMOVE_ITEM PLIBLIST "-lc" "-lpthread" "-lmingwex" "-lmingwthrd"
+ "-lmingw32" "-lmoldname" "-lmsvcrt" "-ladvapi32" "-lshell32"
+ "-luser32" "-lkernel32")
++ if(UNIX)
++ list(APPEND PLIBLIST ${CMAKE_THREAD_LIBS_INIT})
++ endif()
+ string(REPLACE ";" " " PRIVATE_LIBS "${PLIBLIST}")
+ else()
+ set(PRIVATE_LIBS "")
diff --git a/vcpkg/ports/x265/vcpkg.json b/vcpkg/ports/x265/vcpkg.json
new file mode 100644
index 0000000..2559f35
--- /dev/null
+++ b/vcpkg/ports/x265/vcpkg.json
@@ -0,0 +1,21 @@
+{
+ "name": "x265",
+ "version": "4.1",
+ "port-version": 1,
+ "description": "x265 is a H.265 / HEVC video encoder application library, designed to encode video or images into an H.265 / HEVC encoded bitstream.",
+ "homepage": "https://bitbucket.org/multicoreware/x265_git/",
+ "license": "GPL-2.0-or-later",
+ "supports": "!uwp & !xbox",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ }
+ ],
+ "features": {
+ "tool": {
+ "description": "Build the command line tool",
+ "supports": "!uwp"
+ }
+ }
+}
diff --git a/vcpkg/ports/x265/version.patch b/vcpkg/ports/x265/version.patch
new file mode 100644
index 0000000..b9cb75a
--- /dev/null
+++ b/vcpkg/ports/x265/version.patch
@@ -0,0 +1,16 @@
+diff --git a/source/cmake/Version.cmake b/source/cmake/Version.cmake
+index 3bbf42f..e77f639 100644
+--- a/source/cmake/Version.cmake
++++ b/source/cmake/Version.cmake
+@@ -28,6 +28,11 @@
+ set(X265_VERSION "unknown")
+ set(X265_LATEST_TAG "0.0")
+ set(X265_TAG_DISTANCE "0")
++if(VERSION)
++ set(X265_VERSION "${VERSION}-vcpkg")
++ set(X265_LATEST_TAG "${VERSION}")
++ return()
++endif()
+
+ #Find version control software to be used for live and extracted repositories from compressed tarballs
+ if(CMAKE_VERSION VERSION_LESS "2.8.10")