Meta: Patch libjxl port to not link with libm when building with msvc

The libjxl port is required to add the `msvc-remove-libm` patch.
Otherwise LibGfx attempts to link with 'm.lib' which is not valid
for MSVC as the CRT bundles math functions implicitly unlike on Unix
This commit is contained in:
ayeteadoe 2025-06-26 10:13:00 -07:00 committed by Andrew Kaster
commit 2f7a83304f
Notes: github-actions[bot] 2025-06-27 01:37:55 +00:00
2 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,24 @@
--- a/lib/jxl.cmake 2024-11-26 05:02:35.000000000 -0800
+++ b/lib/jxl.cmake 2025-06-26 08:37:25.999263200 -0700
@@ -269,12 +269,15 @@
set(JPEGXL_LIBRARY_REQUIRES
"libhwy libbrotlienc libbrotlidec libjxl_cms")
-if (BUILD_SHARED_LIBS)
- set(JPEGXL_REQUIRES_TYPE "Requires.private")
- set(JPEGXL_PRIVATE_LIBS "-lm ${PKGCONFIG_CXX_LIB}")
-else()
- set(JPEGXL_REQUIRES_TYPE "Requires")
- set(JPEGXL_PUBLIC_LIBS "-lm ${PKGCONFIG_CXX_LIB}")
+# MSVCRT bundles math functions
+if(NOT MSVC)
+ if (BUILD_SHARED_LIBS)
+ set(JPEGXL_REQUIRES_TYPE "Requires.private")
+ set(JPEGXL_PRIVATE_LIBS "-lm ${PKGCONFIG_CXX_LIB}")
+ else()
+ set(JPEGXL_REQUIRES_TYPE "Requires")
+ set(JPEGXL_PUBLIC_LIBS "-lm ${PKGCONFIG_CXX_LIB}")
+ endif()
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/jxl/libjxl.pc.in"

View file

@ -6,6 +6,7 @@ vcpkg_from_github(
HEAD_REF main
PATCHES
fix-dependencies.patch
msvc-remove-libm.patch # https://github.com/microsoft/vcpkg/pull/46177
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS