mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-30 17:39:11 +08:00
b021f9db4a
* [libjpeg_turbo] Upgrades 2019.05.08 * Remove debug/bin * Update patch * Add black line
89 lines
3.5 KiB
CMake
89 lines
3.5 KiB
CMake
include(vcpkg_common_functions)
|
|
|
|
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO libjpeg-turbo/libjpeg-turbo
|
|
REF 2.0.2
|
|
SHA512 4dcde37ba014500cee69f7d49b359112655c177cf2c0003b4693bfe25f8a55147e9a87f58d31b4fc952a7faed6fecd5087220fd879110ade326922991f11c423
|
|
HEAD_REF master
|
|
PATCHES
|
|
add-options-for-exes-docs-headers.patch
|
|
|
|
#workaround for vcpkg bug see #5697 on github for more information
|
|
workaround_cmake_system_processor.patch
|
|
)
|
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" OR (VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore"))
|
|
set(LIBJPEGTURBO_SIMD -DWITH_SIMD=OFF)
|
|
else()
|
|
set(LIBJPEGTURBO_SIMD -DWITH_SIMD=ON)
|
|
vcpkg_find_acquire_program(NASM)
|
|
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
|
|
set(ENV{PATH} "$ENV{PATH};${NASM_EXE_PATH}")
|
|
endif()
|
|
|
|
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
|
set(ENV{_CL_} "-DNO_GETENV -DNO_PUTENV")
|
|
endif()
|
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ENABLE_SHARED)
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ENABLE_STATIC)
|
|
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" WITH_CRT_DLL)
|
|
|
|
vcpkg_configure_cmake(
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
PREFER_NINJA
|
|
OPTIONS
|
|
-DENABLE_STATIC=${ENABLE_STATIC}
|
|
-DENABLE_SHARED=${ENABLE_SHARED}
|
|
-DENABLE_EXECUTABLES=OFF
|
|
-DINSTALL_DOCS=OFF
|
|
-DWITH_CRT_DLL=${WITH_CRT_DLL}
|
|
${LIBJPEGTURBO_SIMD}
|
|
OPTIONS_DEBUG -DINSTALL_HEADERS=OFF
|
|
)
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
# Rename libraries for static builds
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/jpeg-static.lib")
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/jpeg-static.lib" "${CURRENT_PACKAGES_DIR}/lib/jpeg.lib")
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/turbojpeg-static.lib" "${CURRENT_PACKAGES_DIR}/lib/turbojpeg.lib")
|
|
endif()
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/jpeg-static.lib")
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/jpeg-static.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/jpegd.lib")
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/turbojpeg-static.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/turbojpegd.lib")
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
|
|
endif()
|
|
else(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/jpeg.lib")
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/jpeg.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/jpegd.lib")
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/turbojpeg.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/turbojpegd.lib")
|
|
endif()
|
|
endif()
|
|
|
|
file(COPY
|
|
${SOURCE_PATH}/LICENSE.md
|
|
DESTINATION ${CURRENT_PACKAGES_DIR}/share/libjpeg-turbo
|
|
)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/man)
|
|
|
|
file(GLOB EXE ${CURRENT_PACKAGES_DIR}/bin/*.exe)
|
|
file(GLOB DEBUG_EXE ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe)
|
|
if(EXE OR DEBUG_EXE)
|
|
file(REMOVE ${EXE} ${DEBUG_EXE})
|
|
endif()
|
|
|
|
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
|
file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/jpeg)
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libjpeg-turbo/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/libjpeg-turbo/copyright)
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
vcpkg_test_cmake(PACKAGE_NAME JPEG MODULE)
|