vcpkg/ports/ijg-libjpeg/portfile.cmake

51 lines
1.9 KiB
CMake
Raw Normal View History

2020-12-29 04:37:54 +08:00
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
2022-04-26 08:28:30 +08:00
URLS "http://www.ijg.org/files/jpegsr9e.zip"
FILENAME "jpegsr9e.zip"
SHA512 db7a2fb44e5cc20d61956c46334948af034c07cdcc0d6e41d9bd4f6611c0fbed8943d0a05029ba1bfb9d993f4acd0df5e95d0bc1cfb5a889b86a55b6b75fdf64
2020-12-29 04:37:54 +08:00
)
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
2022-04-26 08:28:30 +08:00
vcpkg_replace_string("${SOURCE_PATH}/jconfig.txt"
2020-12-29 04:37:54 +08:00
"#define HAVE_STDDEF_H"
"#cmakedefine HAVE_STDDEF_H"
)
2022-04-26 08:28:30 +08:00
vcpkg_replace_string("${SOURCE_PATH}/jconfig.txt"
2020-12-29 04:37:54 +08:00
"#define HAVE_STDLIB_H"
"#cmakedefine HAVE_STDLIB_H"
)
2022-04-26 08:28:30 +08:00
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
2020-12-29 04:37:54 +08:00
2022-04-26 08:28:30 +08:00
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
2020-12-29 04:37:54 +08:00
OPTIONS
-DBUILD_EXECUTABLES=OFF # supports [tools] feature to enable this option?
)
2022-04-26 08:28:30 +08:00
vcpkg_cmake_install()
2020-12-29 04:37:54 +08:00
vcpkg_copy_pdbs()
# There is no LICENSE file, but README containes some legal text.
2022-04-26 08:28:30 +08:00
file(INSTALL "${SOURCE_PATH}/README" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
2020-12-29 04:37:54 +08:00
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
2022-04-26 08:28:30 +08:00
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
2020-12-29 04:37:54 +08:00
endif()
2022-04-26 08:28:30 +08:00
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")