mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 17:41:09 +08:00
[ijg-libjpeg] add new port (#14583)
This commit is contained in:
parent
c346336092
commit
bba1522d76
63
ports/ijg-libjpeg/CMakeLists.txt
Normal file
63
ports/ijg-libjpeg/CMakeLists.txt
Normal file
@ -0,0 +1,63 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(libjpeg LANGUAGES C)
|
||||
|
||||
option(BUILD_EXECUTABLES OFF)
|
||||
|
||||
#
|
||||
# jconfig.h is a public header, so it must be genrated. Please reference the install.txt in jpegsr9d.zip
|
||||
#
|
||||
# jconfig.txt should contain #cmakedefine which is modified by porfile.cmake of ijg-libjpeg port in VcPkg
|
||||
# By doing this we can skip 'configure' step. Visit https://github.com/LuaDist/libjpeg
|
||||
#
|
||||
include(CheckIncludeFile)
|
||||
check_include_file(stddef.h HAVE_STDDEF_H)
|
||||
check_include_file(stdlib.h HAVE_STDLIB_H)
|
||||
configure_file(jconfig.txt ${CMAKE_CURRENT_SOURCE_DIR}/jconfig.h)
|
||||
|
||||
list(APPEND PUBLIC_HEADERS jpeglib.h jerror.h jmorecfg.h jconfig.h)
|
||||
|
||||
add_library(jpeg
|
||||
${PUBLIC_HEADERS} jinclude.h jpegint.h jversion.h
|
||||
transupp.h jidctflt.c jidctfst.c jidctint.c jquant1.c jquant2.c jutils.c jmemnobs.c jaricom.c jerror.c jdatadst.c jdatasrc.c
|
||||
jmemsys.h
|
||||
jmemmgr.c
|
||||
cdjpeg.h cderror.h
|
||||
jcmaster.c jcmarker.c jcmainct.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c jcsample.c jctrans.c jcinit.c jcomapi.c jcparam.c jcprepct.c
|
||||
jdmaster.c jdmarker.c jdmainct.c jdapimin.c jdapistd.c jdarith.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdsample.c jdtrans.c jdinput.c jdmerge.c jdpostct.c
|
||||
jdct.h
|
||||
jfdctflt.c jfdctfst.c jfdctint.c
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(jpeg
|
||||
PRIVATE
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
)
|
||||
endif()
|
||||
|
||||
install(FILES ${PUBLIC_HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
|
||||
)
|
||||
install(TARGETS jpeg
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
|
||||
)
|
||||
|
||||
if(BUILD_EXECUTABLES)
|
||||
add_executable(cjpeg cdjpeg.c cjpeg.c rdbmp.c rdgif.c rdppm.c rdrle.c rdtarga.c rdswitch.c)
|
||||
target_link_libraries(cjpeg PRIVATE jpeg)
|
||||
|
||||
add_executable(djpeg cdjpeg.c djpeg.c wrbmp.c wrgif.c wrppm.c wrrle.c wrtarga.c rdcolmap.c)
|
||||
target_link_libraries(djpeg PRIVATE jpeg)
|
||||
|
||||
add_executable(jpegtran jpegtran.c cdjpeg.c rdswitch.c transupp.c)
|
||||
target_link_libraries(jpegtran PRIVATE jpeg)
|
||||
|
||||
add_executable(rdjpgcom rdjpgcom.c)
|
||||
add_executable(wrjpgcom wrjpgcom.c)
|
||||
|
||||
install(TARGETS cjpeg djpeg jpegtran rdjpgcom wrjpgcom
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/tools
|
||||
)
|
||||
endif()
|
51
ports/ijg-libjpeg/portfile.cmake
Normal file
51
ports/ijg-libjpeg/portfile.cmake
Normal file
@ -0,0 +1,51 @@
|
||||
if(EXISTS ${CURRENT_INSTALLED_DIR}/share/libturbo-jpeg/copyright)
|
||||
message(FATAL_ERROR "'${PORT}' conflicts with 'libturbo-jpeg'. Please remove libturbo-jpeg:${TARGET_TRIPLET}, and try to install ${PORT}:${TARGET_TRIPLET} again.")
|
||||
endif()
|
||||
if(EXISTS ${CURRENT_INSTALLED_DIR}/share/mozjpeg/copyright)
|
||||
message(FATAL_ERROR "'${PORT}' conflicts with 'mozjpeg'. Please remove mozjpeg:${TARGET_TRIPLET}, and try to install ${PORT}:${TARGET_TRIPLET} again.")
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
endif()
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://www.ijg.org/files/jpegsr9d.zip"
|
||||
FILENAME "jpegsr9d.zip"
|
||||
SHA512 441a783c945fd549693dbe3932d8d35e1ea00d8464870646760ed84a636facb4d7afe0ca3ab988e7281a71e41c2e96be618b8c6a898f116517e639720bba82a3
|
||||
)
|
||||
vcpkg_extract_source_archive_ex(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
ARCHIVE ${ARCHIVE}
|
||||
)
|
||||
|
||||
# Replace some #define in jconfig.txt to #cmakedefine so the CMakeLists.txt can run `configure_file` command.
|
||||
# See https://github.com/LuaDist/libjpeg
|
||||
vcpkg_replace_string(${SOURCE_PATH}/jconfig.txt
|
||||
"#define HAVE_STDDEF_H"
|
||||
"#cmakedefine HAVE_STDDEF_H"
|
||||
)
|
||||
vcpkg_replace_string(${SOURCE_PATH}/jconfig.txt
|
||||
"#define HAVE_STDLIB_H"
|
||||
"#cmakedefine HAVE_STDLIB_H"
|
||||
)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-DBUILD_EXECUTABLES=OFF # supports [tools] feature to enable this option?
|
||||
)
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
# There is no LICENSE file, but README containes some legal text.
|
||||
file(INSTALL ${SOURCE_PATH}/README DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
endif()
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
7
ports/ijg-libjpeg/vcpkg.json
Normal file
7
ports/ijg-libjpeg/vcpkg.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "ijg-libjpeg",
|
||||
"version-string": "9d",
|
||||
"description": "Independent JPEG Group's JPEG software",
|
||||
"homepage": "http://www.ijg.org/",
|
||||
"supports": "!emscripten & !wasm32"
|
||||
}
|
@ -458,6 +458,15 @@ ignition-msgs5:arm64-windows=fail
|
||||
ignition-msgs5:arm-uwp=fail
|
||||
ignition-msgs5:x64-uwp=fail
|
||||
ignition-msgs5:x64-osx=skip
|
||||
# Conflicts with libjpeg-turbo, mozjpeg
|
||||
ijg-libjpeg:arm64-windows = skip
|
||||
ijg-libjpeg:arm-uwp = skip
|
||||
ijg-libjpeg:x64-linux = skip
|
||||
ijg-libjpeg:x64-osx = skip
|
||||
ijg-libjpeg:x64-uwp = skip
|
||||
ijg-libjpeg:x64-windows = skip
|
||||
ijg-libjpeg:x64-windows-static = skip
|
||||
ijg-libjpeg:x86-windows = skip
|
||||
intel-ipsec:arm64-windows=fail
|
||||
intel-ipsec:arm-uwp=fail
|
||||
intel-ipsec:x64-osx=fail
|
||||
|
Loading…
x
Reference in New Issue
Block a user