vcpkg/ports/x264/portfile.cmake
Stefano Sinigardi eff88baadc
[x64-windows-release] add a single config community triplet based on x64-windows and make it work on some ports (#15983)
* add a single config community triplet based on x64-windows

* add a failed port, otherwise mechanism does not support empty list

* add failures to baseline

* remove duplicate entry

* second round of failures added to baseline

* third round of regressions added to CI

* [ade] fix single-config builds

* [ade] update refs

* remove duplicate entries

* [unix2dos] restore eol in script file

* add even more ports now failing in singleConfig...

* [libjpeg-turbo] remove unnecessary check

* [libjpeg-turbo] fix references

* [baseline] restore check for ports that were added recently

* [libmodplug] enable single config triplets

* [tensorflow-common] enable single config triplets

* update baseline

* fix references

* remove wrong check for single config triplets

* fix references

* [ogre] fix single config builds

* [ogre] fix references

* [untested] force x64-windows-release as host triplet when testing x64-windows-release in CI

* fix

* [x264] fix for single config

* [x264] update refs

* [libffi] enable single config builds

* [libffi] update refs

* remove cli broken arguments

* [calceph] enable single-config builds

* [calceph] fix references

* [kf5config] enable single-config builds

* [kf5config] fix references

* [detours] enable single-config builds

* [detours] fix references

* [kf5*] enable single-config builds

* [kf5*] fix references

* fix

* kf5config fix reference

* trying again to force host triplet in CI

* [boost] fix for single-config builds

* [boost] update references

* fix

* [boost] update refs

* disable host triplet in ci because it's not necessary

* retrigger a build for ports previously failing

* remove host triplet in ci, not necessary anymore?

* make PR dry

* [tensorflow-common] bump version

* [tensorflow-common] fix references

* Fix version database for boost-modular-build-helper.

* fix references

* restore CRLF on some ports

* bump versions

* fix references

* bump port versions

* fix references

* boost-modular-build-helper: Reverted due to no changes.

detours, kf5config, kf5holidays, libbacktrace: Reverted due to only whitespace changes.
libffi: bumped port-version
libmodplug: reverted due to no functional changes
ogre, ogre-next: reverted due to incorrect case of "Debug" vs. "Release" already fixed in master.

And rebuilt version database.

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2021-12-20 10:50:45 -05:00

97 lines
3.0 KiB
CMake

set(X264_VERSION 164)
vcpkg_fail_port_install(ON_ARCH "arm")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mirror/x264
REF 5db6aa6cab1b146e07b60cc1736a01f21da01154
SHA512 d2cdd40d195fd6507abacc8b8810107567dff2c0a93424ba1eb00b544cb78a5430f00f9bcf8f19bd663ae77849225577da05bfcdb57948a8af9dc32a7c8b9ffd
HEAD_REF stable
PATCHES
"uwp-cflags.patch"
)
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
vcpkg_add_to_path(${NASM_EXE_PATH})
if(VCPKG_TARGET_IS_WINDOWS)
z_vcpkg_determine_autotools_host_cpu(BUILD_ARCH)
z_vcpkg_determine_autotools_target_cpu(HOST_ARCH)
list(APPEND OPTIONS --build=${BUILD_ARCH}-pc-mingw32)
list(APPEND OPTIONS --host=${HOST_ARCH}-pc-mingw32)
set(ENV{AS} "${NASM}")
endif()
if(VCPKG_TARGET_IS_UWP)
list(APPEND OPTIONS --extra-cflags=-DWINAPI_FAMILY=WINAPI_FAMILY_APP --extra-cflags=-D_WIN32_WINNT=0x0A00)
list(APPEND OPTIONS --extra-ldflags=-APPCONTAINER --extra-ldflags=WindowsApp.lib)
list(APPEND OPTIONS --disable-asm)
endif()
if(VCPKG_TARGET_IS_LINUX)
list(APPEND OPTIONS --enable-pic)
endif()
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
NO_ADDITIONAL_PATHS
OPTIONS
${OPTIONS}
--enable-strip
--disable-lavf
--disable-swscale
--disable-avs
--disable-ffms
--disable-gpac
--disable-lsmash
--enable-debug
)
vcpkg_install_make()
if(NOT VCPKG_TARGET_IS_UWP)
vcpkg_copy_tools(TOOL_NAMES x264 AUTO_CLEAN)
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
if(VCPKG_TARGET_IS_WINDOWS)
set(pcfile "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/x264.pc")
if(EXISTS "${pcfile}")
vcpkg_replace_string("${pcfile}" "-lx264" "-llibx264")
endif()
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
set(pcfile "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/x264.pc")
if(EXISTS "${pcfile}")
vcpkg_replace_string("${pcfile}" "-lx264" "-llibx264")
endif()
endif()
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libx264.dll.lib ${CURRENT_PACKAGES_DIR}/lib/libx264.lib)
if (NOT VCPKG_BUILD_TYPE)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libx264.dll.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libx264.lib)
endif()
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
# force U_STATIC_IMPLEMENTATION macro
file(READ ${CURRENT_PACKAGES_DIR}/include/x264.h HEADER_CONTENTS)
string(REPLACE "defined(U_STATIC_IMPLEMENTATION)" "1" HEADER_CONTENTS "${HEADER_CONTENTS}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/x264.h "${HEADER_CONTENTS}")
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/bin
${CURRENT_PACKAGES_DIR}/debug/bin
)
endif()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)