[mozjpeg] Use vcpkg_from_github and vcpkg_copy_tool_dependencies

This commit is contained in:
Robert Schumacher 2017-10-06 14:06:43 -07:00
parent 13a225c6ab
commit 049ad42779
2 changed files with 20 additions and 15 deletions

View File

@ -1,3 +1,3 @@
Source: mozjpeg
Version: 3.2
Version: 3.2-1
Description: MozJPEG reduces file sizes of JPEG images while retaining quality and compatibility with the vast majority of the world's deployed decoders. It's compatible with libjpeg API and ABI, and can be used as a drop-in replacement for libjpeg.

View File

@ -1,27 +1,30 @@
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mozjpeg-3.2)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/mozilla/mozjpeg/archive/v3.2.zip"
FILENAME "mozjpeg.zip"
SHA512 a1ba53dea3e04add46616918b5e96f2c8102ef65856596f1794df29c8be27db3d9fb13e7ffc864d23626f98dff5a6b47315903cae9ae41f9905aef2cc91af0c5
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mozilla/mozjpeg
REF v3.2
SHA512 d14789827a9f4f78139a3945d3169d37eb891758b5ab40ef19e99ebebb2fb6d7c3a05495de245bba54cfd913b153af352159aa9fc0218127f97819137e0f1ab8
HEAD_REF master
)
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
set(ENV{PATH} "$ENV{PATH};${NASM_EXE_PATH}")
vcpkg_extract_source_archive(${ARCHIVE})
if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(OPTIONS "-DENABLE_SHARED=FALSE")
else()
set(OPTIONS "-DENABLE_STATIC=FALSE")
endif()
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" WITH_CRT_DLL)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${OPTIONS}
OPTIONS
${OPTIONS}
-DWITH_CRT_DLL=${WITH_CRT_DLL}
)
vcpkg_install_cmake()
@ -34,12 +37,14 @@ file(REMOVE ${DEBUGEXES})
#move exes to tools
file(GLOB EXES ${CURRENT_PACKAGES_DIR}/bin/*.exe)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools)
file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/mozjpeg)
file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/mozjpeg)
file(REMOVE ${EXES})
#remove empty fodlers after static build
if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static)
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/mozjpeg)
#remove empty folders after static build
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()