vcpkg/ports/libjxl/portfile.cmake
Davide Pianca 7eb700c968
[libjxl] Fix wasm32-emscripten build (#38785)
Fixes error during the CMake configuration step caused by the missing
execution of the third-party dependencies fetch script required for
Emscripten in libjxl CMakeLists.txt.
`
CMake Error at third_party/CMakeLists.txt:128 (message):
  Please run

C:/Users/david/vcpkg/buildtrees/libjxl/src/v0.10.2-fef900ea4e.clean/deps.sh
  to fetch the build dependencies.
`
Fix by using libpng provided by vcpkg disabling the bundled libpng
option.

- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- ~~[ ] SHA512s are updated for each updated download.~~
- ~~[ ] The "supports" clause reflects platforms that may be fixed by
this new version.~~
- ~~[ ] Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~~
- ~~[ ] Any patches that are no longer applied are deleted from the
port's directory.~~
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.
2024-05-17 14:34:35 -07:00

71 lines
2.1 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libjxl/libjxl
REF "v${VERSION}"
SHA512 1d19f30c0ae94e212326a15dc128612bce207e619c55c2a020401a27d01a933de71bb35e907521dc8fd853dd5578d74d74f7a5a282f0083fd22cf9cb07ccb96e
HEAD_REF main
PATCHES
fix-dependencies.patch
fix-tools-build.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
tools JPEGXL_ENABLE_TOOLS
INVERTED_FEATURES
tools CMAKE_DISABLE_FIND_PACKAGE_GIF
tools CMAKE_DISABLE_FIND_PACKAGE_JPEG
tools CMAKE_DISABLE_FIND_PACKAGE_PNG
tools CMAKE_DISABLE_FIND_PACKAGE_ZLIB
)
if(VCPKG_TARGET_IS_UWP)
string(APPEND VCPKG_C_FLAGS " /wd4146")
string(APPEND VCPKG_CXX_FLAGS " /wd4146")
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DJPEGXL_VERSION=${JPEGXL_VERSION}"
-DJPEGXL_FORCE_SYSTEM_BROTLI=ON
-DJPEGXL_FORCE_SYSTEM_HWY=ON
-DJPEGXL_FORCE_SYSTEM_LCMS2=ON
${FEATURE_OPTIONS}
-DJPEGXL_ENABLE_BENCHMARK=OFF
-DJPEGXL_ENABLE_DOXYGEN=OFF
-DJPEGXL_ENABLE_EXAMPLES=OFF
-DJPEGXL_ENABLE_FUZZERS=OFF
-DJPEGXL_ENABLE_JNI=OFF
-DJPEGXL_ENABLE_MANPAGES=OFF
-DJPEGXL_ENABLE_OPENEXR=OFF
-DJPEGXL_ENABLE_PLUGINS=OFF
-DJPEGXL_ENABLE_SJPEG=OFF
-DJPEGXL_ENABLE_SKCMS=OFF
-DJPEGXL_ENABLE_TCMALLOC=OFF
-DBUILD_TESTING=OFF
-DCMAKE_FIND_PACKAGE_TARGETS_GLOBAL=ON
-DJPEGXL_BUNDLE_LIBPNG=OFF
MAYBE_UNUSED_VARIABLES
CMAKE_DISABLE_FIND_PACKAGE_GIF
CMAKE_DISABLE_FIND_PACKAGE_JPEG
CMAKE_DISABLE_FIND_PACKAGE_PNG
CMAKE_DISABLE_FIND_PACKAGE_ZLIB
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
if(JPEGXL_ENABLE_TOOLS)
vcpkg_copy_tools(TOOL_NAMES cjxl djxl jxlinfo AUTO_CLEAN)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/jxl/jxl_export.h" "ifdef JXL_STATIC_DEFINE" "if 1")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")