From b5f40dc9d87a1accc13a96bafdee16f00b6eed30 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 24 Feb 2023 21:54:29 +0100 Subject: [PATCH] [vvenc] new port (#29619) * [simde] suppress min/max macro definitions * [vvenc] new port --- ports/simde/fix-windows-minmax.patch | 12 +++++ ports/simde/portfile.cmake | 2 + ports/simde/vcpkg.json | 4 +- ports/vvenc/fix-cmakelists.patch | 51 ++++++++++++++++++ ports/vvenc/fix-dependencies.patch | 77 ++++++++++++++++++++++++++++ ports/vvenc/no-werror.patch | 51 ++++++++++++++++++ ports/vvenc/portfile.cmake | 39 ++++++++++++++ ports/vvenc/vcpkg.json | 25 +++++++++ versions/baseline.json | 6 ++- versions/s-/simde.json | 5 ++ versions/v-/vvenc.json | 9 ++++ 11 files changed, 279 insertions(+), 2 deletions(-) create mode 100644 ports/simde/fix-windows-minmax.patch create mode 100644 ports/vvenc/fix-cmakelists.patch create mode 100644 ports/vvenc/fix-dependencies.patch create mode 100644 ports/vvenc/no-werror.patch create mode 100644 ports/vvenc/portfile.cmake create mode 100644 ports/vvenc/vcpkg.json create mode 100644 versions/v-/vvenc.json diff --git a/ports/simde/fix-windows-minmax.patch b/ports/simde/fix-windows-minmax.patch new file mode 100644 index 0000000000..52feeafc56 --- /dev/null +++ b/ports/simde/fix-windows-minmax.patch @@ -0,0 +1,12 @@ +diff --git a/simde/x86/sse.h b/simde/x86/sse.h +index 00119d3..a9dd705 100644 +--- a/simde/x86/sse.h ++++ b/simde/x86/sse.h +@@ -33,6 +33,7 @@ + #include "mmx.h" + + #if defined(_WIN32) ++ #define NOMINMAX + #include + #endif + diff --git a/ports/simde/portfile.cmake b/ports/simde/portfile.cmake index 68020a27a3..510d93d5de 100644 --- a/ports/simde/portfile.cmake +++ b/ports/simde/portfile.cmake @@ -6,6 +6,8 @@ vcpkg_from_github( REF v0.7.2 SHA512 E4EE5A4A7E8453F116F1325D147F91D358A300F41EA5566EA30FC19649BABABF3B87E3DC838D5608B578BD152207DF4156200FFC7FB98141BC7C0BB60C75F1F5 HEAD_REF master + PATCHES + fix-windows-minmax.patch ) file(COPY "${SOURCE_PATH}/simde" DESTINATION "${CURRENT_PACKAGES_DIR}/include") diff --git a/ports/simde/vcpkg.json b/ports/simde/vcpkg.json index d26159fe78..cfa1b06643 100644 --- a/ports/simde/vcpkg.json +++ b/ports/simde/vcpkg.json @@ -1,6 +1,8 @@ { "name": "simde", "version": "0.7.2", + "port-version": 1, "description": "Implementations of SIMD instruction sets for systems which don't natively support them", - "homepage": "https://github.com/simd-everywhere/simde" + "homepage": "https://github.com/simd-everywhere/simde", + "license": "MIT" } diff --git a/ports/vvenc/fix-cmakelists.patch b/ports/vvenc/fix-cmakelists.patch new file mode 100644 index 0000000000..adcc3d1230 --- /dev/null +++ b/ports/vvenc/fix-cmakelists.patch @@ -0,0 +1,51 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 551ec4b..ae36bc8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -288,8 +288,11 @@ endif() + + + add_subdirectory( "source/Lib/vvenc" ) ++if(BUILD_TOOLS) + add_subdirectory( "source/App/vvencapp" ) + add_subdirectory( "source/App/vvencFFapp" ) ++endif() ++if(BUILD_TESTING) + add_subdirectory( "test/vvenclibtest" ) + add_subdirectory( "test/vvencinterfacetest" ) + +@@ -378,6 +381,7 @@ add_vvenc_test( compare_output-medium_rc2p_statsFile_easy 30 NO_OUTPUT "${OUT_VV + + add_test( NAME Cleanup_remove_temp_files COMMAND ${CMAKE_COMMAND} -E remove -f ${CLEANUP_TEST_FILES} rec.yuv stats_exp.json stats_easy.json ) + set_tests_properties( Cleanup_remove_temp_files PROPERTIES FIXTURES_CLEANUP cleanup ) ++endif() + + if( VVENC_ENABLE_INSTALL ) + # include installer +diff --git a/cmake/modules/vvencInstall.cmake b/cmake/modules/vvencInstall.cmake +index 4945f1d..7006bf6 100644 +--- a/cmake/modules/vvencInstall.cmake ++++ b/cmake/modules/vvencInstall.cmake +@@ -16,9 +16,11 @@ macro( install_targets config_ ) + RUNTIME DESTINATION ${RUNTIME_DEST} + LIBRARY DESTINATION ${LIBRARY_DEST} + ARCHIVE DESTINATION ${ARCHIVE_DEST} ) ++ if(BUILD_TOOLS) + install( TARGETS vvencapp vvencFFapp + CONFIGURATIONS ${config_} + RUNTIME DESTINATION ${RUNTIME_DEST} ) ++ endif() + endmacro( install_targets ) + + # install pdb file for static and shared libraries +@@ -61,8 +63,10 @@ install_targets( RelWithDebInfo ) + + # install pdb files + install_lib_pdb( vvenc ) ++if(BUILD_TOOLS) + install_exe_pdb( vvencapp ) + install_exe_pdb( vvencFFapp ) ++endif() + + # configure version file + configure_file( cmake/install/vvencConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/vvencConfigVersion.cmake @ONLY ) diff --git a/ports/vvenc/fix-dependencies.patch b/ports/vvenc/fix-dependencies.patch new file mode 100644 index 0000000000..1dd997a372 --- /dev/null +++ b/ports/vvenc/fix-dependencies.patch @@ -0,0 +1,77 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 551ec4b..8405ad0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -161,6 +161,8 @@ set_property( GLOBAL PROPERTY USE_FOLDERS ON ) + # Enable multithreading + find_package( Threads REQUIRED ) + ++find_package(nlohmann_json CONFIG REQUIRED) ++ + # set _WIN32_WINNT + if( WIN32 ) + # set _WIN32_WINT version global + +diff --git a/source/App/vvencFFapp/CMakeLists.txt b/source/App/vvencFFapp/CMakeLists.txt +index 869b6ac..452301c 100644 +--- a/source/App/vvencFFapp/CMakeLists.txt ++++ b/source/App/vvencFFapp/CMakeLists.txt +@@ -34,7 +34,7 @@ target_compile_options( ${EXE_NAME} PRIVATE $<$,$:/W4 /WX /wd4100 /wd4244 /wd4251 /wd4459 /wd4996>) + + target_include_directories( ${EXE_NAME} PRIVATE ../../Lib ) +-target_link_libraries( ${EXE_NAME} Threads::Threads vvenc ) ++target_link_libraries( ${EXE_NAME} Threads::Threads vvenc nlohmann_json::nlohmann_json ) + + # example: place header files in different folders + source_group( "Header Files" FILES ${INC_FILES} ) + +diff --git a/source/App/vvencapp/CMakeLists.txt b/source/App/vvencapp/CMakeLists.txt +index a0e764b..98e5bb4 100644 +--- a/source/App/vvencapp/CMakeLists.txt ++++ b/source/App/vvencapp/CMakeLists.txt +@@ -31,7 +31,7 @@ target_compile_options( ${EXE_NAME} PRIVATE $<$,$:/W4 /WX /wd4244 /wd4251 /wd4996>) + + target_include_directories( ${EXE_NAME} PRIVATE ../../Lib ) +-target_link_libraries( ${EXE_NAME} Threads::Threads vvenc ) ++target_link_libraries( ${EXE_NAME} Threads::Threads vvenc nlohmann_json::nlohmann_json ) + + # example: place header files in different folders + source_group( "Header Files" FILES ${INC_FILES} ) +diff --git a/source/Lib/apputils/LogoRenderer.h b/source/Lib/apputils/LogoRenderer.h +index 6f990e6..bbf40d7 100644 +--- a/source/Lib/apputils/LogoRenderer.h ++++ b/source/Lib/apputils/LogoRenderer.h +@@ -58,7 +58,7 @@ POSSIBILITY OF SUCH DAMAGE. + #include "FileIOHelper.h" + + #ifdef VVENC_ENABLE_THIRDPARTY_JSON +-#include "../../../thirdparty/nlohmann_json/single_include/nlohmann/json.hpp" ++#include "nlohmann/json.hpp" + using nlohmann::json; + #endif + +diff --git a/source/Lib/vvenc/CMakeLists.txt b/source/Lib/vvenc/CMakeLists.txt +index 5ee3740..827cf41 100644 +--- a/source/Lib/vvenc/CMakeLists.txt ++++ b/source/Lib/vvenc/CMakeLists.txt +@@ -70,7 +70,8 @@ add_compile_definitions( ${LIB_NAME_UC}_SOURCE ) + # set PRIVATE include directories for all targets in this directory + include_directories( $ $ ) + include_directories( . .. ../DecoderLib ../EncoderLib ../CommonLib ../CommonLib/x86 ../apputils ) +-include_directories( SYSTEM ../../../thirdparty ) ++find_path(SIMDE_INCLUDE_DIRS "simde/arm/neon.h") ++include_directories(SYSTEM ${SIMDE_INCLUDE_DIRS}) + + # set common warning flags + add_compile_options( "$<$,$>:-Wall;-Werror;-Wno-deprecated-register;-Wno-unused-const-variable;-Wno-unknown-attributes>" ) +@@ -140,7 +141,7 @@ endif() + if( VVENC_ENABLE_THIRDPARTY_JSON ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVVENC_ENABLE_THIRDPARTY_JSON" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVVENC_ENABLE_THIRDPARTY_JSON" ) +- target_include_directories( ${LIB_NAME} PRIVATE ../../../thirdparty/nlohmann_json/single_include ) ++ target_link_libraries( ${LIB_NAME} PRIVATE nlohmann_json::nlohmann_json ) + endif() + + if( TARGET INTEL_ITT) diff --git a/ports/vvenc/no-werror.patch b/ports/vvenc/no-werror.patch new file mode 100644 index 0000000000..8c2dc265b8 --- /dev/null +++ b/ports/vvenc/no-werror.patch @@ -0,0 +1,51 @@ +diff --git a/source/App/vvencFFapp/CMakeLists.txt b/source/App/vvencFFapp/CMakeLists.txt +index 452301c..947da3d 100644 +--- a/source/App/vvencFFapp/CMakeLists.txt ++++ b/source/App/vvencFFapp/CMakeLists.txt +@@ -29,9 +29,9 @@ set_target_properties( ${EXE_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DE + set_target_properties( ${EXE_NAME} PROPERTIES RELWITHDEBINFO_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}" ) + set_target_properties( ${EXE_NAME} PROPERTIES MINSIZEREL_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}" ) + +-target_compile_options( ${EXE_NAME} PRIVATE $<$,$>:-Wall -Werror> +- $<$:-Wall -Werror -fdiagnostics-show-option> +- $<$:/W4 /WX /wd4100 /wd4244 /wd4251 /wd4459 /wd4996>) ++target_compile_options( ${EXE_NAME} PRIVATE $<$,$>:-Wall> ++ $<$:-Wall -fdiagnostics-show-option> ++ $<$:/wd4100 /wd4244 /wd4251 /wd4459 /wd4996>) + + target_include_directories( ${EXE_NAME} PRIVATE ../../Lib ) + target_link_libraries( ${EXE_NAME} Threads::Threads vvenc nlohmann_json::nlohmann_json ) +diff --git a/source/App/vvencapp/CMakeLists.txt b/source/App/vvencapp/CMakeLists.txt +index 98e5bb4..f5ae8f1 100644 +--- a/source/App/vvencapp/CMakeLists.txt ++++ b/source/App/vvencapp/CMakeLists.txt +@@ -26,9 +26,9 @@ set_target_properties( ${EXE_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DE + set_target_properties( ${EXE_NAME} PROPERTIES RELWITHDEBINFO_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}" ) + set_target_properties( ${EXE_NAME} PROPERTIES MINSIZEREL_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}" ) + +-target_compile_options( ${EXE_NAME} PRIVATE $<$,$>:-Wall -Werror> +- $<$:-Wall -Werror -fdiagnostics-show-option> +- $<$:/W4 /WX /wd4244 /wd4251 /wd4996>) ++target_compile_options( ${EXE_NAME} PRIVATE $<$,$>:-Wall> ++ $<$:-Wall -fdiagnostics-show-option> ++ $<$:/wd4244 /wd4251 /wd4996>) + + target_include_directories( ${EXE_NAME} PRIVATE ../../Lib ) + target_link_libraries( ${EXE_NAME} Threads::Threads vvenc nlohmann_json::nlohmann_json ) +diff --git a/source/Lib/vvenc/CMakeLists.txt b/source/Lib/vvenc/CMakeLists.txt +index 827cf41..93bcfc0 100644 +--- a/source/Lib/vvenc/CMakeLists.txt ++++ b/source/Lib/vvenc/CMakeLists.txt +@@ -74,9 +74,9 @@ find_path(SIMDE_INCLUDE_DIRS "simde/arm/neon.h") + include_directories(SYSTEM ${SIMDE_INCLUDE_DIRS}) + + # set common warning flags +-add_compile_options( "$<$,$>:-Wall;-Werror;-Wno-deprecated-register;-Wno-unused-const-variable;-Wno-unknown-attributes>" ) +-add_compile_options( "$<$:-Wall;-Werror;-Wno-unused-function;;-Wno-unused-variable;;-Wno-sign-compare;;-fdiagnostics-show-option;-Wno-ignored-attributes>" ) +-add_compile_options( "$<$:/W4;/WX;/wd4100;/wd4127;/wd4244;/wd4245;/wd4251;/wd4310;/wd4389;/wd4456;/wd4457;/wd4458;/wd4459;/wd4505;/wd4701;/wd4702;/wd4703;/wd4996>" ) ++add_compile_options( "$<$,$>:-Wall;-Wno-deprecated-register;-Wno-unused-const-variable;-Wno-unknown-attributes>" ) ++add_compile_options( "$<$:-Wall;-Wno-unused-function;;-Wno-unused-variable;;-Wno-sign-compare;;-fdiagnostics-show-option;-Wno-ignored-attributes>" ) ++add_compile_options( "$<$:/wd4100;/wd4127;/wd4244;/wd4245;/wd4251;/wd4310;/wd4389;/wd4456;/wd4457;/wd4458;/wd4459;/wd4505;/wd4701;/wd4702;/wd4703;/wd4996>" ) + + # don't export all symbols from shared libraries by default (gcc: -fvisibility=hidden), only those marked as VVENC_DECL + # behavior similar to __declspec(dllexport) on windows diff --git a/ports/vvenc/portfile.cmake b/ports/vvenc/portfile.cmake new file mode 100644 index 0000000000..750b23066c --- /dev/null +++ b/ports/vvenc/portfile.cmake @@ -0,0 +1,39 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO fraunhoferhhi/vvenc + REF v${VERSION} + SHA512 bf2ac5fc3859cb3303ef4fa4fcdbe00a6db617e3c2e76c6d658071a7650e5966fa1522ccb2feca8c770cea3ea25d2b573dbd0c72f4c0d71be61ba7dd1ab9440b + HEAD_REF master + PATCHES + fix-cmakelists.patch + fix-dependencies.patch + no-werror.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + tools BUILD_TOOLS +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS ${FEATURE_OPTIONS} + -DBUILD_TESTING=OFF + -DCCACHE_FOUND=OFF +) + + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/vvenc) + +vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() + +if(BUILD_TOOLS) + vcpkg_copy_tools(TOOL_NAMES vvencFFapp vvencapp AUTO_CLEAN) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt") diff --git a/ports/vvenc/vcpkg.json b/ports/vvenc/vcpkg.json new file mode 100644 index 0000000000..9ea8a66e9e --- /dev/null +++ b/ports/vvenc/vcpkg.json @@ -0,0 +1,25 @@ +{ + "name": "vvenc", + "version": "1.7.0", + "description": "VVenC is a fast and efficient H.266/VVC encoder implementation.", + "homepage": "https://github.com/fraunhoferhhi/vvenc", + "license": "BSD-3-Clause-Clear", + "supports": "!x86 & !arm", + "dependencies": [ + "nlohmann-json", + "simde", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "tools": { + "description": "Build user tools: vvencFFapp and vvencapp" + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index a12815ed47..784199783f 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7210,7 +7210,7 @@ }, "simde": { "baseline": "0.7.2", - "port-version": 0 + "port-version": 1 }, "simdjson": { "baseline": "3.1.2", @@ -8208,6 +8208,10 @@ "baseline": "3.0.1", "port-version": 0 }, + "vvenc": { + "baseline": "1.7.0", + "port-version": 0 + }, "vxl": { "baseline": "2.0.2", "port-version": 4 diff --git a/versions/s-/simde.json b/versions/s-/simde.json index e55f5f3313..e60cf9df4d 100644 --- a/versions/s-/simde.json +++ b/versions/s-/simde.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b9f97efd430bad429766d57361f329bb1e1597f4", + "version": "0.7.2", + "port-version": 1 + }, { "git-tree": "7cf62acaf3648a8f0c2d866263788dc413f2beba", "version": "0.7.2", diff --git a/versions/v-/vvenc.json b/versions/v-/vvenc.json new file mode 100644 index 0000000000..1d0185adf3 --- /dev/null +++ b/versions/v-/vvenc.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "35b2b999edf804e918aa499cbc108886dc7d528f", + "version": "1.7.0", + "port-version": 0 + } + ] +}