2019-05-03 13:57:43 +08:00
|
|
|
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
|
|
|
|
2020-09-01 00:34:35 +08:00
|
|
|
set(LIBVPX_VERSION 1.9.0)
|
2017-03-16 03:07:16 +08:00
|
|
|
|
2020-09-01 00:34:35 +08:00
|
|
|
vcpkg_from_github(
|
2019-10-08 01:35:13 +08:00
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
2020-09-01 00:34:35 +08:00
|
|
|
REPO webmproject/libvpx
|
|
|
|
REF v${LIBVPX_VERSION}
|
|
|
|
SHA512 8d544552b35000ea5712aec220b78bb5f7dc210704b2f609365214cb95a4f5a0e343b362723d829cb4a9ac203b10d5443700ba84b28fd6b2fefbabb40663e298
|
|
|
|
HEAD_REF master
|
2019-10-08 01:35:13 +08:00
|
|
|
)
|
2017-03-16 03:07:16 +08:00
|
|
|
|
|
|
|
vcpkg_find_acquire_program(PERL)
|
2018-03-31 06:27:40 +08:00
|
|
|
|
2020-07-16 06:09:33 +08:00
|
|
|
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
|
|
|
|
|
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
vcpkg_acquire_msys(MSYS_ROOT PACKAGES make)
|
|
|
|
set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
|
2020-10-29 05:26:41 +08:00
|
|
|
set(ENV{PATH} "${MSYS_ROOT}/usr/bin;$ENV{PATH};${PERL_EXE_PATH}")
|
2020-07-16 06:09:33 +08:00
|
|
|
else()
|
|
|
|
set(BASH /bin/bash)
|
2020-10-29 05:26:41 +08:00
|
|
|
set(ENV{PATH} "${MSYS_ROOT}/usr/bin:$ENV{PATH}:${PERL_EXE_PATH}")
|
2020-07-16 06:09:33 +08:00
|
|
|
endif()
|
2017-03-16 03:07:16 +08:00
|
|
|
|
2020-10-29 05:26:41 +08:00
|
|
|
include(${CURRENT_INSTALLED_DIR}/share/yasm-tool-helper/yasm-tool-helper.cmake)
|
|
|
|
yasm_tool_helper(PREPEND_TO_PATH)
|
|
|
|
|
2020-07-16 06:09:33 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
2017-03-16 03:07:16 +08:00
|
|
|
|
2020-05-07 01:45:40 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
|
2017-03-16 03:07:16 +08:00
|
|
|
|
2020-05-07 01:45:40 +08:00
|
|
|
if(VCPKG_CRT_LINKAGE STREQUAL static)
|
|
|
|
set(LIBVPX_CRT_LINKAGE --enable-static-msvcrt)
|
|
|
|
set(LIBVPX_CRT_SUFFIX mt)
|
2019-09-10 00:00:10 +08:00
|
|
|
else()
|
2020-05-07 01:45:40 +08:00
|
|
|
set(LIBVPX_CRT_SUFFIX md)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
|
|
|
|
set(LIBVPX_TARGET_ARCH "x86-win32")
|
|
|
|
set(LIBVPX_ARCH_DIR "Win32")
|
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
|
|
|
|
set(LIBVPX_TARGET_ARCH "x86_64-win64")
|
|
|
|
set(LIBVPX_ARCH_DIR "x64")
|
2020-06-18 04:43:44 +08:00
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
|
|
|
set(LIBVPX_TARGET_ARCH "arm64-win64")
|
|
|
|
set(LIBVPX_ARCH_DIR "ARM64")
|
2020-05-07 01:45:40 +08:00
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
|
|
|
|
set(LIBVPX_TARGET_ARCH "armv7-win32")
|
|
|
|
set(LIBVPX_ARCH_DIR "ARM")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(LIBVPX_TARGET_VS "vs15")
|
|
|
|
|
|
|
|
message(STATUS "Generating makefile")
|
|
|
|
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND
|
|
|
|
${BASH} --noprofile --norc
|
|
|
|
"${SOURCE_PATH}/configure"
|
|
|
|
--target=${LIBVPX_TARGET_ARCH}-${LIBVPX_TARGET_VS}
|
|
|
|
${LIBVPX_CRT_LINKAGE}
|
|
|
|
--disable-examples
|
|
|
|
--disable-tools
|
|
|
|
--disable-docs
|
|
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}"
|
|
|
|
LOGNAME configure-${TARGET_TRIPLET})
|
|
|
|
|
|
|
|
message(STATUS "Generating MSBuild projects")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND
|
|
|
|
${BASH} --noprofile --norc -c "make dist"
|
|
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}"
|
|
|
|
LOGNAME generate-${TARGET_TRIPLET})
|
|
|
|
|
|
|
|
vcpkg_build_msbuild(
|
|
|
|
PROJECT_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vpx.vcxproj"
|
|
|
|
OPTIONS /p:UseEnv=True
|
|
|
|
)
|
|
|
|
|
2020-08-06 04:49:34 +08:00
|
|
|
# note: pdb file names are hardcoded in the lib file, cannot rename
|
2020-05-07 01:45:40 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
|
|
|
|
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/${LIBVPX_ARCH_DIR}/Release/vpxmd.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
2020-08-06 04:49:34 +08:00
|
|
|
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/${LIBVPX_ARCH_DIR}/Release/vpx/vpx.pdb" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
2020-05-07 01:45:40 +08:00
|
|
|
else()
|
|
|
|
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/${LIBVPX_ARCH_DIR}/Release/vpxmt.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
2020-08-06 04:49:34 +08:00
|
|
|
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/${LIBVPX_ARCH_DIR}/Release/vpx/vpx.pdb" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
2020-05-07 01:45:40 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
|
|
|
|
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/${LIBVPX_ARCH_DIR}/Debug/vpxmdd.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
2020-08-06 04:49:34 +08:00
|
|
|
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/${LIBVPX_ARCH_DIR}/Debug/vpx/vpx.pdb" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
2020-05-07 01:45:40 +08:00
|
|
|
else()
|
|
|
|
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/${LIBVPX_ARCH_DIR}/Debug/vpxmtd.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
2020-08-06 04:49:34 +08:00
|
|
|
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/${LIBVPX_ARCH_DIR}/Debug/vpx/vpx.pdb" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
2020-05-07 01:45:40 +08:00
|
|
|
endif()
|
2019-09-10 00:00:10 +08:00
|
|
|
endif()
|
|
|
|
|
2020-06-18 04:43:44 +08:00
|
|
|
if (VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
|
|
|
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vpx-vp8-vp9-nopost-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${LIBVPX_VERSION}/include/vpx")
|
|
|
|
elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
|
2020-05-07 01:45:40 +08:00
|
|
|
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vpx-vp8-vp9-nopost-nomt-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${LIBVPX_VERSION}/include/vpx")
|
2019-09-10 00:00:10 +08:00
|
|
|
else()
|
2020-05-07 01:45:40 +08:00
|
|
|
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vpx-vp8-vp9-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${LIBVPX_VERSION}/include/vpx")
|
2019-09-10 00:00:10 +08:00
|
|
|
endif()
|
2020-05-07 01:45:40 +08:00
|
|
|
file(
|
|
|
|
INSTALL
|
|
|
|
${LIBVPX_INCLUDE_DIR}
|
|
|
|
DESTINATION
|
|
|
|
"${CURRENT_PACKAGES_DIR}/include"
|
|
|
|
RENAME
|
|
|
|
"vpx")
|
2017-03-16 03:07:16 +08:00
|
|
|
|
|
|
|
else()
|
2020-05-07 01:45:40 +08:00
|
|
|
|
|
|
|
set(OPTIONS "--disable-examples --disable-tools --disable-docs --disable-unit-tests")
|
|
|
|
|
|
|
|
set(OPTIONS_DEBUG "--enable-debug-libs --enable-debug --prefix=${CURRENT_PACKAGES_DIR}/debug")
|
|
|
|
set(OPTIONS_RELEASE "--prefix=${CURRENT_PACKAGES_DIR}")
|
2020-07-16 06:09:33 +08:00
|
|
|
|
2020-05-07 01:45:40 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
|
|
set(OPTIONS "${OPTIONS} --disable-static --enable-shared")
|
|
|
|
else()
|
|
|
|
set(OPTIONS "${OPTIONS} --enable-static --disable-shared")
|
|
|
|
endif()
|
2020-05-27 05:05:44 +08:00
|
|
|
|
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
|
|
|
|
set(LIBVPX_TARGET_ARCH "x86")
|
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
|
|
|
|
set(LIBVPX_TARGET_ARCH "x86_64")
|
2020-09-25 03:12:50 +08:00
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
|
|
|
set(LIBVPX_TARGET_ARCH "arm64")
|
2020-05-27 05:05:44 +08:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "libvpx does not support architecture ${VCPKG_TARGET_ARCHITECTURE}")
|
|
|
|
endif()
|
|
|
|
|
2020-07-16 06:09:33 +08:00
|
|
|
if(VCPKG_TARGET_IS_MINGW)
|
|
|
|
if(LIBVPX_TARGET_ARCH STREQUAL "x86")
|
|
|
|
set(LIBVPX_TARGET "x86-win32-gcc")
|
|
|
|
else()
|
|
|
|
set(LIBVPX_TARGET "x86_64-win64-gcc")
|
|
|
|
endif()
|
|
|
|
elseif(VCPKG_TARGET_IS_LINUX)
|
2020-05-27 05:05:44 +08:00
|
|
|
set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-linux-gcc")
|
|
|
|
elseif(VCPKG_TARGET_IS_OSX)
|
|
|
|
set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-darwin17-gcc") # enable latest CPU instructions for best performance and less CPU usage on MacOS
|
|
|
|
else()
|
|
|
|
set(LIBVPX_TARGET "generic-gnu") # use default target
|
|
|
|
endif()
|
2020-05-07 01:45:40 +08:00
|
|
|
|
2020-05-27 05:05:44 +08:00
|
|
|
message(STATUS "Build info. Target: ${LIBVPX_TARGET}; Options: ${OPTIONS}")
|
2020-05-07 01:45:40 +08:00
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
message(STATUS "Configuring libvpx for Release")
|
|
|
|
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND
|
|
|
|
${BASH} --noprofile --norc
|
|
|
|
"${SOURCE_PATH}/configure"
|
2020-05-27 05:05:44 +08:00
|
|
|
--target=${LIBVPX_TARGET}
|
2020-05-07 01:45:40 +08:00
|
|
|
${OPTIONS}
|
|
|
|
${OPTIONS_RELEASE}
|
|
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
|
|
|
LOGNAME configure-${TARGET_TRIPLET}-rel)
|
|
|
|
|
|
|
|
message(STATUS "Building libvpx for Release")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND
|
|
|
|
${BASH} --noprofile --norc -c "make -j8"
|
|
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
|
|
|
LOGNAME build-${TARGET_TRIPLET}-rel
|
|
|
|
)
|
|
|
|
|
|
|
|
message(STATUS "Installing libvpx for Release")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND
|
|
|
|
${BASH} --noprofile --norc -c "make install"
|
|
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
|
|
|
LOGNAME install-${TARGET_TRIPLET}-rel
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# --- --- ---
|
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
message(STATUS "Configuring libvpx for Debug")
|
|
|
|
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND
|
|
|
|
${BASH} --noprofile --norc
|
|
|
|
"${SOURCE_PATH}/configure"
|
2020-05-27 05:05:44 +08:00
|
|
|
--target=${LIBVPX_TARGET}
|
2020-05-07 01:45:40 +08:00
|
|
|
${OPTIONS}
|
|
|
|
${OPTIONS_DEBUG}
|
|
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
|
|
|
LOGNAME configure-${TARGET_TRIPLET}-dbg)
|
|
|
|
|
|
|
|
message(STATUS "Building libvpx for Debug")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND
|
|
|
|
${BASH} --noprofile --norc -c "make -j8"
|
|
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
|
|
|
LOGNAME build-${TARGET_TRIPLET}-dbg
|
|
|
|
)
|
|
|
|
|
|
|
|
message(STATUS "Installing libvpx for Debug")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND
|
|
|
|
${BASH} --noprofile --norc -c "make install"
|
|
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
|
|
|
LOGNAME install-${TARGET_TRIPLET}-dbg
|
|
|
|
)
|
|
|
|
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
2020-09-25 02:43:33 +08:00
|
|
|
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libvpx_g.a)
|
2020-05-07 01:45:40 +08:00
|
|
|
endif()
|
2017-03-16 03:07:16 +08:00
|
|
|
endif()
|
|
|
|
|
2020-06-11 17:38:22 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
set(LIBVPX_CONFIG_DEBUG ON)
|
|
|
|
else()
|
|
|
|
set(LIBVPX_CONFIG_DEBUG OFF)
|
|
|
|
endif()
|
2020-06-18 04:43:44 +08:00
|
|
|
|
2020-06-11 17:38:22 +08:00
|
|
|
configure_file(${CMAKE_CURRENT_LIST_DIR}/unofficial-libvpx-config.cmake.in ${CURRENT_PACKAGES_DIR}/share/unofficial-libvpx/unofficial-libvpx-config.cmake @ONLY)
|
|
|
|
|
2020-06-18 04:43:44 +08:00
|
|
|
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|