1
0

portfile.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. if(EXISTS ${CURRENT_INSTALLED_DIR}/share/libturbo-jpeg/copyright)
  2. message(FATAL_ERROR "'${PORT}' conflicts with 'libturbo-jpeg'. Please remove libturbo-jpeg:${TARGET_TRIPLET}, and try to install ${PORT}:${TARGET_TRIPLET} again.")
  3. endif()
  4. if(EXISTS ${CURRENT_INSTALLED_DIR}/share/mozjpeg/copyright)
  5. message(FATAL_ERROR "'${PORT}' conflicts with 'mozjpeg'. Please remove mozjpeg:${TARGET_TRIPLET}, and try to install ${PORT}:${TARGET_TRIPLET} again.")
  6. endif()
  7. if(VCPKG_TARGET_IS_WINDOWS)
  8. vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
  9. endif()
  10. vcpkg_download_distfile(ARCHIVE
  11. URLS "http://www.ijg.org/files/jpegsr9e.zip"
  12. FILENAME "jpegsr9e.zip"
  13. SHA512 db7a2fb44e5cc20d61956c46334948af034c07cdcc0d6e41d9bd4f6611c0fbed8943d0a05029ba1bfb9d993f4acd0df5e95d0bc1cfb5a889b86a55b6b75fdf64
  14. )
  15. vcpkg_extract_source_archive_ex(
  16. OUT_SOURCE_PATH SOURCE_PATH
  17. ARCHIVE ${ARCHIVE}
  18. )
  19. # Replace some #define in jconfig.txt to #cmakedefine so the CMakeLists.txt can run `configure_file` command.
  20. # See https://github.com/LuaDist/libjpeg
  21. vcpkg_replace_string("${SOURCE_PATH}/jconfig.txt"
  22. "#define HAVE_STDDEF_H"
  23. "#cmakedefine HAVE_STDDEF_H"
  24. )
  25. vcpkg_replace_string("${SOURCE_PATH}/jconfig.txt"
  26. "#define HAVE_STDLIB_H"
  27. "#cmakedefine HAVE_STDLIB_H"
  28. )
  29. file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
  30. vcpkg_cmake_configure(
  31. SOURCE_PATH "${SOURCE_PATH}"
  32. OPTIONS
  33. -DBUILD_EXECUTABLES=OFF # supports [tools] feature to enable this option?
  34. )
  35. vcpkg_cmake_install()
  36. vcpkg_copy_pdbs()
  37. # There is no LICENSE file, but README containes some legal text.
  38. file(INSTALL "${SOURCE_PATH}/README" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
  39. if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
  40. file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
  41. endif()
  42. file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
  43. file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")