From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- vcpkg-ports/ijg-libjpeg/CMakeLists.txt | 65 ++++++++++++++++++++++++++++++++++ vcpkg-ports/ijg-libjpeg/portfile.cmake | 50 ++++++++++++++++++++++++++ vcpkg-ports/ijg-libjpeg/vcpkg.json | 18 ++++++++++ 3 files changed, 133 insertions(+) create mode 100644 vcpkg-ports/ijg-libjpeg/CMakeLists.txt create mode 100644 vcpkg-ports/ijg-libjpeg/portfile.cmake create mode 100644 vcpkg-ports/ijg-libjpeg/vcpkg.json (limited to 'vcpkg-ports/ijg-libjpeg') diff --git a/vcpkg-ports/ijg-libjpeg/CMakeLists.txt b/vcpkg-ports/ijg-libjpeg/CMakeLists.txt new file mode 100644 index 00000000..db58b395 --- /dev/null +++ b/vcpkg-ports/ijg-libjpeg/CMakeLists.txt @@ -0,0 +1,65 @@ +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_BINARY_DIR}/jconfig.h) + +list(APPEND PUBLIC_HEADERS jpeglib.h jerror.h jmorecfg.h ${CMAKE_CURRENT_BINARY_DIR}/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() + +target_include_directories(jpeg PRIVATE include ${CMAKE_CURRENT_BINARY_DIR}) + +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() diff --git a/vcpkg-ports/ijg-libjpeg/portfile.cmake b/vcpkg-ports/ijg-libjpeg/portfile.cmake new file mode 100644 index 00000000..f9771764 --- /dev/null +++ b/vcpkg-ports/ijg-libjpeg/portfile.cmake @@ -0,0 +1,50 @@ +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/jpegsr9e.zip" + FILENAME "jpegsr9e.zip" + SHA512 db7a2fb44e5cc20d61956c46334948af034c07cdcc0d6e41d9bd4f6611c0fbed8943d0a05029ba1bfb9d993f4acd0df5e95d0bc1cfb5a889b86a55b6b75fdf64 +) +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_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_EXECUTABLES=OFF # supports [tools] feature to enable this option? +) +vcpkg_cmake_install() +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") diff --git a/vcpkg-ports/ijg-libjpeg/vcpkg.json b/vcpkg-ports/ijg-libjpeg/vcpkg.json new file mode 100644 index 00000000..7c4d9642 --- /dev/null +++ b/vcpkg-ports/ijg-libjpeg/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "ijg-libjpeg", + "version-string": "9e", + "description": "Independent JPEG Group's JPEG software", + "homepage": "http://www.ijg.org/", + "license": null, + "supports": "!emscripten & !wasm32", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} -- cgit